diff --git a/src/broadcom/vulkan/v3dv_pipeline.c b/src/broadcom/vulkan/v3dv_pipeline.c index 44b6b259dff42..9851a24c2cd6e 100644 --- a/src/broadcom/vulkan/v3dv_pipeline.c +++ b/src/broadcom/vulkan/v3dv_pipeline.c @@ -1076,6 +1076,12 @@ static const enum mesa_prim vk_to_mesa_prim[] = { [VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY] = MESA_PRIM_TRIANGLE_STRIP_ADJACENCY, }; +uint32_t +v3dv_pipeline_primitive(VkPrimitiveTopology vk_prim) +{ + return v3d_hw_prim_type(vk_to_mesa_prim[vk_prim]); +} + static const enum pipe_logicop vk_to_pipe_logicop[] = { [VK_LOGIC_OP_CLEAR] = PIPE_LOGICOP_CLEAR, [VK_LOGIC_OP_AND] = PIPE_LOGICOP_AND, diff --git a/src/broadcom/vulkan/v3dv_private.h b/src/broadcom/vulkan/v3dv_private.h index d54b1f3cff95b..892afcf3ab859 100644 --- a/src/broadcom/vulkan/v3dv_private.h +++ b/src/broadcom/vulkan/v3dv_private.h @@ -2705,6 +2705,8 @@ v3dv_compute_ez_state(struct vk_dynamic_graphics_state *dyn, enum v3dv_ez_state *ez_state, bool *incompatible_ez_test); +uint32_t v3dv_pipeline_primitive(VkPrimitiveTopology vk_prim); + #if DETECT_OS_ANDROID VkResult v3dv_gralloc_to_drm_explicit_layout(struct u_gralloc *gralloc, diff --git a/src/broadcom/vulkan/v3dvx_cmd_buffer.c b/src/broadcom/vulkan/v3dvx_cmd_buffer.c index 4d3edaa863633..4adb1cd407ea2 100644 --- a/src/broadcom/vulkan/v3dvx_cmd_buffer.c +++ b/src/broadcom/vulkan/v3dvx_cmd_buffer.c @@ -2612,13 +2612,9 @@ v3dX(cmd_buffer_emit_draw)(struct v3dv_cmd_buffer *cmd_buffer, { struct v3dv_job *job = cmd_buffer->state.job; assert(job); - - struct v3dv_cmd_buffer_state *state = &cmd_buffer->state; - struct v3dv_pipeline *pipeline = state->gfx.pipeline; - - assert(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); if (info->first_instance > 0) { v3dv_cl_ensure_space_with_branch( @@ -2773,7 +2769,9 @@ v3dX(cmd_buffer_emit_indexed_indirect)(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; v3dv_cl_ensure_space_with_branch(