Skip to content

Commit 51dd480

Browse files
zmike1ace
authored andcommitted
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 fc691d9)
1 parent c9429bc commit 51dd480

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

.pick_status.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1614,7 +1614,7 @@
16141614
"description": "lavapipe: disable stencil test if no stencil attachment",
16151615
"nominated": true,
16161616
"nomination_type": 0,
1617-
"resolution": 0,
1617+
"resolution": 1,
16181618
"main_sha": null,
16191619
"because_sha": null,
16201620
"notes": null

src/gallium/frontends/lavapipe/lvp_execute.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ struct rendering_state {
8888
bool blend_dirty;
8989
bool rs_dirty;
9090
bool dsa_dirty;
91+
bool dsa_no_stencil;
9192
bool stencil_ref_dirty;
9293
bool clip_state_dirty;
9394
bool blend_color_dirty;
@@ -470,8 +471,16 @@ static void emit_state(struct rendering_state *state)
470471
}
471472

472473
if (state->dsa_dirty) {
474+
bool s0_enabled = state->dsa_state.stencil[0].enabled;
475+
bool s1_enabled = state->dsa_state.stencil[1].enabled;
476+
if (state->dsa_no_stencil) {
477+
state->dsa_state.stencil[0].enabled = false;
478+
state->dsa_state.stencil[1].enabled = false;
479+
}
473480
cso_set_depth_stencil_alpha(state->cso, &state->dsa_state);
474481
state->dsa_dirty = false;
482+
state->dsa_state.stencil[0].enabled = s0_enabled;
483+
state->dsa_state.stencil[1].enabled = s1_enabled;
475484
}
476485

477486
if (state->sample_mask_dirty) {
@@ -1784,6 +1793,8 @@ handle_begin_rendering(struct vk_cmd_queue_entry *cmd,
17841793

17851794
render_att_init(&state->depth_att, info->pDepthAttachment, state->poison_mem, false);
17861795
render_att_init(&state->stencil_att, info->pStencilAttachment, state->poison_mem, true);
1796+
state->dsa_no_stencil = !state->stencil_att.imgv;
1797+
state->dsa_dirty = true;
17871798
if (state->depth_att.imgv || state->stencil_att.imgv) {
17881799
assert(state->depth_att.imgv == NULL ||
17891800
state->stencil_att.imgv == NULL ||

0 commit comments

Comments
 (0)