From ef5697a884b668b0caab422fe3aa81613319622f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Pi=C3=B1eiro?= Date: Fri, 26 Apr 2024 23:45:44 +0200 Subject: [PATCH] v3dv/cmd_buffer: missing updates due PrimitiveTopology being dynamic now There were some pending places to update after PrimitiveTopology become dynamic. FWIW, this was not catched by any CTS test. As we are here we add a comment to explain why we still use the topology on the pipeline. Fixes: 2526f74adeda ("v3dv: PrimitiveTopology is now dynamic") Reviewed-by: Iago Toral Quiroga Part-of: --- src/broadcom/vulkan/v3dv_pipeline.c | 5 +++++ src/broadcom/vulkan/v3dvx_cmd_buffer.c | 9 ++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/broadcom/vulkan/v3dv_pipeline.c b/src/broadcom/vulkan/v3dv_pipeline.c index 9851a24c2cd..51575b68bcb 100644 --- a/src/broadcom/vulkan/v3dv_pipeline.c +++ b/src/broadcom/vulkan/v3dv_pipeline.c @@ -2189,6 +2189,11 @@ write_creation_feedback(struct v3dv_pipeline *pipeline, } } +/* Note that although PrimitiveTopology is now dynamic, it is still safe to + * compute the gs_input/output_primitive from the topology saved at the + * pipeline, as the topology class will not change, because we don't support + * dynamicPrimitiveTopologyUnrestricted + */ static enum mesa_prim multiview_gs_input_primitive_from_pipeline(struct v3dv_pipeline *pipeline) { diff --git a/src/broadcom/vulkan/v3dvx_cmd_buffer.c b/src/broadcom/vulkan/v3dvx_cmd_buffer.c index d7fb087d9a8..31cd9097f3b 100644 --- a/src/broadcom/vulkan/v3dvx_cmd_buffer.c +++ b/src/broadcom/vulkan/v3dvx_cmd_buffer.c @@ -2707,7 +2707,9 @@ v3dX(cmd_buffer_emit_draw_indexed)(struct v3dv_cmd_buffer *cmd_buffer, assert(job); const struct v3dv_pipeline *pipeline = cmd_buffer->state.gfx.pipeline; - uint32_t hw_prim_type = v3d_hw_prim_type(pipeline->topology); + const struct vk_dynamic_graphics_state *dyn = + &cmd_buffer->vk.dynamic_graphics_state; + uint32_t hw_prim_type = v3dv_pipeline_primitive(dyn->ia.primitive_topology); uint8_t index_type = ffs(cmd_buffer->state.index_buffer.index_size) - 1; uint32_t index_offset = firstIndex * cmd_buffer->state.index_buffer.index_size; @@ -2760,8 +2762,9 @@ v3dX(cmd_buffer_emit_draw_indirect)(struct v3dv_cmd_buffer *cmd_buffer, struct v3dv_job *job = cmd_buffer->state.job; assert(job); - const struct v3dv_pipeline *pipeline = cmd_buffer->state.gfx.pipeline; - uint32_t hw_prim_type = v3d_hw_prim_type(pipeline->topology); + const struct vk_dynamic_graphics_state *dyn = + &cmd_buffer->vk.dynamic_graphics_state; + uint32_t hw_prim_type = v3dv_pipeline_primitive(dyn->ia.primitive_topology); v3dv_cl_ensure_space_with_branch( &job->bcl, cl_packet_length(INDIRECT_VERTEX_ARRAY_INSTANCED_PRIMS));