diff --git a/src/gallium/drivers/zink/zink_pipeline.c b/src/gallium/drivers/zink/zink_pipeline.c index 6a5b583cac7..b4f5d3a4383 100644 --- a/src/gallium/drivers/zink/zink_pipeline.c +++ b/src/gallium/drivers/zink/zink_pipeline.c @@ -49,6 +49,7 @@ VkPipeline zink_create_gfx_pipeline(struct zink_screen *screen, struct zink_gfx_program *prog, struct zink_gfx_pipeline_state *state, + const uint8_t *binding_map, VkPrimitiveTopology primitive_topology) { struct zink_rasterizer_hw_state *hw_rast_state = (void*)state; @@ -60,6 +61,13 @@ zink_create_gfx_pipeline(struct zink_screen *screen, vertex_input_state.vertexBindingDescriptionCount = state->element_state->num_bindings; vertex_input_state.pVertexAttributeDescriptions = state->element_state->attribs; vertex_input_state.vertexAttributeDescriptionCount = state->element_state->num_attribs; + if (!screen->info.have_EXT_extended_dynamic_state) { + for (int i = 0; i < state->element_state->num_bindings; ++i) { + const unsigned buffer_id = binding_map[i]; + VkVertexInputBindingDescription *binding = &state->element_state->b.bindings[i]; + binding->stride = state->vertex_strides[buffer_id]; + } + } } VkPipelineVertexInputDivisorStateCreateInfoEXT vdiv_state; diff --git a/src/gallium/drivers/zink/zink_pipeline.h b/src/gallium/drivers/zink/zink_pipeline.h index 04c6a05d25e..b3acb614947 100644 --- a/src/gallium/drivers/zink/zink_pipeline.h +++ b/src/gallium/drivers/zink/zink_pipeline.h @@ -110,6 +110,7 @@ VkPipeline zink_create_gfx_pipeline(struct zink_screen *screen, struct zink_gfx_program *prog, struct zink_gfx_pipeline_state *state, + const uint8_t *binding_map, VkPrimitiveTopology primitive_topology); VkPipeline diff --git a/src/gallium/drivers/zink/zink_program.c b/src/gallium/drivers/zink/zink_program.c index b39f3d55a84..c06a1e3bea8 100644 --- a/src/gallium/drivers/zink/zink_program.c +++ b/src/gallium/drivers/zink/zink_program.c @@ -771,9 +771,10 @@ zink_get_gfx_pipeline(struct zink_context *ctx, hash = XXH32(&vertex_buffers_enabled_mask, sizeof(uint32_t), hash); for (unsigned i = 0; i < state->element_state->num_bindings; i++) { - struct pipe_vertex_buffer *vb = ctx->vertex_buffers + ctx->element_state->binding_map[i]; - state->vertex_strides[i] = vb->buffer.resource ? vb->stride : 0; - hash = XXH32(&state->vertex_strides[i], sizeof(uint32_t), hash); + const unsigned buffer_id = ctx->element_state->binding_map[i]; + struct pipe_vertex_buffer *vb = ctx->vertex_buffers + buffer_id; + state->vertex_strides[buffer_id] = vb->buffer.resource ? vb->stride : 0; + hash = XXH32(&state->vertex_strides[buffer_id], sizeof(uint32_t), hash); } state->vertex_hash = hash ^ state->element_state->hash; } else @@ -787,8 +788,9 @@ zink_get_gfx_pipeline(struct zink_context *ctx, if (!entry) { util_queue_fence_wait(&prog->base.cache_fence); - VkPipeline pipeline = zink_create_gfx_pipeline(screen, prog, - state, vkmode); + VkPipeline pipeline = zink_create_gfx_pipeline(screen, prog, state, + ctx->element_state->binding_map, + vkmode); if (pipeline == VK_NULL_HANDLE) return VK_NULL_HANDLE;