zink: Set vertex binding stride without dynamic state extensions
EXT_vertex_input_dynamic_state When both EXT_vertex_input_dynamic_state and EXT_extended_dynamic_state are not available stride is never set and nothing is rasterized as all triangles are degenerate. This fix copies stride into the VkVertexInputBindingDescription array when the graphics pipeline is created when those extensions aren't available. Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14549>
This commit is contained in:
parent
0722cd7a30
commit
61e3f549c5
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue