radv: bind the VS input state for prologs created with GPL

If we have a VS that needs a prolog without using the dynamic state,
that means that it comes from a library, so we can overwrite the
cmdbuf VS input state.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18519>
This commit is contained in:
Samuel Pitoiset 2022-09-09 16:55:23 +02:00 committed by Marge Bot
parent 0feab7b9cf
commit c199a5160a

View file

@ -5082,6 +5082,27 @@ radv_mark_descriptor_sets_dirty(struct radv_cmd_buffer *cmd_buffer, VkPipelineBi
descriptors_state->dirty |= descriptors_state->valid; descriptors_state->dirty |= descriptors_state->valid;
} }
static void
radv_bind_vs_input_state(struct radv_cmd_buffer *cmd_buffer,
const struct radv_graphics_pipeline *pipeline)
{
const struct radv_shader *vs_shader = radv_get_shader(&pipeline->base, MESA_SHADER_VERTEX);
const struct radv_vs_input_state *src = &pipeline->vs_input_state;
/* Bind the vertex input state from the pipeline when the VS has a prolog and the state isn't
* dynamic. This can happen when the pre-rasterization stages and the vertex input state are from
* two different libraries. Otherwise, if the VS has a prolog, the state is dynamic and there is
* nothing to bind.
*/
if (!vs_shader || !vs_shader->info.vs.has_prolog ||
(pipeline->dynamic_states & RADV_DYNAMIC_VERTEX_INPUT))
return;
cmd_buffer->state.dynamic_vs_input = *src;
cmd_buffer->state.dirty |= RADV_CMD_DIRTY_DYNAMIC_VERTEX_INPUT;
}
VKAPI_ATTR void VKAPI_CALL VKAPI_ATTR void VKAPI_CALL
radv_CmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, radv_CmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint,
VkPipeline _pipeline) VkPipeline _pipeline)
@ -5178,6 +5199,8 @@ radv_CmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipeline
radv_bind_dynamic_state(cmd_buffer, &graphics_pipeline->dynamic_state); radv_bind_dynamic_state(cmd_buffer, &graphics_pipeline->dynamic_state);
radv_bind_vs_input_state(cmd_buffer, graphics_pipeline);
if (graphics_pipeline->esgs_ring_size > cmd_buffer->esgs_ring_size_needed) if (graphics_pipeline->esgs_ring_size > cmd_buffer->esgs_ring_size_needed)
cmd_buffer->esgs_ring_size_needed = graphics_pipeline->esgs_ring_size; cmd_buffer->esgs_ring_size_needed = graphics_pipeline->esgs_ring_size;
if (graphics_pipeline->gsvs_ring_size > cmd_buffer->gsvs_ring_size_needed) if (graphics_pipeline->gsvs_ring_size > cmd_buffer->gsvs_ring_size_needed)