Module: Mesa
Branch: main
Commit: e4a1bc70dd739ca8addddc940af08312b038e288
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e4a1bc70dd739ca8addddc940af08312b038e288

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>

---

 src/amd/vulkan/radv_cmd_buffer.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
index 20908dae425..6c4f9ee6aef 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