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

Ian Romanick idr at freedesktop.org
Fri Mar 21 10:01:15 PDT 2014


On 03/21/2014 04:47 AM, Kenneth Graunke wrote:
> 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;
> +

It seems like this check should be at a higher level.  Either in
brw_clear or in core Mesa code.  I think there's already a similar check
in core Mesa that removes GL_COLOR_BUFFER_BIT if there is no color buffer.

>     brw_blorp_clear_params params(brw, fb, rb, ctx->Color.ColorMask[buf],
>                                   partial_clear, layer);
>  
> 



More information about the mesa-dev mailing list