[Cogl] [PATCH] framebuffer: NOP _set_color_mask if mask isn't changing

Robert Bragg robert at sixbynine.org
Tue Oct 15 06:06:40 PDT 2013


From: Robert Bragg <robert at linux.intel.com>

This makes cogl_framebuffer_set_color_mask immediately bail out if the
given mask equals the framebuffer's current mask, since the cost of
flushing the journal and flushing the gl state will hugely outweigh the
cost of the check.
---
 cogl/cogl-framebuffer.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/cogl/cogl-framebuffer.c b/cogl/cogl-framebuffer.c
index b98719c..b002f61 100644
--- a/cogl/cogl-framebuffer.c
+++ b/cogl/cogl-framebuffer.c
@@ -946,6 +946,9 @@ void
 cogl_framebuffer_set_color_mask (CoglFramebuffer *framebuffer,
                                  CoglColorMask color_mask)
 {
+  if (framebuffer->color_mask == color_mask)
+    return;
+
   /* XXX: Currently color mask changes don't go through the journal */
   _cogl_framebuffer_flush_journal (framebuffer);
 
-- 
1.8.3.1



More information about the Cogl mailing list