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: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28772>
(cherry picked from commit fc691d9f37)
This commit is contained in:
Mike Blumenkrantz 2024-04-16 14:37:47 -04:00 committed by Eric Engestrom
parent c9429bce04
commit 51dd480f79
2 changed files with 12 additions and 1 deletions

View file

@ -1614,7 +1614,7 @@
"description": "lavapipe: disable stencil test if no stencil attachment",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -88,6 +88,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;
@ -470,8 +471,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) {
@ -1784,6 +1793,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 ||