From b75adabc89e34083ac302ac9bafc8d80b62ac14c Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Thu, 11 Feb 2010 04:06:01 +0100 Subject: gallium: also save/restore stencil_ref in cso_save/restore_depth_stencil_alpha makes life of state trackers easier --- src/gallium/auxiliary/cso_cache/cso_context.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/gallium/auxiliary/cso_cache') diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c index 47867e888a4..e110f051af4 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.c +++ b/src/gallium/auxiliary/cso_cache/cso_context.c @@ -93,7 +93,7 @@ struct cso_context { struct pipe_framebuffer_state fb, fb_saved; struct pipe_viewport_state vp, vp_saved; struct pipe_blend_color blend_color; - struct pipe_stencil_ref stencil_ref; + struct pipe_stencil_ref stencil_ref, stencil_ref_saved; }; @@ -746,6 +746,7 @@ 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) @@ -755,6 +756,10 @@ 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); + } } @@ -1058,8 +1063,6 @@ void cso_restore_viewport(struct cso_context *ctx) } - - enum pipe_error cso_set_blend_color(struct cso_context *ctx, const struct pipe_blend_color *bc) { -- cgit v1.2.3