diff options
author | Christian König <[email protected]> | 2012-07-18 11:03:32 +0200 |
---|---|---|
committer | Christian König <[email protected]> | 2012-07-24 12:29:30 +0200 |
commit | e6937211da019223ca3b8fd0be6ed5a5fe35c706 (patch) | |
tree | a0922673693c629128fc0a8ca748353581682afd /src/gallium/drivers/radeonsi/si_state.c | |
parent | b41b3eb9893b9bac8df363fef4d10c68798616e2 (diff) |
radeonsi: move stencil_ref to new handling
Signed-off-by: Christian König <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_state.c')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state.c | 45 |
1 files changed, 35 insertions, 10 deletions
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index 1e38575925c..4d3f63422e9 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -466,6 +466,39 @@ static void si_delete_rs_state(struct pipe_context *ctx, void *state) } /* + * infeered state between dsa and stencil ref + */ +static void si_update_dsa_stencil_ref(struct r600_context *rctx) +{ + struct si_pm4_state *pm4 = CALLOC_STRUCT(si_pm4_state); + struct pipe_stencil_ref *ref = &rctx->stencil_ref; + struct si_state_dsa *dsa = rctx->queued.named.dsa; + + if (pm4 == NULL) + return; + + si_pm4_set_reg(pm4, R_028430_DB_STENCILREFMASK, + S_028430_STENCILTESTVAL(ref->ref_value[0]) | + S_028430_STENCILMASK(dsa->valuemask[0]) | + S_028430_STENCILWRITEMASK(dsa->writemask[0])); + si_pm4_set_reg(pm4, R_028434_DB_STENCILREFMASK_BF, + S_028434_STENCILTESTVAL_BF(ref->ref_value[1]) | + S_028434_STENCILMASK_BF(dsa->valuemask[1]) | + S_028434_STENCILWRITEMASK_BF(dsa->writemask[1])); + + si_pm4_set_state(rctx, dsa_stencil_ref, pm4); +} + +static void si_set_pipe_stencil_ref(struct pipe_context *ctx, + const struct pipe_stencil_ref *state) +{ + struct r600_context *rctx = (struct r600_context *)ctx; + rctx->stencil_ref = *state; + si_update_dsa_stencil_ref(rctx); +} + + +/* * DSA */ @@ -550,25 +583,16 @@ static void si_bind_dsa_state(struct pipe_context *ctx, void *state) { struct r600_context *rctx = (struct r600_context *)ctx; struct si_state_dsa *dsa = state; - struct r600_stencil_ref ref; if (state == NULL) return; si_pm4_bind_state(rctx, dsa, dsa); + si_update_dsa_stencil_ref(rctx); // TODO rctx->alpha_ref = dsa->alpha_ref; rctx->alpha_ref_dirty = true; - - ref.ref_value[0] = rctx->stencil_ref.ref_value[0]; - ref.ref_value[1] = rctx->stencil_ref.ref_value[1]; - ref.valuemask[0] = dsa->valuemask[0]; - ref.valuemask[1] = dsa->valuemask[1]; - ref.writemask[0] = dsa->writemask[0]; - ref.writemask[1] = dsa->writemask[1]; - - r600_set_stencil_ref(ctx, &ref); } static void si_delete_dsa_state(struct pipe_context *ctx, void *state) @@ -1264,6 +1288,7 @@ void si_init_state_functions(struct r600_context *rctx) rctx->context.set_clip_state = si_set_clip_state; rctx->context.set_scissor_state = si_set_scissor_state; rctx->context.set_viewport_state = si_set_viewport_state; + rctx->context.set_stencil_ref = si_set_pipe_stencil_ref; rctx->context.set_framebuffer_state = si_set_framebuffer_state; } |