[Mesa-dev] [PATCH 2/4] i965: Skip doing color clears if color writes are disabled.

Kenneth Graunke kenneth at whitecape.org
Fri Mar 21 04:47:30 PDT 2014


WebGL Aquarium in Chrome 24 actually hits this.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Cc: Dylan Baker <baker.dylan.c at gmail.com>
Cc: Keith Packard <keithp at keithp.com>
Cc: Eric Anholt <eric at anholt.net>
---
 src/mesa/drivers/dri/i965/brw_blorp_clear.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp b/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
index 76f8299..45b9fa0 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
@@ -502,6 +502,11 @@ do_single_blorp_clear(struct brw_context *brw, struct gl_framebuffer *fb,
    struct gl_context *ctx = &brw->ctx;
    struct intel_renderbuffer *irb = intel_renderbuffer(rb);
 
+   /* If color writes are entirely disabled, there's nothing to do. */
+   GLubyte *color_mask = ctx->Color.ColorMask[buf];
+   if ((color_mask[0] | color_mask[1] | color_mask[2] | color_mask[3]) == 0)
+      return true;
+
    brw_blorp_clear_params params(brw, fb, rb, ctx->Color.ColorMask[buf],
                                  partial_clear, layer);
 
-- 
1.9.0



More information about the mesa-dev mailing list