Module: Mesa Branch: main Commit: 0a102d3fd694ae7a70d1a7c4398c7fcea7b10924 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0a102d3fd694ae7a70d1a7c4398c7fcea7b10924
Author: Samuel Pitoiset <[email protected]> Date: Thu Aug 3 15:09:25 2023 +0200 radv: track if patch control points is dynamic from the cmdbuf state This allows us to remove one more pipeline occurence during cmdbuf recording. Note that patch control points is always dynamic with shader object. Signed-off-by: Samuel Pitoiset <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24473> --- src/amd/vulkan/radv_cmd_buffer.c | 11 +++++++---- src/amd/vulkan/radv_private.h | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c index 53c9640c5da..b5a27b08ee1 100644 --- a/src/amd/vulkan/radv_cmd_buffer.c +++ b/src/amd/vulkan/radv_cmd_buffer.c @@ -2511,10 +2511,10 @@ radv_emit_patch_control_points(struct radv_cmd_buffer *cmd_buffer) const struct radv_dynamic_state *d = &cmd_buffer->state.dynamic; unsigned ls_hs_config, base_reg; - /* Compute tessellation info that depends on the number of patch control points - * when the bound pipeline declared this state as dynamic. + /* Compute tessellation info that depends on the number of patch control points when this state + * is dynamic. */ - if (cmd_buffer->state.graphics_pipeline->dynamic_states & RADV_DYNAMIC_PATCH_CONTROL_POINTS) { + if (cmd_buffer->state.uses_dynamic_patch_control_points) { /* Compute the number of patches. */ cmd_buffer->state.tess_num_patches = get_tcs_num_patches( d->vk.ts.patch_control_points, tcs->info.tcs.tcs_vertices_out, tcs->info.tcs.num_linked_inputs, @@ -6610,8 +6610,11 @@ radv_CmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipeline cmd_buffer->state.flush_bits |= RADV_CMD_FLAG_VGT_FLUSH; } + cmd_buffer->state.uses_dynamic_patch_control_points = + !!(graphics_pipeline->dynamic_states & RADV_DYNAMIC_PATCH_CONTROL_POINTS); + if (graphics_pipeline->active_stages & VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT) { - if (!(graphics_pipeline->dynamic_states & RADV_DYNAMIC_PATCH_CONTROL_POINTS)) { + if (!cmd_buffer->state.uses_dynamic_patch_control_points) { /* Bind the tessellation state from the pipeline when it's not dynamic. */ struct radv_shader *tcs = cmd_buffer->state.shaders[MESA_SHADER_TESS_CTRL]; diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h index 76ae267d36a..ca8373dd367 100644 --- a/src/amd/vulkan/radv_private.h +++ b/src/amd/vulkan/radv_private.h @@ -1758,6 +1758,7 @@ struct radv_cmd_state { bool uses_out_of_order_rast; bool uses_vrs_attachment; + bool uses_dynamic_patch_control_points; }; struct radv_cmd_buffer_upload {
