cogl/framebuffer: Check buffer bits before modifying it
CoglFramebuffer checks the passed buffer bits in order to detect when the fast path (that uses the journal) should be used. However, it also modifies one of the buffer bits that is checked for the fast path, meaning we never actually hit the fast path on cogl_framebuffer_cleaf4f(). Check the depth and color buffer bits before modifying them. https://gitlab.gnome.org/GNOME/mutter/merge_requests/402
This commit is contained in:
parent
e82a657cd9
commit
5d646a5d6f
@ -256,11 +256,16 @@ cogl_framebuffer_clear4f (CoglFramebuffer *framebuffer,
|
||||
float alpha)
|
||||
{
|
||||
CoglClipStack *clip_stack = _cogl_framebuffer_get_clip_stack (framebuffer);
|
||||
gboolean had_depth_and_color_buffer_bits;
|
||||
int scissor_x0;
|
||||
int scissor_y0;
|
||||
int scissor_x1;
|
||||
int scissor_y1;
|
||||
|
||||
had_depth_and_color_buffer_bits =
|
||||
(buffers & COGL_BUFFER_BIT_DEPTH) &&
|
||||
(buffers & COGL_BUFFER_BIT_COLOR);
|
||||
|
||||
if (!framebuffer->depth_buffer_clear_needed &&
|
||||
(buffers & COGL_BUFFER_BIT_DEPTH))
|
||||
buffers &= ~(COGL_BUFFER_BIT_DEPTH);
|
||||
@ -306,8 +311,7 @@ cogl_framebuffer_clear4f (CoglFramebuffer *framebuffer,
|
||||
* Note: Comparing without an epsilon is considered
|
||||
* appropriate here.
|
||||
*/
|
||||
if (buffers & COGL_BUFFER_BIT_COLOR &&
|
||||
buffers & COGL_BUFFER_BIT_DEPTH &&
|
||||
if (had_depth_and_color_buffer_bits &&
|
||||
!framebuffer->clear_clip_dirty &&
|
||||
framebuffer->clear_color_red == red &&
|
||||
framebuffer->clear_color_green == green &&
|
||||
@ -383,7 +387,7 @@ cleared:
|
||||
if (buffers & COGL_BUFFER_BIT_DEPTH)
|
||||
framebuffer->depth_buffer_clear_needed = FALSE;
|
||||
|
||||
if (buffers & COGL_BUFFER_BIT_COLOR && buffers & COGL_BUFFER_BIT_DEPTH)
|
||||
if (had_depth_and_color_buffer_bits)
|
||||
{
|
||||
/* For our fast-path for reading back a single pixel of simple
|
||||
* scenes where the whole frame is in the journal we need to
|
||||
|
Loading…
Reference in New Issue
Block a user