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

Author: Mike Blumenkrantz <[email protected]>
Date:   Thu Jun 23 15:13:56 2022 -0400

zink: always set vertex dynamic states

even if there are no bindings, this should be set in order to further
deduplicate the number of pipelines needed

Reviewed-by: Dave Airlie <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17225>

---

 src/gallium/drivers/zink/zink_draw.cpp   |  5 +----
 src/gallium/drivers/zink/zink_pipeline.c | 10 ++++------
 2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/src/gallium/drivers/zink/zink_draw.cpp 
b/src/gallium/drivers/zink/zink_draw.cpp
index ff3c74d1e00..60cb47959be 100644
--- a/src/gallium/drivers/zink/zink_draw.cpp
+++ b/src/gallium/drivers/zink/zink_draw.cpp
@@ -114,9 +114,6 @@ zink_bind_vertex_buffers(struct zink_batch *batch, struct 
zink_context *ctx)
    struct zink_vertex_elements_state *elems = ctx->element_state;
    struct zink_screen *screen = zink_screen(ctx->base.screen);
 
-   if (!elems->hw_state.num_bindings)
-      return;
-
    for (unsigned i = 0; i < elems->hw_state.num_bindings; i++) {
       struct pipe_vertex_buffer *vb = ctx->vertex_buffers + 
ctx->element_state->binding_map[i];
       assert(vb);
@@ -141,7 +138,7 @@ zink_bind_vertex_buffers(struct zink_batch *batch, struct 
zink_context *ctx)
       VKCTX(CmdBindVertexBuffers2EXT)(batch->state->cmdbuf, 0,
                                           elems->hw_state.num_bindings,
                                           buffers, buffer_offsets, NULL, 
buffer_strides);
-   else
+   else if (elems->hw_state.num_bindings)
       VKSCR(CmdBindVertexBuffers)(batch->state->cmdbuf, 0,
                              elems->hw_state.num_bindings,
                              buffers, buffer_offsets);
diff --git a/src/gallium/drivers/zink/zink_pipeline.c 
b/src/gallium/drivers/zink/zink_pipeline.c
index 3884c90b6b4..26d531cb823 100644
--- a/src/gallium/drivers/zink/zink_pipeline.c
+++ b/src/gallium/drivers/zink/zink_pipeline.c
@@ -244,12 +244,10 @@ zink_create_gfx_pipeline(struct zink_screen *screen,
       dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_VIEWPORT;
       dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_SCISSOR;
    }
-   if (state->element_state->num_attribs) {
-      if (screen->info.have_EXT_vertex_input_dynamic_state)
-         dynamicStateEnables[state_count++] = 
VK_DYNAMIC_STATE_VERTEX_INPUT_EXT;
-      else if (screen->info.have_EXT_extended_dynamic_state && 
state->uses_dynamic_stride)
-         dynamicStateEnables[state_count++] = 
VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE;
-   }
+   if (screen->info.have_EXT_vertex_input_dynamic_state)
+      dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_VERTEX_INPUT_EXT;
+   else if (screen->info.have_EXT_extended_dynamic_state && 
state->uses_dynamic_stride)
+      dynamicStateEnables[state_count++] = 
VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE;
    if (screen->info.have_EXT_extended_dynamic_state2) {
       dynamicStateEnables[state_count++] = 
VK_DYNAMIC_STATE_PRIMITIVE_RESTART_ENABLE;
       dynamicStateEnables[state_count++] = 
VK_DYNAMIC_STATE_RASTERIZER_DISCARD_ENABLE;

Reply via email to