diff options
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/state_tracker/st_cb_clear.c | 49 |
1 files changed, 31 insertions, 18 deletions
diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index 8e2e30253ed..85df549404a 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); |