gl-renderer: Ensure SHM buffer format stays the same

Rather than checking all the pixel-format components which are currently
duplicated inside gl-renderer, just check for equality of the pixel
format itself, which will become useful as we remove some of the
duplicate content.

This means that the texture storage will now be reallocated when clients
switch between pixel formats which could've had compatible GL storage
(e.g. XRGB <-> ARGB) on the same surface. However this does not seem
like a case worth optimising, and simplifies the code somewhat.

Signed-off-by: Daniel Stone <daniels@collabora.com>
dev
Daniel Stone 3 years ago committed by Pekka Paalanen
parent d696f8df1f
commit 2e6827d70e
  1. 12
      libweston/renderer-gl/gl-renderer.c

@ -2066,18 +2066,8 @@ unsupported:
if (gs->buffer &&
buffer->width == old_buffer->width &&
buffer->height == old_buffer->height &&
hsub[0] == gs->buffer->hsub[0] &&
hsub[1] == gs->buffer->hsub[1] &&
hsub[2] == gs->buffer->hsub[2] &&
vsub[0] == gs->buffer->vsub[0] &&
vsub[1] == gs->buffer->vsub[1] &&
vsub[2] == gs->buffer->vsub[2] &&
gl_format[0] == gs->buffer->gl_format[0] &&
gl_format[1] == gs->buffer->gl_format[1] &&
gl_format[2] == gs->buffer->gl_format[2] &&
gl_pixel_type == gs->buffer->gl_pixel_type) {
buffer->pixel_format == old_buffer->pixel_format) {
gs->buffer->pitch = pitch;
gs->buffer->shader_variant = shader_variant;
memcpy(gs->buffer->offset, offset, sizeof(offset));
return true;
}

Loading…
Cancel
Save