diff options
author | Roland Scheidegger <sroland@vmware.com> | 2010-02-11 18:15:10 +0100 |
---|---|---|
committer | Roland Scheidegger <sroland@vmware.com> | 2010-02-11 18:15:10 +0100 |
commit | 263406addb90ca7599ddfb210944ab0dd63b973c (patch) | |
tree | 161c0104195ee4f6f7fe1f0ae6e8c6fa983dd466 | |
parent | b75adabc89e34083ac302ac9bafc8d80b62ac14c (diff) | |
download | external_mesa3d-263406addb90ca7599ddfb210944ab0dd63b973c.zip external_mesa3d-263406addb90ca7599ddfb210944ab0dd63b973c.tar.gz external_mesa3d-263406addb90ca7599ddfb210944ab0dd63b973c.tar.bz2 |
gallium: give pipe_stencil_ref its own cso_save/restore functions
seems cleaner, and other dynamic state like viewport is handled that way too
-rw-r--r-- | src/gallium/auxiliary/cso_cache/cso_context.c | 19 | ||||
-rw-r--r-- | src/gallium/auxiliary/cso_cache/cso_context.h | 2 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_clear.c | 2 |
3 files changed, 18 insertions, 5 deletions
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c index e110f05..b5241fa 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.c +++ b/src/gallium/auxiliary/cso_cache/cso_context.c @@ -746,7 +746,6 @@ void cso_save_depth_stencil_alpha(struct cso_context *ctx) { assert(!ctx->depth_stencil_saved); ctx->depth_stencil_saved = ctx->depth_stencil; - ctx->stencil_ref_saved = ctx->stencil_ref; } void cso_restore_depth_stencil_alpha(struct cso_context *ctx) @@ -756,10 +755,6 @@ void cso_restore_depth_stencil_alpha(struct cso_context *ctx) ctx->pipe->bind_depth_stencil_alpha_state(ctx->pipe, ctx->depth_stencil_saved); } ctx->depth_stencil_saved = NULL; - if (memcmp(&ctx->stencil_ref, &ctx->stencil_ref_saved, sizeof(ctx->stencil_ref))) { - ctx->stencil_ref = ctx->stencil_ref_saved; - ctx->pipe->set_stencil_ref(ctx->pipe, &ctx->stencil_ref); - } } @@ -1083,6 +1078,20 @@ enum pipe_error cso_set_stencil_ref(struct cso_context *ctx, return PIPE_OK; } +void cso_save_stencil_ref(struct cso_context *ctx) +{ + ctx->stencil_ref_saved = ctx->stencil_ref; +} + + +void cso_restore_stencil_ref(struct cso_context *ctx) +{ + if (memcmp(&ctx->stencil_ref, &ctx->stencil_ref_saved, sizeof(ctx->stencil_ref))) { + ctx->stencil_ref = ctx->stencil_ref_saved; + ctx->pipe->set_stencil_ref(ctx->pipe, &ctx->stencil_ref); + } +} + enum pipe_error cso_set_geometry_shader_handle(struct cso_context *ctx, void *handle) { diff --git a/src/gallium/auxiliary/cso_cache/cso_context.h b/src/gallium/auxiliary/cso_cache/cso_context.h index 3a6fff2..707b3c2 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.h +++ b/src/gallium/auxiliary/cso_cache/cso_context.h @@ -176,6 +176,8 @@ enum pipe_error cso_set_blend_color(struct cso_context *cso, enum pipe_error cso_set_stencil_ref(struct cso_context *cso, const struct pipe_stencil_ref *sr); +void cso_save_stencil_ref(struct cso_context *cso); +void cso_restore_stencil_ref(struct cso_context *cso); #ifdef __cplusplus diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index 74ec8510..898c322 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -215,6 +215,7 @@ clear_with_quad(GLcontext *ctx, */ cso_save_blend(st->cso_context); + cso_save_stencil_ref(st->cso_context); cso_save_depth_stencil_alpha(st->cso_context); cso_save_rasterizer(st->cso_context); cso_save_fragment_shader(st->cso_context); @@ -280,6 +281,7 @@ clear_with_quad(GLcontext *ctx, /* Restore pipe state */ cso_restore_blend(st->cso_context); + cso_restore_stencil_ref(st->cso_context); cso_restore_depth_stencil_alpha(st->cso_context); cso_restore_rasterizer(st->cso_context); cso_restore_fragment_shader(st->cso_context); |