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

Author: Lionel Landwerlin <[email protected]>
Date:   Thu Oct 26 17:17:22 2023 +0300

anv: ensure we reapply always pipeline dynamic state in runtime state

Doing something like this is allowed :

vkCreateGraphicsPipeline(.., scissorState, &pipeline);

vkCmdBindPipeline(pipeline);
vkCmdSetScissor(...)
vkCmdBindPipeline(pipeline)

If we don't reapply the pipeline dynamic state, the command buffer
runtime state will keep the dynamic state set in between the 2 binds.

Signed-off-by: Lionel Landwerlin <[email protected]>
Reviewed-by: Ivan Briano <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25915>

---

 src/intel/vulkan/anv_cmd_buffer.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/intel/vulkan/anv_cmd_buffer.c 
b/src/intel/vulkan/anv_cmd_buffer.c
index 144f6209558..3148bb90ada 100644
--- a/src/intel/vulkan/anv_cmd_buffer.c
+++ b/src/intel/vulkan/anv_cmd_buffer.c
@@ -633,6 +633,11 @@ void anv_CmdBindPipeline(
          cmd_buffer->state.gfx.pipeline;
       struct anv_graphics_pipeline *new_pipeline =
          anv_pipeline_to_graphics(pipeline);
+
+      /* Apply the non dynamic state from the pipeline */
+      vk_cmd_set_dynamic_graphics_state(&cmd_buffer->vk,
+                                        &new_pipeline->dynamic_state);
+
       if (old_pipeline == new_pipeline)
          return;
 
@@ -645,10 +650,6 @@ void anv_CmdBindPipeline(
                                 &new_pipeline->base.shaders[stage]->bind_map);
       }
 
-      /* Apply the non dynamic state from the pipeline */
-      vk_cmd_set_dynamic_graphics_state(&cmd_buffer->vk,
-                                        &new_pipeline->dynamic_state);
-
       state = &cmd_buffer->state.gfx.base;
       stages = new_pipeline->base.base.active_stages;
 

Reply via email to