@@ -88,6 +88,7 @@ struct rendering_state {
88
88
bool blend_dirty ;
89
89
bool rs_dirty ;
90
90
bool dsa_dirty ;
91
+ bool dsa_no_stencil ;
91
92
bool stencil_ref_dirty ;
92
93
bool clip_state_dirty ;
93
94
bool blend_color_dirty ;
@@ -470,8 +471,16 @@ static void emit_state(struct rendering_state *state)
470
471
}
471
472
472
473
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
+ }
473
480
cso_set_depth_stencil_alpha (state -> cso , & state -> dsa_state );
474
481
state -> dsa_dirty = false;
482
+ state -> dsa_state .stencil [0 ].enabled = s0_enabled ;
483
+ state -> dsa_state .stencil [1 ].enabled = s1_enabled ;
475
484
}
476
485
477
486
if (state -> sample_mask_dirty ) {
@@ -1784,6 +1793,8 @@ handle_begin_rendering(struct vk_cmd_queue_entry *cmd,
1784
1793
1785
1794
render_att_init (& state -> depth_att , info -> pDepthAttachment , state -> poison_mem , false);
1786
1795
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;
1787
1798
if (state -> depth_att .imgv || state -> stencil_att .imgv ) {
1788
1799
assert (state -> depth_att .imgv == NULL ||
1789
1800
state -> stencil_att .imgv == NULL ||
0 commit comments