From fc691d9f37105e8da7aff45036a5ad1397d945cf Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 16 Apr 2024 14:37:47 -0400 Subject: [PATCH] lavapipe: disable stencil test if no stencil attachment stencil test must not be enabled if there is no stencil attachment fixes dEQP-VK.pipeline.*.stencil.no_stencil_att.dynamic_rendering.* fixes #10990 cc: mesa-stable Part-of: --- src/gallium/frontends/lavapipe/lvp_execute.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/gallium/frontends/lavapipe/lvp_execute.c b/src/gallium/frontends/lavapipe/lvp_execute.c index eb8ba509a11..c02b6745a5e 100644 --- a/src/gallium/frontends/lavapipe/lvp_execute.c +++ b/src/gallium/frontends/lavapipe/lvp_execute.c @@ -87,6 +87,7 @@ struct rendering_state { bool blend_dirty; bool rs_dirty; bool dsa_dirty; + bool dsa_no_stencil; bool stencil_ref_dirty; bool clip_state_dirty; bool blend_color_dirty; @@ -503,8 +504,16 @@ static void emit_state(struct rendering_state *state) } if (state->dsa_dirty) { + bool s0_enabled = state->dsa_state.stencil[0].enabled; + bool s1_enabled = state->dsa_state.stencil[1].enabled; + if (state->dsa_no_stencil) { + state->dsa_state.stencil[0].enabled = false; + state->dsa_state.stencil[1].enabled = false; + } cso_set_depth_stencil_alpha(state->cso, &state->dsa_state); state->dsa_dirty = false; + state->dsa_state.stencil[0].enabled = s0_enabled; + state->dsa_state.stencil[1].enabled = s1_enabled; } if (state->sample_mask_dirty) { @@ -1853,6 +1862,8 @@ handle_begin_rendering(struct vk_cmd_queue_entry *cmd, render_att_init(&state->depth_att, info->pDepthAttachment, state->poison_mem, false); render_att_init(&state->stencil_att, info->pStencilAttachment, state->poison_mem, true); + state->dsa_no_stencil = !state->stencil_att.imgv; + state->dsa_dirty = true; if (state->depth_att.imgv || state->stencil_att.imgv) { assert(state->depth_att.imgv == NULL || state->stencil_att.imgv == NULL ||