Module: Mesa
Branch: staging/23.3
Commit: 3cb8275141775d1eb3a2e7aee43a9755b9e86835
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3cb8275141775d1eb3a2e7aee43a9755b9e86835

Author: Samuel Pitoiset <samuel.pitoi...@gmail.com>
Date:   Mon Oct 30 15:26:15 2023 +0100

radv: bind the non-dynamic graphics state from the pipeline unconditionally

The following sequence is valid (although weird) but many other drivers
(including RADV) were broken:
    - bind pipeline with some static state
    - set state command for that static state (to a bad value)
    - bind the same pipeline again
    - draw

Fixes new dEQP-VK.dynamic_state.*.double_static_bind.

Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoi...@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25954>
(cherry picked from commit e4a1bc70dd739ca8addddc940af08312b038e288)

---

 .pick_status.json                | 2 +-
 src/amd/vulkan/radv_cmd_buffer.c | 7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 671845e903c..694efedf315 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -4,7 +4,7 @@
         "description": "radv: bind the non-dynamic graphics state from the 
pipeline unconditionally",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null,
         "notes": null
diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
index d8a0ab5caf3..57b720520a8 100644
--- a/src/amd/vulkan/radv_cmd_buffer.c
+++ b/src/amd/vulkan/radv_cmd_buffer.c
@@ -6618,6 +6618,11 @@ radv_CmdBindPipeline(VkCommandBuffer commandBuffer, 
VkPipelineBindPoint pipeline
    case VK_PIPELINE_BIND_POINT_GRAPHICS: {
       struct radv_graphics_pipeline *graphics_pipeline = 
radv_pipeline_to_graphics(pipeline);
 
+      /* Bind the non-dynamic graphics state from the pipeline unconditionally 
because some PSO
+       * might have been overwritten between two binds of the same pipeline.
+       */
+      radv_bind_dynamic_state(cmd_buffer, &graphics_pipeline->dynamic_state);
+
       if (cmd_buffer->state.graphics_pipeline == graphics_pipeline)
          return;
       radv_mark_descriptor_sets_dirty(cmd_buffer, pipelineBindPoint);
@@ -6686,8 +6691,6 @@ radv_CmdBindPipeline(VkCommandBuffer commandBuffer, 
VkPipelineBindPoint pipeline
          cmd_buffer->state.dirty |= RADV_CMD_DIRTY_RBPLUS;
       }
 
-      radv_bind_dynamic_state(cmd_buffer, &graphics_pipeline->dynamic_state);
-
       radv_bind_vs_input_state(cmd_buffer, graphics_pipeline);
 
       radv_bind_multisample_state(cmd_buffer, &graphics_pipeline->ms);

Reply via email to