tu: Rewrite tess factor emission

Emit it at EndRenderPass time, if the renderpass has tessellation. This
avoids all the special handling for secondaries, will work with
suspended/resumed render passes, and will handle secondaries that
contain render passes which will be allowed with dynamic rendering.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17378>
This commit is contained in:
Connor Abbott 2022-07-14 18:25:58 +02:00 committed by Marge Bot
parent c5be444500
commit 907b892bb2
1 changed files with 3 additions and 12 deletions

View File

@ -75,8 +75,6 @@ tu6_lazy_emit_tessfactor_addr(struct tu_cmd_buffer *cmd)
if (cmd->state.tessfactor_addr_set)
return;
assert(cmd->vk.level == VK_COMMAND_BUFFER_LEVEL_PRIMARY);
tu_cs_emit_regs(&cmd->cs, A6XX_PC_TESSFACTOR_ADDR(.qword = cmd->device->tess_bo->iova));
cmd->state.tessfactor_addr_set = true;
}
@ -2378,12 +2376,6 @@ tu_CmdBindPipeline(VkCommandBuffer commandBuffer,
if (pipeline->active_stages & VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT) {
cmd->state.has_tess = true;
/* Set up the tess factor address if this is the first tess pipeline bound
* to the primary cmdbuf.
*/
if (cmd->vk.level == VK_COMMAND_BUFFER_LEVEL_PRIMARY)
tu6_lazy_emit_tessfactor_addr(cmd);
/* maximum number of patches that can fit in tess factor/param buffers */
uint32_t subdraw_size = MIN2(TU_TESS_FACTOR_SIZE / ir3_tess_factor_stride(pipeline->tess.patch_type),
TU_TESS_PARAM_SIZE / pipeline->tess.param_stride);
@ -3356,11 +3348,7 @@ tu_CmdExecuteCommands(VkCommandBuffer commandBuffer,
break;
}
/* Set up the tess factor address if this is the first time a tess
* pipeline has been executed on this primary cmdbuf.
*/
if (secondary->state.has_tess) {
tu6_lazy_emit_tessfactor_addr(cmd);
cmd->state.has_tess = true;
}
if (secondary->state.has_subpass_predication)
@ -4721,6 +4709,9 @@ tu_CmdEndRenderPass2(VkCommandBuffer commandBuffer,
cmd_buffer->trace_renderpass_end = u_trace_end_iterator(&cmd_buffer->trace);
if (cmd_buffer->state.has_tess)
tu6_lazy_emit_tessfactor_addr(cmd_buffer);
struct tu_renderpass_result *autotune_result = NULL;
if (use_sysmem_rendering(cmd_buffer, &autotune_result))
tu_cmd_render_sysmem(cmd_buffer, autotune_result);