From: Eric Anholt Date: Fri, 18 May 2012 18:55:53 +0000 (-0700) Subject: i965: Switch blit color clears to tri clears on gen4/5. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7c3e88f1fc2aa9d3740163bcf8718e6d8709a204;p=mesa.git i965: Switch blit color clears to tri clears on gen4/5. Our understanding is that the 3D engine is supposed to be faster anyway. We used to have more overhead in our tri clear path than we do today, which would have led to this choice. But given that we almost always see a depth clear along with a color clear, the path was hardly exercised anyway. Also, the color mask logic was broken in the presence of GL_EXT_draw_buffers2's per-buffer colormask. Reviewed-by: Ian Romanick Reviewed-by: Chad Versace --- diff --git a/src/mesa/drivers/dri/i965/brw_clear.c b/src/mesa/drivers/dri/i965/brw_clear.c index 6761e344303..6717862e806 100644 --- a/src/mesa/drivers/dri/i965/brw_clear.c +++ b/src/mesa/drivers/dri/i965/brw_clear.c @@ -81,9 +81,7 @@ static void intelClear(struct gl_context *ctx, GLbitfield mask) { struct intel_context *intel = intel_context(ctx); - const GLuint colorMask = *((GLuint *) & ctx->Color.ColorMask[0]); GLbitfield tri_mask = 0; - GLbitfield blit_mask = 0; GLbitfield swrast_mask = 0; struct gl_framebuffer *fb = ctx->DrawBuffer; struct intel_renderbuffer *irb; @@ -115,15 +113,7 @@ intelClear(struct gl_context *ctx, GLbitfield mask) _swrast_Clear(ctx, swrast_mask); } - /* HW color buffers (front, back, aux, generic FBO, etc) */ - if (intel->gen < 6 && colorMask == ~0) { - /* clear all R,G,B,A */ - blit_mask |= (mask & BUFFER_BITS_COLOR); - } - else { - /* glColorMask in effect */ - tri_mask |= (mask & BUFFER_BITS_COLOR); - } + tri_mask |= (mask & BUFFER_BITS_COLOR); /* Make sure we have up to date buffers before we start looking at * the tiling bits to determine how to clear. */ @@ -143,24 +133,8 @@ intelClear(struct gl_context *ctx, GLbitfield mask) tri_mask |= BUFFER_BIT_DEPTH; } - /* If we're doing a tri pass for depth/stencil, include a likely color - * buffer with it. - */ - if (mask & (BUFFER_BIT_DEPTH | BUFFER_BIT_STENCIL)) { - int color_bit = ffs(mask & BUFFER_BITS_COLOR); - if (color_bit != 0) { - tri_mask |= blit_mask & (1 << (color_bit - 1)); - blit_mask &= ~(1 << (color_bit - 1)); - } - } - /* Anything left, just use tris */ - tri_mask |= mask & ~blit_mask; - - if (blit_mask) { - debug_mask("blit", blit_mask); - tri_mask |= intelClearWithBlit(ctx, blit_mask); - } + tri_mask |= mask; if (tri_mask) { debug_mask("tri", tri_mask);