From 406da44da31f71afd98fc45e2bbfbf41deff1d12 Mon Sep 17 00:00:00 2001 From: Brian Date: Thu, 2 Aug 2007 13:48:02 -0600 Subject: setup more state for clear_with_quad() --- src/mesa/state_tracker/st_cb_clear.c | 49 +++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 18 deletions(-) (limited to 'src/mesa/state_tracker') diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index 8e2e30253e..85df549404 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -96,12 +96,34 @@ clear_with_quad(GLcontext *ctx, GLboolean color, GLboolean depth, GLboolean stencil) { struct st_context *st = ctx->st; + struct pipe_alpha_test_state alpha_test; struct pipe_blend_state blend; struct pipe_depth_state depth_test; struct pipe_stencil_state stencil_test; + struct pipe_setup_state setup; + + /* alpha state: disabled */ + memset(&alpha_test, 0, sizeof(alpha_test)); + st->pipe->set_alpha_test_state(st->pipe, &alpha_test); + + /* blend state: RGBA masking */ + memset(&blend, 0, sizeof(blend)); + if (color) { + if (ctx->Color.ColorMask[0]) + blend.colormask |= PIPE_MASK_R; + if (ctx->Color.ColorMask[1]) + blend.colormask |= PIPE_MASK_G; + if (ctx->Color.ColorMask[2]) + blend.colormask |= PIPE_MASK_B; + if (ctx->Color.ColorMask[3]) + blend.colormask |= PIPE_MASK_A; + if (st->ctx->Color.DitherFlag) + blend.dither = 1; + } + st->pipe->set_blend_state(st->pipe, &blend); /* depth state: always pass */ - memset(&depth_test, 0, sizeof(depth)); + memset(&depth_test, 0, sizeof(depth_test)); if (depth) { depth_test.enabled = 1; depth_test.writemask = 1; @@ -109,8 +131,12 @@ clear_with_quad(GLcontext *ctx, } st->pipe->set_depth_state(st->pipe, &depth_test); + /* setup state: nothing */ + memset(&setup, 0, sizeof(setup)); + st->pipe->set_setup_state(st->pipe, &setup); + /* stencil state: always set to ref value */ - memset(&stencil_test, 0, sizeof(stencil)); + memset(&stencil_test, 0, sizeof(stencil_test)); if (stencil) { stencil_test.front_enabled = 1; stencil_test.front_func = PIPE_FUNC_ALWAYS; @@ -123,22 +149,7 @@ clear_with_quad(GLcontext *ctx, } st->pipe->set_stencil_state(st->pipe, &stencil_test); - /* blend state: RGBA masking */ - memset(&blend, 0, sizeof(blend)); - if (color) { - if (ctx->Color.ColorMask[0]) - blend.colormask |= PIPE_MASK_R; - if (ctx->Color.ColorMask[1]) - blend.colormask |= PIPE_MASK_G; - if (ctx->Color.ColorMask[2]) - blend.colormask |= PIPE_MASK_B; - if (ctx->Color.ColorMask[3]) - blend.colormask |= PIPE_MASK_A; - if (st->ctx->Color.DitherFlag) - blend.dither = 1; - } - st->pipe->set_blend_state(st->pipe, &blend); - + /* draw quad matching scissor rect (XXX verify coord round-off) */ draw_quad(ctx, ctx->Scissor.X, ctx->Scissor.Y, ctx->Scissor.X + ctx->Scissor.Width, @@ -146,8 +157,10 @@ clear_with_quad(GLcontext *ctx, ctx->Depth.Clear, ctx->Color.ClearColor); /* Restore GL state */ + st->pipe->set_alpha_test_state(st->pipe, &st->state.alpha_test); st->pipe->set_blend_state(st->pipe, &st->state.blend); st->pipe->set_depth_state(st->pipe, &st->state.depth); + st->pipe->set_setup_state(st->pipe, &st->state.setup); st->pipe->set_stencil_state(st->pipe, &st->state.stencil); /* OR: st_invalidate_state(ctx, _NEW_COLOR | _NEW_DEPTH | _NEW_STENCIL); -- cgit v1.2.3