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

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


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

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Thu Mar 31 20:20:35 2022 +0200

radv: save/restore the stencil reference during internal driver operations

I think I should improve this to be more robust.

Gitlab: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6243
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/15700>
(cherry picked from commit c439735a91aef2f26f2233825db1f68183283678)

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

---

 .pick_status.json          | 2 +-
 src/amd/vulkan/radv_meta.c | 8 +++++++-
 src/amd/vulkan/radv_meta.h | 5 +++++
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index acafbdb13e7..312dc6018c2 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -6020,7 +6020,7 @@
         "description": "radv: save/restore the stencil reference 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 2ee802d3571..d5a16aa706c 100644
--- a/src/amd/vulkan/radv_meta.c
+++ b/src/amd/vulkan/radv_meta.c
@@ -121,6 +121,9 @@ radv_meta_save(struct radv_meta_saved_state *state, struct radv_cmd_buffer *cmd_
       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->stencil_reference.front = cmd_buffer->state.dynamic.stencil_reference.front;
+      state->stencil_reference.back = cmd_buffer->state.dynamic.stencil_reference.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];
@@ -220,6 +223,9 @@ radv_meta_restore(const struct radv_meta_saved_state *state, struct radv_cmd_buf
       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.stencil_reference.front = state->stencil_reference.front;
+      cmd_buffer->state.dynamic.stencil_reference.back = state->stencil_reference.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];
@@ -243,7 +249,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_STENCIL_WRITE_MASK | RADV_CMD_DIRTY_DYNAMIC_STENCIL_REFERENCE |
          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 fbcb8027b31..010c94a1600 100644
--- a/src/amd/vulkan/radv_meta.h
+++ b/src/amd/vulkan/radv_meta.h
@@ -91,6 +91,11 @@ struct radv_meta_saved_state {
       } back;
    } stencil_op;
 
+   struct {
+      uint32_t front;
+      uint32_t back;
+   } stencil_reference;
+
    struct {
       VkExtent2D size;
       VkFragmentShadingRateCombinerOpKHR combiner_ops[2];



More information about the mesa-commit mailing list