From b784910ac78ff067b4dd8bb3113738be8c2e8183 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Wed, 30 Mar 2022 14:31:35 +0200 Subject: [PATCH] radv: save/restore the stencil write mask during internal driver operations The slow depth/stencil clear path would overwrite the stencil write mask otherwise. This fixes few Zink failures. Cc: mesa-stable Signed-off-by: Samuel Pitoiset Reviewed-By: Mike Blumenkrantz Part-of: --- src/amd/vulkan/radv_meta.c | 7 ++++++ src/amd/vulkan/radv_meta.h | 5 ++++ .../drivers/zink/ci/zink-radv-fails.txt | 24 ------------------- 3 files changed, 12 insertions(+), 24 deletions(-) diff --git a/src/amd/vulkan/radv_meta.c b/src/amd/vulkan/radv_meta.c index 15aa1477379..a01145ce9f5 100644 --- a/src/amd/vulkan/radv_meta.c +++ b/src/amd/vulkan/radv_meta.c @@ -88,6 +88,9 @@ radv_meta_save(struct radv_meta_saved_state *state, struct radv_cmd_buffer *cmd_ state->stencil_op.back.depth_fail_op = cmd_buffer->state.dynamic.stencil_op.back.depth_fail_op; + state->stencil_write_mask.front = cmd_buffer->state.dynamic.stencil_write_mask.front; + state->stencil_write_mask.back = cmd_buffer->state.dynamic.stencil_write_mask.back; + state->fragment_shading_rate.size = cmd_buffer->state.dynamic.fragment_shading_rate.size; state->fragment_shading_rate.combiner_ops[0] = cmd_buffer->state.dynamic.fragment_shading_rate.combiner_ops[0]; @@ -182,6 +185,9 @@ radv_meta_restore(const struct radv_meta_saved_state *state, struct radv_cmd_buf cmd_buffer->state.dynamic.stencil_op.back.depth_fail_op = state->stencil_op.back.depth_fail_op; + cmd_buffer->state.dynamic.stencil_write_mask.front = state->stencil_write_mask.front; + cmd_buffer->state.dynamic.stencil_write_mask.back = state->stencil_write_mask.back; + cmd_buffer->state.dynamic.fragment_shading_rate.size = state->fragment_shading_rate.size; cmd_buffer->state.dynamic.fragment_shading_rate.combiner_ops[0] = state->fragment_shading_rate.combiner_ops[0]; @@ -205,6 +211,7 @@ radv_meta_restore(const struct radv_meta_saved_state *state, struct radv_cmd_buf RADV_CMD_DIRTY_DYNAMIC_DEPTH_WRITE_ENABLE | RADV_CMD_DIRTY_DYNAMIC_DEPTH_COMPARE_OP | RADV_CMD_DIRTY_DYNAMIC_DEPTH_BOUNDS_TEST_ENABLE | RADV_CMD_DIRTY_DYNAMIC_STENCIL_TEST_ENABLE | RADV_CMD_DIRTY_DYNAMIC_STENCIL_OP | + RADV_CMD_DIRTY_DYNAMIC_STENCIL_WRITE_MASK | RADV_CMD_DIRTY_DYNAMIC_FRAGMENT_SHADING_RATE | RADV_CMD_DIRTY_DYNAMIC_DEPTH_BIAS_ENABLE | RADV_CMD_DIRTY_DYNAMIC_PRIMITIVE_RESTART_ENABLE | RADV_CMD_DIRTY_DYNAMIC_RASTERIZER_DISCARD_ENABLE | RADV_CMD_DIRTY_DYNAMIC_LOGIC_OP | diff --git a/src/amd/vulkan/radv_meta.h b/src/amd/vulkan/radv_meta.h index bf9f7d86862..12855ce2d4f 100644 --- a/src/amd/vulkan/radv_meta.h +++ b/src/amd/vulkan/radv_meta.h @@ -70,6 +70,11 @@ struct radv_meta_saved_state { bool depth_bounds_test_enable; bool stencil_test_enable; + struct { + uint32_t front; + uint32_t back; + } stencil_write_mask; + struct { struct { VkStencilOp fail_op; diff --git a/src/gallium/drivers/zink/ci/zink-radv-fails.txt b/src/gallium/drivers/zink/ci/zink-radv-fails.txt index accec65c71d..22399ff7a9a 100644 --- a/src/gallium/drivers/zink/ci/zink-radv-fails.txt +++ b/src/gallium/drivers/zink/ci/zink-radv-fails.txt @@ -45,18 +45,6 @@ dEQP-GLES2.functional.clipping.line.wide_line_clip_viewport_corner,Fail dEQP-GLES2.functional.clipping.point.wide_point_clip,Fail dEQP-GLES2.functional.clipping.point.wide_point_clip_viewport_center,Fail dEQP-GLES2.functional.clipping.point.wide_point_clip_viewport_corner,Fail -dEQP-GLES2.functional.fragment_ops.stencil.cmp_equal,Fail -dEQP-GLES2.functional.fragment_ops.stencil.cmp_greater_or_equal,Fail -dEQP-GLES2.functional.fragment_ops.stencil.cmp_greater_than,Fail -dEQP-GLES2.functional.fragment_ops.stencil.cmp_less_or_equal,Fail -dEQP-GLES2.functional.fragment_ops.stencil.cmp_less_than,Fail -dEQP-GLES2.functional.fragment_ops.stencil.cmp_mask_equal,Fail -dEQP-GLES2.functional.fragment_ops.stencil.cmp_not_equal,Fail -dEQP-GLES2.functional.fragment_ops.stencil.decr_stencil_fail,Fail -dEQP-GLES2.functional.fragment_ops.stencil.decr_wrap_stencil_fail,Fail -dEQP-GLES2.functional.fragment_ops.stencil.incr_stencil_fail,Fail -dEQP-GLES2.functional.fragment_ops.stencil.incr_wrap_stencil_fail,Fail -dEQP-GLES2.functional.fragment_ops.stencil.invert_stencil_fail,Fail dEQP-GLES2.functional.rasterization.primitives.line_loop_wide,Fail dEQP-GLES2.functional.rasterization.primitives.line_strip_wide,Fail dEQP-GLES31.functional.blend_equation_advanced.barrier.colorburn,Fail @@ -180,18 +168,6 @@ dEQP-GLES3.functional.fbo.depth.depth_write_clamp.depth24_stencil8,Fail dEQP-GLES3.functional.fbo.depth.depth_write_clamp.depth32f_stencil8,Fail dEQP-GLES3.functional.fbo.depth.depth_write_clamp.depth_component24,Fail dEQP-GLES3.functional.fbo.depth.depth_write_clamp.depth_component32f,Fail -dEQP-GLES3.functional.fragment_ops.stencil.cmp_equal,Fail -dEQP-GLES3.functional.fragment_ops.stencil.cmp_greater_or_equal,Fail -dEQP-GLES3.functional.fragment_ops.stencil.cmp_greater_than,Fail -dEQP-GLES3.functional.fragment_ops.stencil.cmp_less_or_equal,Fail -dEQP-GLES3.functional.fragment_ops.stencil.cmp_less_than,Fail -dEQP-GLES3.functional.fragment_ops.stencil.cmp_mask_equal,Fail -dEQP-GLES3.functional.fragment_ops.stencil.cmp_not_equal,Fail -dEQP-GLES3.functional.fragment_ops.stencil.decr_stencil_fail,Fail -dEQP-GLES3.functional.fragment_ops.stencil.decr_wrap_stencil_fail,Fail -dEQP-GLES3.functional.fragment_ops.stencil.incr_stencil_fail,Fail -dEQP-GLES3.functional.fragment_ops.stencil.incr_wrap_stencil_fail,Fail -dEQP-GLES3.functional.fragment_ops.stencil.invert_stencil_fail,Fail dEQP-GLES3.functional.occlusion_query.depth_clear,Fail dEQP-GLES3.functional.occlusion_query.depth_clear_stencil_clear,Fail dEQP-GLES3.functional.occlusion_query.depth_write_depth_clear_stencil_clear,Fail