[mutter/gbsneto/software-picking: 191/195] cogl/framebuffer: Check buffer bits before modifying it
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gbsneto/software-picking: 191/195] cogl/framebuffer: Check buffer bits before modifying it
- Date: Mon, 2 Sep 2019 17:31:19 +0000 (UTC)
commit 7a8f257cc67209e36242ff51b9c69c72ff9c895d
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Mon Jan 21 10:56:42 2019 -0200
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
cogl/cogl/cogl-framebuffer.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/cogl/cogl/cogl-framebuffer.c b/cogl/cogl/cogl-framebuffer.c
index 527fd81ea..643dd3c98 100644
--- a/cogl/cogl/cogl-framebuffer.c
+++ b/cogl/cogl/cogl-framebuffer.c
@@ -256,11 +256,16 @@ cogl_framebuffer_clear4f (CoglFramebuffer *framebuffer,
float alpha)
{
CoglClipStack *clip_stack = _cogl_framebuffer_get_clip_stack (framebuffer);
+ gboolean has_depth_and_color_buffer_bits;
int scissor_x0;
int scissor_y0;
int scissor_x1;
int scissor_y1;
+ has_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 (has_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 (has_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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]