zink: split stencil ref changes to separate dirty flag

the values here are for the cmdbuf, not the pipeline, so they should
always be updated regardless of what the current dsa state uses

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11396>
This commit is contained in:
Mike Blumenkrantz 2021-05-06 16:09:10 -04:00 committed by Marge Bot
parent e6a100b4cd
commit bb9efa527a
3 changed files with 11 additions and 13 deletions

View file

@ -1362,7 +1362,7 @@ zink_set_stencil_ref(struct pipe_context *pctx,
{
struct zink_context *ctx = zink_context(pctx);
ctx->stencil_ref = ref;
ctx->dsa_state_changed |= !!ctx->dsa_state;
ctx->stencil_ref_changed = true;
}
static void
@ -1803,6 +1803,7 @@ flush_batch(struct zink_context *ctx, bool sync)
ctx->vp_state_changed = true;
ctx->scissor_changed = true;
ctx->rast_state_changed = true;
ctx->stencil_ref_changed = true;
ctx->dsa_state_changed = true;
}
}

View file

@ -168,6 +168,7 @@ struct zink_context {
struct zink_depth_stencil_alpha_state *dsa_state;
bool rast_state_changed : 1;
bool dsa_state_changed : 1;
bool stencil_ref_changed : 1;
struct hash_table desc_set_layouts[ZINK_DESCRIPTOR_TYPES];
bool pipeline_changed[2]; //gfx, compute

View file

@ -583,19 +583,15 @@ zink_draw_vbo(struct pipe_context *pctx,
debug_printf("BUG: wide lines not supported, needs fallback!");
}
if (pipeline_changed || ctx->dsa_state_changed) {
if (dsa_state->base.stencil[0].enabled) {
if (dsa_state->base.stencil[1].enabled) {
vkCmdSetStencilReference(batch->state->cmdbuf, VK_STENCIL_FACE_FRONT_BIT,
ctx->stencil_ref.ref_value[0]);
vkCmdSetStencilReference(batch->state->cmdbuf, VK_STENCIL_FACE_BACK_BIT,
ctx->stencil_ref.ref_value[1]);
} else
vkCmdSetStencilReference(batch->state->cmdbuf,
VK_STENCIL_FACE_FRONT_AND_BACK,
ctx->stencil_ref.ref_value[0]);
}
if (ctx->stencil_ref_changed) {
vkCmdSetStencilReference(batch->state->cmdbuf, VK_STENCIL_FACE_FRONT_BIT,
ctx->stencil_ref.ref_value[0]);
vkCmdSetStencilReference(batch->state->cmdbuf, VK_STENCIL_FACE_BACK_BIT,
ctx->stencil_ref.ref_value[1]);
ctx->stencil_ref_changed = false;
}
if (pipeline_changed || ctx->dsa_state_changed) {
if (screen->info.have_EXT_extended_dynamic_state) {
screen->vk.CmdSetDepthBoundsTestEnableEXT(batch->state->cmdbuf, dsa_state->hw_state.depth_bounds_test);
if (dsa_state->hw_state.depth_bounds_test)