From bfe79babf99e6b9435195178d1ea64687c60d161 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Mon, 17 Dec 2007 16:14:29 +0000 Subject: gallium: incorporate alpha state into depth_stencil state object. --- src/mesa/pipe/cell/ppu/cell_context.c | 4 -- src/mesa/pipe/cell/ppu/cell_context.h | 3 +- src/mesa/pipe/cell/ppu/cell_state.h | 9 +-- src/mesa/pipe/cell/ppu/cell_state_blend.c | 40 ++---------- src/mesa/pipe/cso_cache/cso_cache.c | 13 +--- src/mesa/pipe/cso_cache/cso_cache.h | 14 ++-- src/mesa/pipe/failover/fo_context.h | 1 - src/mesa/pipe/failover/fo_state.c | 60 +++-------------- src/mesa/pipe/failover/fo_state_emit.c | 8 +-- src/mesa/pipe/i915simple/i915_context.h | 4 -- src/mesa/pipe/i915simple/i915_state.c | 86 +++++++++---------------- src/mesa/pipe/i915simple/i915_state_immediate.c | 6 +- src/mesa/pipe/i965simple/brw_cc.c | 49 +++++++------- src/mesa/pipe/i965simple/brw_context.h | 3 +- src/mesa/pipe/i965simple/brw_state.c | 42 ++---------- src/mesa/pipe/i965simple/brw_wm.c | 13 ++-- src/mesa/pipe/i965simple/brw_wm_state.c | 2 +- src/mesa/pipe/p_context.h | 13 ++-- src/mesa/pipe/p_state.h | 36 +++++------ src/mesa/pipe/softpipe/sp_context.c | 10 +-- src/mesa/pipe/softpipe/sp_context.h | 9 ++- src/mesa/pipe/softpipe/sp_quad.c | 8 +-- src/mesa/pipe/softpipe/sp_quad_alpha_test.c | 4 +- src/mesa/pipe/softpipe/sp_quad_stencil.c | 25 ++----- src/mesa/pipe/softpipe/sp_state.h | 9 +-- src/mesa/pipe/softpipe/sp_state_blend.c | 38 ++--------- src/mesa/pipe/softpipe/sp_state_derived.c | 8 +-- 27 files changed, 144 insertions(+), 373 deletions(-) (limited to 'src/mesa/pipe') diff --git a/src/mesa/pipe/cell/ppu/cell_context.c b/src/mesa/pipe/cell/ppu/cell_context.c index eff33da969..b448a8aa8c 100644 --- a/src/mesa/pipe/cell/ppu/cell_context.c +++ b/src/mesa/pipe/cell/ppu/cell_context.c @@ -176,10 +176,6 @@ cell_create_context(struct pipe_winsys *winsys, struct cell_winsys *cws) /* state setters */ - cell->pipe.create_alpha_test_state = cell_create_alpha_test_state; - cell->pipe.bind_alpha_test_state = cell_bind_alpha_test_state; - cell->pipe.delete_alpha_test_state = cell_delete_alpha_test_state; - cell->pipe.create_blend_state = cell_create_blend_state; cell->pipe.bind_blend_state = cell_bind_blend_state; cell->pipe.delete_blend_state = cell_delete_blend_state; diff --git a/src/mesa/pipe/cell/ppu/cell_context.h b/src/mesa/pipe/cell/ppu/cell_context.h index 96f000eef4..f8d6cc5d32 100644 --- a/src/mesa/pipe/cell/ppu/cell_context.h +++ b/src/mesa/pipe/cell/ppu/cell_context.h @@ -40,10 +40,9 @@ struct cell_context struct cell_winsys *winsys; - const struct pipe_alpha_test_state *alpha_test; const struct pipe_blend_state *blend; const struct pipe_sampler_state *sampler[PIPE_MAX_SAMPLERS]; - const struct pipe_depth_stencil_state *depth_stencil; + const struct pipe_depth_stencil_alpha_state *depth_stencil; const struct pipe_rasterizer_state *rasterizer; struct pipe_blend_color blend_color; diff --git a/src/mesa/pipe/cell/ppu/cell_state.h b/src/mesa/pipe/cell/ppu/cell_state.h index 4bad45950b..b01814202d 100644 --- a/src/mesa/pipe/cell/ppu/cell_state.h +++ b/src/mesa/pipe/cell/ppu/cell_state.h @@ -27,13 +27,6 @@ cell_set_framebuffer_state( struct pipe_context *, const struct pipe_framebuffer_state * ); -extern void * -cell_create_alpha_test_state(struct pipe_context *, - const struct pipe_alpha_test_state *); -extern void -cell_bind_alpha_test_state(struct pipe_context *, void *); -extern void -cell_delete_alpha_test_state(struct pipe_context *, void *); extern void * cell_create_blend_state(struct pipe_context *, const struct pipe_blend_state *); @@ -57,7 +50,7 @@ cell_delete_sampler_state(struct pipe_context *, void *); extern void * cell_create_depth_stencil_state(struct pipe_context *, - const struct pipe_depth_stencil_state *); + const struct pipe_depth_stencil_alpha_state *); extern void cell_bind_depth_stencil_state(struct pipe_context *, void *); diff --git a/src/mesa/pipe/cell/ppu/cell_state_blend.c b/src/mesa/pipe/cell/ppu/cell_state_blend.c index e807463d90..efcb9e38a4 100644 --- a/src/mesa/pipe/cell/ppu/cell_state_blend.c +++ b/src/mesa/pipe/cell/ppu/cell_state_blend.c @@ -69,44 +69,14 @@ void cell_set_blend_color( struct pipe_context *pipe, } -/** XXX move someday? Or consolidate all these simple state setters - * into one file. - */ - -void * -cell_create_alpha_test_state(struct pipe_context *pipe, - const struct pipe_alpha_test_state *alpha) -{ - struct pipe_alpha_test_state *state = MALLOC( sizeof(struct pipe_alpha_test_state) ); - memcpy(state, alpha, sizeof(struct pipe_alpha_test_state)); - return state; -} - -void -cell_bind_alpha_test_state(struct pipe_context *pipe, - void *alpha) -{ - struct cell_context *cell = cell_context(pipe); - - cell->alpha_test = (const struct pipe_alpha_test_state *)alpha; - - cell->dirty |= CELL_NEW_ALPHA_TEST; -} - -void -cell_delete_alpha_test_state(struct pipe_context *pipe, - void *alpha) -{ - FREE( alpha ); -} void * cell_create_depth_stencil_state(struct pipe_context *pipe, - const struct pipe_depth_stencil_state *depth_stencil) + const struct pipe_depth_stencil_alpha_state *depth_stencil) { - struct pipe_depth_stencil_state *state = - MALLOC( sizeof(struct pipe_depth_stencil_state) ); - memcpy(state, depth_stencil, sizeof(struct pipe_depth_stencil_state)); + struct pipe_depth_stencil_alpha_state *state = + MALLOC( sizeof(struct pipe_depth_stencil_alpha_state) ); + memcpy(state, depth_stencil, sizeof(struct pipe_depth_stencil_alpha_state)); return state; } @@ -116,7 +86,7 @@ cell_bind_depth_stencil_state(struct pipe_context *pipe, { struct cell_context *cell = cell_context(pipe); - cell->depth_stencil = (const struct pipe_depth_stencil_state *)depth_stencil; + cell->depth_stencil = (const struct pipe_depth_stencil_alpha_state *)depth_stencil; cell->dirty |= CELL_NEW_DEPTH_STENCIL; } diff --git a/src/mesa/pipe/cso_cache/cso_cache.c b/src/mesa/pipe/cso_cache/cso_cache.c index 0bba5914dc..9e77e0774d 100644 --- a/src/mesa/pipe/cso_cache/cso_cache.c +++ b/src/mesa/pipe/cso_cache/cso_cache.c @@ -78,7 +78,7 @@ static struct cso_hash *_cso_hash_for_type(struct cso_cache *sc, enum cso_cache_ case CSO_SAMPLER: hash = sc->sampler_hash; break; - case CSO_DEPTH_STENCIL: + case CSO_DEPTH_STENCIL_ALPHA: hash = sc->depth_stencil_hash; break; case CSO_RASTERIZER: @@ -90,9 +90,6 @@ static struct cso_hash *_cso_hash_for_type(struct cso_cache *sc, enum cso_cache_ case CSO_VERTEX_SHADER: hash = sc->vs_hash; break; - case CSO_ALPHA_TEST: - hash = sc->alpha_hash; - break; } return hash; @@ -105,16 +102,14 @@ static int _cso_size_for_type(enum cso_cache_type type) return sizeof(struct pipe_blend_state); case CSO_SAMPLER: return sizeof(struct pipe_sampler_state); - case CSO_DEPTH_STENCIL: - return sizeof(struct pipe_depth_stencil_state); + case CSO_DEPTH_STENCIL_ALPHA: + return sizeof(struct pipe_depth_stencil_alpha_state); case CSO_RASTERIZER: return sizeof(struct pipe_rasterizer_state); case CSO_FRAGMENT_SHADER: return sizeof(struct pipe_shader_state); case CSO_VERTEX_SHADER: return sizeof(struct pipe_shader_state); - case CSO_ALPHA_TEST: - return sizeof(struct pipe_alpha_test_state); } return 0; } @@ -169,7 +164,6 @@ struct cso_cache *cso_cache_create(void) sc->rasterizer_hash = cso_hash_create(); sc->fs_hash = cso_hash_create(); sc->vs_hash = cso_hash_create(); - sc->alpha_hash = cso_hash_create(); return sc; } @@ -183,6 +177,5 @@ void cso_cache_delete(struct cso_cache *sc) cso_hash_delete(sc->rasterizer_hash); cso_hash_delete(sc->fs_hash); cso_hash_delete(sc->vs_hash); - cso_hash_delete(sc->alpha_hash); free(sc); } diff --git a/src/mesa/pipe/cso_cache/cso_cache.h b/src/mesa/pipe/cso_cache/cso_cache.h index cd36dd51e9..116e2eaa2c 100644 --- a/src/mesa/pipe/cso_cache/cso_cache.h +++ b/src/mesa/pipe/cso_cache/cso_cache.h @@ -40,7 +40,6 @@ struct cso_hash; struct cso_cache { - struct cso_hash *alpha_hash; struct cso_hash *blend_hash; struct cso_hash *depth_stencil_hash; struct cso_hash *fs_hash; @@ -54,8 +53,8 @@ struct cso_blend { void *data; }; -struct cso_depth_stencil { - struct pipe_depth_stencil_state state; +struct cso_depth_stencil_alpha { + struct pipe_depth_stencil_alpha_state state; void *data; }; @@ -79,19 +78,14 @@ struct cso_sampler { void *data; }; -struct cso_alpha_test { - struct pipe_alpha_test_state state; - void *data; -}; enum cso_cache_type { CSO_BLEND, CSO_SAMPLER, - CSO_DEPTH_STENCIL, + CSO_DEPTH_STENCIL_ALPHA, CSO_RASTERIZER, CSO_FRAGMENT_SHADER, - CSO_VERTEX_SHADER, - CSO_ALPHA_TEST + CSO_VERTEX_SHADER }; unsigned cso_construct_key(void *item, int item_size); diff --git a/src/mesa/pipe/failover/fo_context.h b/src/mesa/pipe/failover/fo_context.h index f5eaa0b5fa..1dc87291c9 100644 --- a/src/mesa/pipe/failover/fo_context.h +++ b/src/mesa/pipe/failover/fo_context.h @@ -70,7 +70,6 @@ struct failover_context { /* The most recent drawing state as set by the driver: */ - const struct fo_state *alpha_test; const struct fo_state *blend; const struct fo_state *sampler[PIPE_MAX_SAMPLERS]; const struct fo_state *depth_stencil; diff --git a/src/mesa/pipe/failover/fo_state.c b/src/mesa/pipe/failover/fo_state.c index 6b4f1517ac..fa700b9674 100644 --- a/src/mesa/pipe/failover/fo_state.c +++ b/src/mesa/pipe/failover/fo_state.c @@ -45,45 +45,6 @@ * lower overheads. */ -static void * -failover_create_alpha_test_state(struct pipe_context *pipe, - const struct pipe_alpha_test_state *templ) -{ - struct fo_state *state = malloc(sizeof(struct fo_state)); - struct failover_context *failover = failover_context(pipe); - - state->sw_state = failover->sw->create_alpha_test_state(pipe, templ); - state->hw_state = failover->hw->create_alpha_test_state(pipe, templ); - - return state; -} - -static void -failover_bind_alpha_test_state(struct pipe_context *pipe, - void *alpha) -{ - struct failover_context *failover = failover_context(pipe); - struct fo_state *state = (struct fo_state *)alpha; - - failover->alpha_test = state; - failover->dirty |= FO_NEW_ALPHA_TEST; - failover->hw->bind_alpha_test_state(failover->hw, - state->hw_state); -} - -static void -failover_delete_alpha_test_state(struct pipe_context *pipe, - void *alpha) -{ - struct fo_state *state = (struct fo_state*)alpha; - struct failover_context *failover = failover_context(pipe); - - failover->sw->delete_alpha_test_state(pipe, state->sw_state); - failover->hw->delete_alpha_test_state(pipe, state->hw_state); - state->sw_state = 0; - state->hw_state = 0; - free(state); -} static void * @@ -149,13 +110,13 @@ failover_set_clip_state( struct pipe_context *pipe, static void * failover_create_depth_stencil_state(struct pipe_context *pipe, - const struct pipe_depth_stencil_state *templ) + const struct pipe_depth_stencil_alpha_state *templ) { struct fo_state *state = malloc(sizeof(struct fo_state)); struct failover_context *failover = failover_context(pipe); - state->sw_state = failover->sw->create_depth_stencil_state(pipe, templ); - state->hw_state = failover->hw->create_depth_stencil_state(pipe, templ); + state->sw_state = failover->sw->create_depth_stencil_alpha_state(pipe, templ); + state->hw_state = failover->hw->create_depth_stencil_alpha_state(pipe, templ); return state; } @@ -168,7 +129,7 @@ failover_bind_depth_stencil_state(struct pipe_context *pipe, struct fo_state *state = (struct fo_state *)depth_stencil; failover->depth_stencil = state; failover->dirty |= FO_NEW_DEPTH_STENCIL; - failover->hw->bind_depth_stencil_state(failover->hw, state->hw_state); + failover->hw->bind_depth_stencil_alpha_state(failover->hw, state->hw_state); } static void @@ -178,8 +139,8 @@ failover_delete_depth_stencil_state(struct pipe_context *pipe, struct fo_state *state = (struct fo_state*)ds; struct failover_context *failover = failover_context(pipe); - failover->sw->delete_depth_stencil_state(pipe, state->sw_state); - failover->hw->delete_depth_stencil_state(pipe, state->hw_state); + failover->sw->delete_depth_stencil_alpha_state(pipe, state->sw_state); + failover->hw->delete_depth_stencil_alpha_state(pipe, state->hw_state); state->sw_state = 0; state->hw_state = 0; free(state); @@ -434,18 +395,15 @@ failover_set_vertex_element(struct pipe_context *pipe, void failover_init_state_functions( struct failover_context *failover ) { - failover->pipe.create_alpha_test_state = failover_create_alpha_test_state; - failover->pipe.bind_alpha_test_state = failover_bind_alpha_test_state; - failover->pipe.delete_alpha_test_state = failover_delete_alpha_test_state; failover->pipe.create_blend_state = failover_create_blend_state; failover->pipe.bind_blend_state = failover_bind_blend_state; failover->pipe.delete_blend_state = failover_delete_blend_state; failover->pipe.create_sampler_state = failover_create_sampler_state; failover->pipe.bind_sampler_state = failover_bind_sampler_state; failover->pipe.delete_sampler_state = failover_delete_sampler_state; - failover->pipe.create_depth_stencil_state = failover_create_depth_stencil_state; - failover->pipe.bind_depth_stencil_state = failover_bind_depth_stencil_state; - failover->pipe.delete_depth_stencil_state = failover_delete_depth_stencil_state; + failover->pipe.create_depth_stencil_alpha_state = failover_create_depth_stencil_state; + failover->pipe.bind_depth_stencil_alpha_state = failover_bind_depth_stencil_state; + failover->pipe.delete_depth_stencil_alpha_state = failover_delete_depth_stencil_state; failover->pipe.create_rasterizer_state = failover_create_rasterizer_state; failover->pipe.bind_rasterizer_state = failover_bind_rasterizer_state; failover->pipe.delete_rasterizer_state = failover_delete_rasterizer_state; diff --git a/src/mesa/pipe/failover/fo_state_emit.c b/src/mesa/pipe/failover/fo_state_emit.c index c99ecd4f8d..c663dd4947 100644 --- a/src/mesa/pipe/failover/fo_state_emit.c +++ b/src/mesa/pipe/failover/fo_state_emit.c @@ -55,10 +55,6 @@ failover_state_emit( struct failover_context *failover ) { unsigned i; - if (failover->dirty & FO_NEW_ALPHA_TEST) - failover->sw->bind_alpha_test_state( failover->sw, - failover->alpha_test->sw_state ); - if (failover->dirty & FO_NEW_BLEND) failover->sw->bind_blend_state( failover->sw, failover->blend->sw_state ); @@ -70,8 +66,8 @@ failover_state_emit( struct failover_context *failover ) failover->sw->set_clip_state( failover->sw, &failover->clip ); if (failover->dirty & FO_NEW_DEPTH_STENCIL) - failover->sw->bind_depth_stencil_state( failover->sw, - failover->depth_stencil->sw_state ); + failover->sw->bind_depth_stencil_alpha_state( failover->sw, + failover->depth_stencil->sw_state ); if (failover->dirty & FO_NEW_FRAMEBUFFER) failover->sw->set_framebuffer_state( failover->sw, &failover->framebuffer ); diff --git a/src/mesa/pipe/i915simple/i915_context.h b/src/mesa/pipe/i915simple/i915_context.h index 80df7f0fba..2f1f036993 100644 --- a/src/mesa/pipe/i915simple/i915_context.h +++ b/src/mesa/pipe/i915simple/i915_context.h @@ -146,9 +146,6 @@ struct i915_sampler_state { const struct pipe_sampler_state *templ; }; -struct i915_alpha_test_state { - unsigned LIS6; -}; struct i915_texture { struct pipe_texture base; @@ -186,7 +183,6 @@ struct i915_context /* The most recent drawing state as set by the driver: */ - const struct i915_alpha_test_state *alpha_test; const struct i915_blend_state *blend; const struct i915_sampler_state *sampler[PIPE_MAX_SAMPLERS]; const struct i915_depth_stencil_state *depth_stencil; diff --git a/src/mesa/pipe/i915simple/i915_state.c b/src/mesa/pipe/i915simple/i915_state.c index 2a9a587a37..f8332aab37 100644 --- a/src/mesa/pipe/i915simple/i915_state.c +++ b/src/mesa/pipe/i915simple/i915_state.c @@ -284,13 +284,13 @@ static void i915_delete_sampler_state(struct pipe_context *pipe, static void * i915_create_depth_stencil_state(struct pipe_context *pipe, - const struct pipe_depth_stencil_state *depth_stencil) + const struct pipe_depth_stencil_alpha_state *depth_stencil) { struct i915_depth_stencil_state *cso = CALLOC_STRUCT( i915_depth_stencil_state ); { - int testmask = depth_stencil->stencil.value_mask[0] & 0xff; - int writemask = depth_stencil->stencil.write_mask[0] & 0xff; + int testmask = depth_stencil->stencil[0].value_mask & 0xff; + int writemask = depth_stencil->stencil[0].write_mask & 0xff; cso->stencil_modes4 |= (_3DSTATE_MODES_4_CMD | ENABLE_STENCIL_TEST_MASK | @@ -299,12 +299,12 @@ i915_create_depth_stencil_state(struct pipe_context *pipe, STENCIL_WRITE_MASK(writemask)); } - if (depth_stencil->stencil.front_enabled) { - int test = i915_translate_compare_func(depth_stencil->stencil.front_func); - int fop = i915_translate_stencil_op(depth_stencil->stencil.front_fail_op); - int dfop = i915_translate_stencil_op(depth_stencil->stencil.front_zfail_op); - int dpop = i915_translate_stencil_op(depth_stencil->stencil.front_zpass_op); - int ref = depth_stencil->stencil.ref_value[0] & 0xff; + if (depth_stencil->stencil[0].enabled) { + int test = i915_translate_compare_func(depth_stencil->stencil[0].func); + int fop = i915_translate_stencil_op(depth_stencil->stencil[0].fail_op); + int dfop = i915_translate_stencil_op(depth_stencil->stencil[0].zfail_op); + int dpop = i915_translate_stencil_op(depth_stencil->stencil[0].zpass_op); + int ref = depth_stencil->stencil[0].ref_value & 0xff; cso->stencil_LIS5 |= (S5_STENCIL_TEST_ENABLE | S5_STENCIL_WRITE_ENABLE | @@ -315,14 +315,14 @@ i915_create_depth_stencil_state(struct pipe_context *pipe, (dpop << S5_STENCIL_PASS_Z_PASS_SHIFT)); } - if (depth_stencil->stencil.back_enabled) { - int test = i915_translate_compare_func(depth_stencil->stencil.back_func); - int fop = i915_translate_stencil_op(depth_stencil->stencil.back_fail_op); - int dfop = i915_translate_stencil_op(depth_stencil->stencil.back_zfail_op); - int dpop = i915_translate_stencil_op(depth_stencil->stencil.back_zpass_op); - int ref = depth_stencil->stencil.ref_value[1] & 0xff; - int tmask = depth_stencil->stencil.value_mask[1] & 0xff; - int wmask = depth_stencil->stencil.write_mask[1] & 0xff; + if (depth_stencil->stencil[1].enabled) { + int test = i915_translate_compare_func(depth_stencil->stencil[1].func); + int fop = i915_translate_stencil_op(depth_stencil->stencil[1].fail_op); + int dfop = i915_translate_stencil_op(depth_stencil->stencil[1].zfail_op); + int dpop = i915_translate_stencil_op(depth_stencil->stencil[1].zpass_op); + int ref = depth_stencil->stencil[1].ref_value & 0xff; + int tmask = depth_stencil->stencil[1].value_mask & 0xff; + int wmask = depth_stencil->stencil[1].write_mask & 0xff; cso->bfo[0] = (_3DSTATE_BACKFACE_STENCIL_OPS | BFO_ENABLE_STENCIL_FUNCS | @@ -363,6 +363,15 @@ i915_create_depth_stencil_state(struct pipe_context *pipe, cso->depth_LIS6 |= S6_DEPTH_WRITE_ENABLE; } + if (depth_stencil->alpha.enabled) { + int test = i915_translate_compare_func(depth_stencil->alpha.func); + ubyte refByte = float_to_ubyte(depth_stencil->alpha.ref); + + cso->depth_LIS6 |= (S6_ALPHA_TEST_ENABLE | + (test << S6_ALPHA_TEST_FUNC_SHIFT) | + (((unsigned) refByte) << S6_ALPHA_REF_SHIFT)); + } + return cso; } @@ -383,39 +392,6 @@ static void i915_delete_depth_stencil_state(struct pipe_context *pipe, } -static void * -i915_create_alpha_test_state(struct pipe_context *pipe, - const struct pipe_alpha_test_state *alpha_test) -{ - struct i915_alpha_test_state *cso = CALLOC_STRUCT( i915_alpha_test_state ); - - if (alpha_test->enabled) { - int test = i915_translate_compare_func(alpha_test->func); - ubyte refByte = float_to_ubyte(alpha_test->ref); - - cso->LIS6 |= (S6_ALPHA_TEST_ENABLE | - (test << S6_ALPHA_TEST_FUNC_SHIFT) | - (((unsigned) refByte) << S6_ALPHA_REF_SHIFT)); - } - return cso; -} - -static void i915_bind_alpha_test_state(struct pipe_context *pipe, - void *alpha) -{ - struct i915_context *i915 = i915_context(pipe); - - i915->alpha_test = (const struct i915_alpha_test_state*)alpha; - - i915->dirty |= I915_NEW_ALPHA_TEST; -} - -static void i915_delete_alpha_test_state(struct pipe_context *pipe, - void *alpha) -{ - FREE(alpha); -} - static void i915_set_scissor_state( struct pipe_context *pipe, const struct pipe_scissor_state *scissor ) { @@ -674,10 +650,6 @@ static void i915_set_vertex_element( struct pipe_context *pipe, void i915_init_state_functions( struct i915_context *i915 ) { - i915->pipe.create_alpha_test_state = i915_create_alpha_test_state; - i915->pipe.bind_alpha_test_state = i915_bind_alpha_test_state; - i915->pipe.delete_alpha_test_state = i915_delete_alpha_test_state; - i915->pipe.create_blend_state = i915_create_blend_state; i915->pipe.bind_blend_state = i915_bind_blend_state; i915->pipe.delete_blend_state = i915_delete_blend_state; @@ -686,9 +658,9 @@ i915_init_state_functions( struct i915_context *i915 ) i915->pipe.bind_sampler_state = i915_bind_sampler_state; i915->pipe.delete_sampler_state = i915_delete_sampler_state; - i915->pipe.create_depth_stencil_state = i915_create_depth_stencil_state; - i915->pipe.bind_depth_stencil_state = i915_bind_depth_stencil_state; - i915->pipe.delete_depth_stencil_state = i915_delete_depth_stencil_state; + i915->pipe.create_depth_stencil_alpha_state = i915_create_depth_stencil_state; + i915->pipe.bind_depth_stencil_alpha_state = i915_bind_depth_stencil_state; + i915->pipe.delete_depth_stencil_alpha_state = i915_delete_depth_stencil_state; i915->pipe.create_rasterizer_state = i915_create_rasterizer_state; i915->pipe.bind_rasterizer_state = i915_bind_rasterizer_state; diff --git a/src/mesa/pipe/i915simple/i915_state_immediate.c b/src/mesa/pipe/i915simple/i915_state_immediate.c index da2402c018..752d25f233 100644 --- a/src/mesa/pipe/i915simple/i915_state_immediate.c +++ b/src/mesa/pipe/i915simple/i915_state_immediate.c @@ -159,10 +159,6 @@ static void upload_S6( struct i915_context *i915 ) unsigned LIS6 = (S6_COLOR_WRITE_ENABLE | (2 << S6_TRISTRIP_PV_SHIFT)); - /* I915_NEW_ALPHA_TEST - */ - LIS6 |= i915->alpha_test->LIS6; - /* I915_NEW_BLEND */ LIS6 |= i915->blend->LIS6; @@ -178,7 +174,7 @@ static void upload_S6( struct i915_context *i915 ) } const struct i915_tracked_state i915_upload_S6 = { - I915_NEW_ALPHA_TEST | I915_NEW_BLEND | I915_NEW_DEPTH_STENCIL, + I915_NEW_BLEND | I915_NEW_DEPTH_STENCIL, upload_S6 }; diff --git a/src/mesa/pipe/i965simple/brw_cc.c b/src/mesa/pipe/i965simple/brw_cc.c index 6cc1505311..dcee731895 100644 --- a/src/mesa/pipe/i965simple/brw_cc.c +++ b/src/mesa/pipe/i965simple/brw_cc.c @@ -156,38 +156,37 @@ static void upload_cc_unit( struct brw_context *brw ) memset(&cc, 0, sizeof(cc)); /* BRW_NEW_DEPTH_STENCIL */ - if (brw->attribs.DepthStencil->stencil.front_enabled) { - cc.cc0.stencil_enable = brw->attribs.DepthStencil->stencil.front_enabled; - cc.cc0.stencil_func = brw_translate_compare_func(brw->attribs.DepthStencil->stencil.front_func); - cc.cc0.stencil_fail_op = brw_translate_stencil_op(brw->attribs.DepthStencil->stencil.front_fail_op); + if (brw->attribs.DepthStencil->stencil[0].enabled) { + cc.cc0.stencil_enable = brw->attribs.DepthStencil->stencil[0].enabled; + cc.cc0.stencil_func = brw_translate_compare_func(brw->attribs.DepthStencil->stencil[0].func); + cc.cc0.stencil_fail_op = brw_translate_stencil_op(brw->attribs.DepthStencil->stencil[0].fail_op); cc.cc0.stencil_pass_depth_fail_op = brw_translate_stencil_op( - brw->attribs.DepthStencil->stencil.front_zfail_op); + brw->attribs.DepthStencil->stencil[0].zfail_op); cc.cc0.stencil_pass_depth_pass_op = brw_translate_stencil_op( - brw->attribs.DepthStencil->stencil.front_zpass_op); - cc.cc1.stencil_ref = brw->attribs.DepthStencil->stencil.ref_value[0]; - cc.cc1.stencil_write_mask = brw->attribs.DepthStencil->stencil.write_mask[0]; - cc.cc1.stencil_test_mask = brw->attribs.DepthStencil->stencil.value_mask[0]; + brw->attribs.DepthStencil->stencil[0].zpass_op); + cc.cc1.stencil_ref = brw->attribs.DepthStencil->stencil[0].ref_value; + cc.cc1.stencil_write_mask = brw->attribs.DepthStencil->stencil[0].write_mask; + cc.cc1.stencil_test_mask = brw->attribs.DepthStencil->stencil[0].value_mask; - if (brw->attribs.DepthStencil->stencil.back_enabled) { - cc.cc0.bf_stencil_enable = brw->attribs.DepthStencil->stencil.back_enabled; + if (brw->attribs.DepthStencil->stencil[1].enabled) { + cc.cc0.bf_stencil_enable = brw->attribs.DepthStencil->stencil[1].enabled; cc.cc0.bf_stencil_func = brw_translate_compare_func( - brw->attribs.DepthStencil->stencil.back_func); + brw->attribs.DepthStencil->stencil[1].func); cc.cc0.bf_stencil_fail_op = brw_translate_stencil_op( - brw->attribs.DepthStencil->stencil.back_fail_op); + brw->attribs.DepthStencil->stencil[1].fail_op); cc.cc0.bf_stencil_pass_depth_fail_op = brw_translate_stencil_op( - brw->attribs.DepthStencil->stencil.back_zfail_op); + brw->attribs.DepthStencil->stencil[1].zfail_op); cc.cc0.bf_stencil_pass_depth_pass_op = brw_translate_stencil_op( - brw->attribs.DepthStencil->stencil.back_zpass_op); - cc.cc1.bf_stencil_ref = brw->attribs.DepthStencil->stencil.ref_value[1]; - cc.cc2.bf_stencil_write_mask = brw->attribs.DepthStencil->stencil.write_mask[1]; - cc.cc2.bf_stencil_test_mask = brw->attribs.DepthStencil->stencil.value_mask[1]; + brw->attribs.DepthStencil->stencil[1].zpass_op); + cc.cc1.bf_stencil_ref = brw->attribs.DepthStencil->stencil[1].ref_value; + cc.cc2.bf_stencil_write_mask = brw->attribs.DepthStencil->stencil[1].write_mask; + cc.cc2.bf_stencil_test_mask = brw->attribs.DepthStencil->stencil[1].value_mask; } /* Not really sure about this: */ - if (brw->attribs.DepthStencil->stencil.write_mask[0] || - (brw->attribs.DepthStencil->stencil.back_enabled && - brw->attribs.DepthStencil->stencil.write_mask[1])) + if (brw->attribs.DepthStencil->stencil[0].write_mask || + brw->attribs.DepthStencil->stencil[1].write_mask) cc.cc0.stencil_write_enable = 1; } @@ -228,11 +227,13 @@ static void upload_cc_unit( struct brw_context *brw ) /* BRW_NEW_ALPHATEST */ - if (brw->attribs.AlphaTest->enabled) { + if (brw->attribs.DepthStencil->alpha.enabled) { cc.cc3.alpha_test = 1; - cc.cc3.alpha_test_func = brw_translate_compare_func(brw->attribs.AlphaTest->func); + cc.cc3.alpha_test_func = + brw_translate_compare_func(brw->attribs.DepthStencil->alpha.func); - UNCLAMPED_FLOAT_TO_UBYTE(cc.cc7.alpha_ref.ub[0], brw->attribs.AlphaTest->ref); + UNCLAMPED_FLOAT_TO_UBYTE(cc.cc7.alpha_ref.ub[0], + brw->attribs.DepthStencil->alpha.ref); cc.cc3.alpha_test_format = BRW_ALPHATEST_FORMAT_UNORM8; } diff --git a/src/mesa/pipe/i965simple/brw_context.h b/src/mesa/pipe/i965simple/brw_context.h index 318c6a7049..11146570be 100644 --- a/src/mesa/pipe/i965simple/brw_context.h +++ b/src/mesa/pipe/i965simple/brw_context.h @@ -479,9 +479,8 @@ struct brw_context struct { - const struct pipe_alpha_test_state *AlphaTest; const struct pipe_blend_state *Blend; - const struct pipe_depth_stencil_state *DepthStencil; + const struct pipe_depth_stencil_alpha_state *DepthStencil; const struct pipe_poly_stipple *PolygonStipple; const struct pipe_rasterizer_state *Raster; const struct pipe_sampler_state *Samplers[PIPE_MAX_SAMPLERS]; diff --git a/src/mesa/pipe/i965simple/brw_state.c b/src/mesa/pipe/i965simple/brw_state.c index 26450ae597..e7f5a27a38 100644 --- a/src/mesa/pipe/i965simple/brw_state.c +++ b/src/mesa/pipe/i965simple/brw_state.c @@ -116,9 +116,9 @@ static void brw_delete_sampler_state(struct pipe_context *pipe, static void * brw_create_depth_stencil_state(struct pipe_context *pipe, - const struct pipe_depth_stencil_state *depth_stencil) + const struct pipe_depth_stencil_alpha_state *depth_stencil) { - DUP( pipe_depth_stencil_state, depth_stencil ); + DUP( pipe_depth_stencil_alpha_state, depth_stencil ); } static void brw_bind_depth_stencil_state(struct pipe_context *pipe, @@ -126,7 +126,7 @@ static void brw_bind_depth_stencil_state(struct pipe_context *pipe, { struct brw_context *brw = brw_context(pipe); - brw->attribs.DepthStencil = (const struct pipe_depth_stencil_state *)depth_stencil; + brw->attribs.DepthStencil = (const struct pipe_depth_stencil_alpha_state *)depth_stencil; brw->state.dirty.brw |= BRW_NEW_DEPTH_STENCIL; } @@ -137,32 +137,6 @@ static void brw_delete_depth_stencil_state(struct pipe_context *pipe, free(depth_stencil); } -/************************************************************************ - * Alpha test - */ -static void * -brw_create_alpha_test_state(struct pipe_context *pipe, - const struct pipe_alpha_test_state *alpha_test) -{ - DUP(pipe_alpha_test_state, alpha_test); -} - -static void brw_bind_alpha_test_state(struct pipe_context *pipe, - void *alpha) -{ - struct brw_context *brw = brw_context(pipe); - - brw->attribs.AlphaTest = (const struct pipe_alpha_test_state*)alpha; - - brw->state.dirty.brw |= BRW_NEW_ALPHA_TEST; -} - -static void brw_delete_alpha_test_state(struct pipe_context *pipe, - void *alpha) -{ - free(alpha); -} - /************************************************************************ * Scissor */ @@ -415,10 +389,6 @@ static void brw_delete_rasterizer_state(struct pipe_context *pipe, void brw_init_state_functions( struct brw_context *brw ) { - brw->pipe.create_alpha_test_state = brw_create_alpha_test_state; - brw->pipe.bind_alpha_test_state = brw_bind_alpha_test_state; - brw->pipe.delete_alpha_test_state = brw_delete_alpha_test_state; - brw->pipe.create_blend_state = brw_create_blend_state; brw->pipe.bind_blend_state = brw_bind_blend_state; brw->pipe.delete_blend_state = brw_delete_blend_state; @@ -427,9 +397,9 @@ brw_init_state_functions( struct brw_context *brw ) brw->pipe.bind_sampler_state = brw_bind_sampler_state; brw->pipe.delete_sampler_state = brw_delete_sampler_state; - brw->pipe.create_depth_stencil_state = brw_create_depth_stencil_state; - brw->pipe.bind_depth_stencil_state = brw_bind_depth_stencil_state; - brw->pipe.delete_depth_stencil_state = brw_delete_depth_stencil_state; + brw->pipe.create_depth_stencil_alpha_state = brw_create_depth_stencil_state; + brw->pipe.bind_depth_stencil_alpha_state = brw_bind_depth_stencil_state; + brw->pipe.delete_depth_stencil_alpha_state = brw_delete_depth_stencil_state; brw->pipe.create_rasterizer_state = brw_create_rasterizer_state; brw->pipe.bind_rasterizer_state = brw_bind_rasterizer_state; diff --git a/src/mesa/pipe/i965simple/brw_wm.c b/src/mesa/pipe/i965simple/brw_wm.c index f0a38d384b..0ee0fbed51 100644 --- a/src/mesa/pipe/i965simple/brw_wm.c +++ b/src/mesa/pipe/i965simple/brw_wm.c @@ -93,15 +93,14 @@ static void brw_wm_populate_key( struct brw_context *brw, /* Build the index for table lookup */ - /* _NEW_COLOR */ + /* BRW_NEW_DEPTH_STENCIL */ if (fp->UsesKill || - brw->attribs.AlphaTest->enabled) + brw->attribs.DepthStencil->alpha.enabled) lookup |= IZ_PS_KILL_ALPHATEST_BIT; if (fp->ComputesDepth) lookup |= IZ_PS_COMPUTES_DEPTH_BIT; - /* _NEW_DEPTH */ if (brw->attribs.DepthStencil->depth.enabled) lookup |= IZ_DEPTH_TEST_ENABLE_BIT; @@ -109,13 +108,11 @@ static void brw_wm_populate_key( struct brw_context *brw, brw->attribs.DepthStencil->depth.writemask) /* ?? */ lookup |= IZ_DEPTH_WRITE_ENABLE_BIT; - /* _NEW_STENCIL */ - if (brw->attribs.DepthStencil->stencil.front_enabled) { + if (brw->attribs.DepthStencil->stencil[0].enabled) { lookup |= IZ_STENCIL_TEST_ENABLE_BIT; - if (brw->attribs.DepthStencil->stencil.write_mask[0] || - (brw->attribs.DepthStencil->stencil.back_enabled && - brw->attribs.DepthStencil->stencil.write_mask[1])) + if (brw->attribs.DepthStencil->stencil[0].write_mask || + brw->attribs.DepthStencil->stencil[1].write_mask) lookup |= IZ_STENCIL_WRITE_ENABLE_BIT; } diff --git a/src/mesa/pipe/i965simple/brw_wm_state.c b/src/mesa/pipe/i965simple/brw_wm_state.c index 52d2c85423..5ccd488842 100644 --- a/src/mesa/pipe/i965simple/brw_wm_state.c +++ b/src/mesa/pipe/i965simple/brw_wm_state.c @@ -122,7 +122,7 @@ static void upload_wm_unit(struct brw_context *brw ) /* BRW_NEW_ALPHA_TEST */ if (fp->UsesKill || - brw->attribs.AlphaTest->enabled) + brw->attribs.DepthStencil->alpha.enabled) wm.wm5.program_uses_killpixel = 1; wm.wm5.enable_8_pix = 1; diff --git a/src/mesa/pipe/p_context.h b/src/mesa/pipe/p_context.h index 92ca7dd8e3..1afb38a868 100644 --- a/src/mesa/pipe/p_context.h +++ b/src/mesa/pipe/p_context.h @@ -102,11 +102,6 @@ struct pipe_context { /* * State functions */ - void * (*create_alpha_test_state)(struct pipe_context *, - const struct pipe_alpha_test_state *); - void (*bind_alpha_test_state)(struct pipe_context *, void *); - void (*delete_alpha_test_state)(struct pipe_context *, void *); - void * (*create_blend_state)(struct pipe_context *, const struct pipe_blend_state *); void (*bind_blend_state)(struct pipe_context *, void *); @@ -122,10 +117,10 @@ struct pipe_context { void (*bind_rasterizer_state)(struct pipe_context *, void *); void (*delete_rasterizer_state)(struct pipe_context *, void *); - void * (*create_depth_stencil_state)(struct pipe_context *, - const struct pipe_depth_stencil_state *); - void (*bind_depth_stencil_state)(struct pipe_context *, void *); - void (*delete_depth_stencil_state)(struct pipe_context *, void *); + void * (*create_depth_stencil_alpha_state)(struct pipe_context *, + const struct pipe_depth_stencil_alpha_state *); + void (*bind_depth_stencil_alpha_state)(struct pipe_context *, void *); + void (*delete_depth_stencil_alpha_state)(struct pipe_context *, void *); void * (*create_fs_state)(struct pipe_context *, const struct pipe_shader_state *); diff --git a/src/mesa/pipe/p_state.h b/src/mesa/pipe/p_state.h index af65d365bf..b7793c6d31 100644 --- a/src/mesa/pipe/p_state.h +++ b/src/mesa/pipe/p_state.h @@ -147,7 +147,7 @@ struct pipe_shader_state { ubyte output_semantic_index[PIPE_MAX_SHADER_OUTPUTS]; }; -struct pipe_depth_stencil_state +struct pipe_depth_stencil_alpha_state { struct { unsigned enabled:1; /**< depth test enabled? */ @@ -156,28 +156,24 @@ struct pipe_depth_stencil_state unsigned occlusion_count:1; /**< XXX move this elsewhere? */ } depth; struct { - unsigned front_enabled:1; - unsigned front_func:3; /**< PIPE_FUNC_x */ - unsigned front_fail_op:3; /**< PIPE_STENCIL_OP_x */ - unsigned front_zpass_op:3; /**< PIPE_STENCIL_OP_x */ - unsigned front_zfail_op:3; /**< PIPE_STENCIL_OP_x */ - unsigned back_enabled:1; - unsigned back_func:3; /**< PIPE_FUNC_x */ - unsigned back_fail_op:3; /**< PIPE_STENCIL_OP_x */ - unsigned back_zpass_op:3; /**< PIPE_STENCIL_OP_x */ - unsigned back_zfail_op:3; /**< PIPE_STENCIL_OP_x */ - ubyte ref_value[2]; /**< [0] = front, [1] = back */ - ubyte value_mask[2]; - ubyte write_mask[2]; - } stencil; -}; + unsigned enabled:1; + unsigned func:3; /**< PIPE_FUNC_x */ + unsigned fail_op:3; /**< PIPE_STENCIL_OP_x */ + unsigned zpass_op:3; /**< PIPE_STENCIL_OP_x */ + unsigned zfail_op:3; /**< PIPE_STENCIL_OP_x */ + ubyte ref_value; + ubyte value_mask; + ubyte write_mask; + } stencil[2]; /**< [0] = front, [1] = back */ -struct pipe_alpha_test_state { - unsigned enabled:1; - unsigned func:3; /**< PIPE_FUNC_x */ - float ref; /**< reference value */ + struct { + unsigned enabled:1; + unsigned func:3; /**< PIPE_FUNC_x */ + float ref; /**< reference value */ + } alpha; }; + struct pipe_blend_state { unsigned blend_enable:1; diff --git a/src/mesa/pipe/softpipe/sp_context.c b/src/mesa/pipe/softpipe/sp_context.c index b62e691e87..b6995b8a6c 100644 --- a/src/mesa/pipe/softpipe/sp_context.c +++ b/src/mesa/pipe/softpipe/sp_context.c @@ -240,10 +240,6 @@ struct pipe_context *softpipe_create( struct pipe_winsys *pipe_winsys, softpipe->pipe.get_paramf = softpipe_get_paramf; /* state setters */ - softpipe->pipe.create_alpha_test_state = softpipe_create_alpha_test_state; - softpipe->pipe.bind_alpha_test_state = softpipe_bind_alpha_test_state; - softpipe->pipe.delete_alpha_test_state = softpipe_delete_alpha_test_state; - softpipe->pipe.create_blend_state = softpipe_create_blend_state; softpipe->pipe.bind_blend_state = softpipe_bind_blend_state; softpipe->pipe.delete_blend_state = softpipe_delete_blend_state; @@ -252,9 +248,9 @@ struct pipe_context *softpipe_create( struct pipe_winsys *pipe_winsys, softpipe->pipe.bind_sampler_state = softpipe_bind_sampler_state; softpipe->pipe.delete_sampler_state = softpipe_delete_sampler_state; - softpipe->pipe.create_depth_stencil_state = softpipe_create_depth_stencil_state; - softpipe->pipe.bind_depth_stencil_state = softpipe_bind_depth_stencil_state; - softpipe->pipe.delete_depth_stencil_state = softpipe_delete_depth_stencil_state; + softpipe->pipe.create_depth_stencil_alpha_state = softpipe_create_depth_stencil_state; + softpipe->pipe.bind_depth_stencil_alpha_state = softpipe_bind_depth_stencil_state; + softpipe->pipe.delete_depth_stencil_alpha_state = softpipe_delete_depth_stencil_state; softpipe->pipe.create_rasterizer_state = softpipe_create_rasterizer_state; softpipe->pipe.bind_rasterizer_state = softpipe_bind_rasterizer_state; diff --git a/src/mesa/pipe/softpipe/sp_context.h b/src/mesa/pipe/softpipe/sp_context.h index 8fd44933f2..8f14dd11d1 100644 --- a/src/mesa/pipe/softpipe/sp_context.h +++ b/src/mesa/pipe/softpipe/sp_context.h @@ -53,13 +53,13 @@ struct softpipe_tile_cache; #define SP_NEW_SCISSOR 0x20 #define SP_NEW_STIPPLE 0x40 #define SP_NEW_FRAMEBUFFER 0x80 -#define SP_NEW_ALPHA_TEST 0x100 -#define SP_NEW_DEPTH_STENCIL 0x200 +#define SP_NEW_DEPTH_STENCIL_ALPHA 0x100 +#define SP_NEW_CONSTANTS 0x200 #define SP_NEW_SAMPLER 0x400 #define SP_NEW_TEXTURE 0x800 #define SP_NEW_VERTEX 0x1000 #define SP_NEW_VS 0x2000 -#define SP_NEW_CONSTANTS 0x4000 +#define SP_NEW_QUERY 0x4000 struct sp_vertex_shader_state { struct pipe_shader_state *state; @@ -73,10 +73,9 @@ struct softpipe_context { /* The most recent drawing state as set by the driver: */ - const struct pipe_alpha_test_state *alpha_test; const struct pipe_blend_state *blend; const struct pipe_sampler_state *sampler[PIPE_MAX_SAMPLERS]; - const struct pipe_depth_stencil_state *depth_stencil; + const struct pipe_depth_stencil_alpha_state *depth_stencil; const struct pipe_rasterizer_state *rasterizer; const struct sp_fragment_shader_state *fs; const struct sp_vertex_shader_state *vs; diff --git a/src/mesa/pipe/softpipe/sp_quad.c b/src/mesa/pipe/softpipe/sp_quad.c index 6330465a8b..a10c9c3e02 100644 --- a/src/mesa/pipe/softpipe/sp_quad.c +++ b/src/mesa/pipe/softpipe/sp_quad.c @@ -43,8 +43,8 @@ static void sp_build_depth_stencil( struct softpipe_context *sp ) { - if (sp->depth_stencil->stencil.front_enabled || - sp->depth_stencil->stencil.back_enabled) { + if (sp->depth_stencil->stencil[0].enabled || + sp->depth_stencil->stencil[1].enabled) { sp_push_quad_first( sp, sp->quad.stencil_test ); } else if (sp->depth_stencil->depth.enabled && @@ -59,7 +59,7 @@ sp_build_quad_pipeline(struct softpipe_context *sp) boolean early_depth_test = sp->depth_stencil->depth.enabled && sp->framebuffer.zbuf && - !sp->alpha_test->enabled && + !sp->depth_stencil->alpha.enabled && sp->fs->shader.output_semantic_name[0] != TGSI_SEMANTIC_POSITION; /* build up the pipeline in reverse order... */ @@ -98,7 +98,7 @@ sp_build_quad_pipeline(struct softpipe_context *sp) sp_build_depth_stencil( sp ); } - if (sp->alpha_test->enabled) { + if (sp->depth_stencil->alpha.enabled) { sp_push_quad_first( sp, sp->quad.alpha_test ); } diff --git a/src/mesa/pipe/softpipe/sp_quad_alpha_test.c b/src/mesa/pipe/softpipe/sp_quad_alpha_test.c index d056abe98d..4ffeac35e1 100644 --- a/src/mesa/pipe/softpipe/sp_quad_alpha_test.c +++ b/src/mesa/pipe/softpipe/sp_quad_alpha_test.c @@ -14,11 +14,11 @@ static void alpha_test_quad(struct quad_stage *qs, struct quad_header *quad) { struct softpipe_context *softpipe = qs->softpipe; - const float ref = softpipe->alpha_test->ref; + const float ref = softpipe->depth_stencil->alpha.ref; unsigned passMask = 0x0, j; const float *aaaa = quad->outputs.color[3]; - switch (softpipe->alpha_test->func) { + switch (softpipe->depth_stencil->alpha.func) { case PIPE_FUNC_NEVER: quad->mask = 0x0; break; diff --git a/src/mesa/pipe/softpipe/sp_quad_stencil.c b/src/mesa/pipe/softpipe/sp_quad_stencil.c index 3f3eca078b..a688a06c74 100644 --- a/src/mesa/pipe/softpipe/sp_quad_stencil.c +++ b/src/mesa/pipe/softpipe/sp_quad_stencil.c @@ -211,24 +211,13 @@ stencil_test_quad(struct quad_stage *qs, struct quad_header *quad) /* choose front or back face function, operator, etc */ /* XXX we could do these initializations once per primitive */ - if (softpipe->depth_stencil->stencil.back_enabled && quad->facing) { - func = softpipe->depth_stencil->stencil.back_func; - failOp = softpipe->depth_stencil->stencil.back_fail_op; - zFailOp = softpipe->depth_stencil->stencil.back_zfail_op; - zPassOp = softpipe->depth_stencil->stencil.back_zpass_op; - ref = softpipe->depth_stencil->stencil.ref_value[1]; - wrtMask = softpipe->depth_stencil->stencil.write_mask[1]; - valMask = softpipe->depth_stencil->stencil.value_mask[1]; - } - else { - func = softpipe->depth_stencil->stencil.front_func; - failOp = softpipe->depth_stencil->stencil.front_fail_op; - zFailOp = softpipe->depth_stencil->stencil.front_zfail_op; - zPassOp = softpipe->depth_stencil->stencil.front_zpass_op; - ref = softpipe->depth_stencil->stencil.ref_value[0]; - wrtMask = softpipe->depth_stencil->stencil.write_mask[0]; - valMask = softpipe->depth_stencil->stencil.value_mask[0]; - } + func = softpipe->depth_stencil->stencil[quad->facing].func; + failOp = softpipe->depth_stencil->stencil[quad->facing].fail_op; + zFailOp = softpipe->depth_stencil->stencil[quad->facing].zfail_op; + zPassOp = softpipe->depth_stencil->stencil[quad->facing].zpass_op; + ref = softpipe->depth_stencil->stencil[quad->facing].ref_value; + wrtMask = softpipe->depth_stencil->stencil[quad->facing].write_mask; + valMask = softpipe->depth_stencil->stencil[quad->facing].value_mask; assert(ps); /* shouldn't get here if there's no stencil buffer */ diff --git a/src/mesa/pipe/softpipe/sp_state.h b/src/mesa/pipe/softpipe/sp_state.h index a3bd078a71..76b79b5280 100644 --- a/src/mesa/pipe/softpipe/sp_state.h +++ b/src/mesa/pipe/softpipe/sp_state.h @@ -52,13 +52,6 @@ struct sp_fragment_shader_state { #endif }; -void * -softpipe_create_alpha_test_state(struct pipe_context *, - const struct pipe_alpha_test_state *); -void -softpipe_bind_alpha_test_state(struct pipe_context *, void *); -void -softpipe_delete_alpha_test_state(struct pipe_context *, void *); void * softpipe_create_blend_state(struct pipe_context *, @@ -76,7 +69,7 @@ void softpipe_delete_sampler_state(struct pipe_context *, void *); void * softpipe_create_depth_stencil_state(struct pipe_context *, - const struct pipe_depth_stencil_state *); + const struct pipe_depth_stencil_alpha_state *); void softpipe_bind_depth_stencil_state(struct pipe_context *, void *); void softpipe_delete_depth_stencil_state(struct pipe_context *, void *); diff --git a/src/mesa/pipe/softpipe/sp_state_blend.c b/src/mesa/pipe/softpipe/sp_state_blend.c index 5ceec2513f..160ca5cbc0 100644 --- a/src/mesa/pipe/softpipe/sp_state_blend.c +++ b/src/mesa/pipe/softpipe/sp_state_blend.c @@ -73,40 +73,14 @@ void softpipe_set_blend_color( struct pipe_context *pipe, * into one file. */ -void * -softpipe_create_alpha_test_state(struct pipe_context *pipe, - const struct pipe_alpha_test_state *alpha) -{ - struct pipe_alpha_test_state *state = MALLOC( sizeof(struct pipe_alpha_test_state) ); - memcpy(state, alpha, sizeof(struct pipe_alpha_test_state)); - return state; -} - -void -softpipe_bind_alpha_test_state(struct pipe_context *pipe, - void *alpha) -{ - struct softpipe_context *softpipe = softpipe_context(pipe); - - softpipe->alpha_test = (const struct pipe_alpha_test_state *)alpha; - - softpipe->dirty |= SP_NEW_ALPHA_TEST; -} - -void -softpipe_delete_alpha_test_state(struct pipe_context *pipe, - void *alpha) -{ - FREE( alpha ); -} void * softpipe_create_depth_stencil_state(struct pipe_context *pipe, - const struct pipe_depth_stencil_state *depth_stencil) + const struct pipe_depth_stencil_alpha_state *depth_stencil) { - struct pipe_depth_stencil_state *state = - MALLOC( sizeof(struct pipe_depth_stencil_state) ); - memcpy(state, depth_stencil, sizeof(struct pipe_depth_stencil_state)); + struct pipe_depth_stencil_alpha_state *state = + MALLOC( sizeof(struct pipe_depth_stencil_alpha_state) ); + memcpy(state, depth_stencil, sizeof(struct pipe_depth_stencil_alpha_state)); return state; } @@ -116,9 +90,9 @@ softpipe_bind_depth_stencil_state(struct pipe_context *pipe, { struct softpipe_context *softpipe = softpipe_context(pipe); - softpipe->depth_stencil = (const struct pipe_depth_stencil_state *)depth_stencil; + softpipe->depth_stencil = (const struct pipe_depth_stencil_alpha_state *)depth_stencil; - softpipe->dirty |= SP_NEW_DEPTH_STENCIL; + softpipe->dirty |= SP_NEW_DEPTH_STENCIL_ALPHA; } void diff --git a/src/mesa/pipe/softpipe/sp_state_derived.c b/src/mesa/pipe/softpipe/sp_state_derived.c index 736ac1c33b..94072a2d30 100644 --- a/src/mesa/pipe/softpipe/sp_state_derived.c +++ b/src/mesa/pipe/softpipe/sp_state_derived.c @@ -201,16 +201,16 @@ void softpipe_update_derived( struct softpipe_context *softpipe ) calculate_vertex_layout( softpipe ); if (softpipe->dirty & (SP_NEW_SCISSOR | - SP_NEW_DEPTH_STENCIL | + SP_NEW_DEPTH_STENCIL_ALPHA | SP_NEW_FRAMEBUFFER)) compute_cliprect(softpipe); if (softpipe->dirty & (SP_NEW_BLEND | - SP_NEW_DEPTH_STENCIL | - SP_NEW_ALPHA_TEST | + SP_NEW_DEPTH_STENCIL_ALPHA | SP_NEW_FRAMEBUFFER | SP_NEW_RASTERIZER | - SP_NEW_FS)) + SP_NEW_FS | + SP_NEW_QUERY)) sp_build_quad_pipeline(softpipe); softpipe->dirty = 0; -- cgit v1.2.3