From 5b59e6116db5241dc9a08b98e5eb8f0c770c05ea Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 17 Aug 2007 10:49:36 +0100 Subject: Use simple st->pipe->clear() in more cases for depth/stencil clears. --- src/mesa/state_tracker/st_cb_clear.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index d584f0cafc..f6c65ff466 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -408,18 +408,19 @@ static void clear_depth_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) { struct st_renderbuffer *strb = st_renderbuffer(rb); + const GLboolean isDS = is_depth_stencil_format(strb->surface->format); assert(strb->surface->format); - if (!ctx->Scissor.Enabled && - !is_depth_stencil_format(strb->surface->format)) { - /* clear whole depth buffer w/out masking */ - GLuint clearValue = depth_value(strb->surface->format, ctx->Depth.Clear); - ctx->st->pipe->clear(ctx->st->pipe, strb->surface, clearValue); + if (ctx->Scissor.Enabled || + (isDS && ctx->DrawBuffer->Visual.stencilBits > 0)) { + /* scissoring or we have a combined depth/stencil buffer */ + clear_with_quad(ctx, GL_FALSE, GL_TRUE, GL_FALSE); } else { - /* masking or scissoring or combined z/stencil buffer */ - clear_with_quad(ctx, GL_FALSE, GL_TRUE, GL_FALSE); + /* simple clear of whole buffer */ + GLuint clearValue = depth_value(strb->surface->format, ctx->Depth.Clear); + ctx->st->pipe->clear(ctx->st->pipe, strb->surface, clearValue); } } @@ -428,18 +429,20 @@ static void clear_stencil_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) { struct st_renderbuffer *strb = st_renderbuffer(rb); + const GLboolean isDS = is_depth_stencil_format(strb->surface->format); const GLuint stencilMax = (1 << rb->StencilBits) - 1; GLboolean maskStencil = ctx->Stencil.WriteMask[0] != stencilMax; - if (!maskStencil && !ctx->Scissor.Enabled && - !is_depth_stencil_format(strb->surface->format)) { - /* clear whole stencil buffer w/out masking */ - GLuint clearValue = ctx->Stencil.Clear; - ctx->st->pipe->clear(ctx->st->pipe, strb->surface, clearValue); + if (maskStencil || + ctx->Scissor.Enabled || + (isDS && ctx->DrawBuffer->Visual.depthBits > 0)) { + /* masking or scissoring or combined depth/stencil buffer */ + clear_with_quad(ctx, GL_FALSE, GL_FALSE, GL_TRUE); } else { - /* masking or scissoring */ - clear_with_quad(ctx, GL_FALSE, GL_FALSE, GL_TRUE); + /* simple clear of whole buffer */ + GLuint clearValue = ctx->Stencil.Clear; + ctx->st->pipe->clear(ctx->st->pipe, strb->surface, clearValue); } } -- cgit v1.2.3