Mesa (staging/22.0): radv: save/restore the stencil write mask during internal driver operations

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Apr 21 17:29:15 UTC 2022


Module: Mesa
Branch: staging/22.0
Commit: 42a8cdfc8297cd65d6aab818d4e4a64eeba69d67
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=42a8cdfc8297cd65d6aab818d4e4a64eeba69d67

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Wed Mar 30 14:31:35 2022 +0200

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 <samuel.pitoiset at gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15667>
(cherry picked from commit b784910ac78ff067b4dd8bb3113738be8c2e8183)

Conflicts:
	src/gallium/drivers/zink/ci/zink-radv-fails.txt

---

 .pick_status.json                               |  2 +-
 src/amd/vulkan/radv_meta.c                      |  7 +++++++
 src/amd/vulkan/radv_meta.h                      |  5 +++++
 src/gallium/drivers/zink/ci/zink-radv-fails.txt | 12 ------------
 4 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index e5678229edc..6639db3568e 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -6596,7 +6596,7 @@
         "description": "radv: save/restore the stencil write mask during internal driver operations",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 5,
+        "resolution": 1,
         "because_sha": null
     },
     {
diff --git a/src/amd/vulkan/radv_meta.c b/src/amd/vulkan/radv_meta.c
index f376a9e6562..56c7271109e 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 d53e57459f9..fbcb8027b31 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 13cb1008fa1..04988b95536 100644
--- a/src/gallium/drivers/zink/ci/zink-radv-fails.txt
+++ b/src/gallium/drivers/zink/ci/zink-radv-fails.txt
@@ -3,18 +3,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-GLES3.functional.clipping.line.wide_line_clip_viewport_center,Fail



More information about the mesa-commit mailing list