From 65dd53ca9718babbcb63687b7cc457698a5b45ca Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Mon, 10 Oct 2022 17:16:09 +0200 Subject: [PATCH] radv: always re-emit patch control points when a pipeline with tess is bound We already re-emit this state when it's static. It could be dirtied conditionally but the number of parameters to check is not worth it. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7457 Fixes: eef1511437a ("radv: implement dynamic patch control points") Signed-off-by: Samuel Pitoiset Reviewed-By: Mike Blumenkrantz Part-of: --- src/amd/vulkan/radv_cmd_buffer.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c index 890256a..3c2c75d 100644 --- a/src/amd/vulkan/radv_cmd_buffer.c +++ b/src/amd/vulkan/radv_cmd_buffer.c @@ -5209,16 +5209,18 @@ radv_CmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipeline cmd_buffer->state.flush_bits |= RADV_CMD_FLAG_VGT_FLUSH; } - if (radv_pipeline_has_stage(graphics_pipeline, MESA_SHADER_TESS_CTRL) && - !(graphics_pipeline->dynamic_states & RADV_DYNAMIC_PATCH_CONTROL_POINTS)) { - /* Bind the tessellation state from the pipeline when it's not dynamic and make sure to - * emit it if the number of patches or the LDS size changed. - */ - struct radv_shader *tcs = graphics_pipeline->base.shaders[MESA_SHADER_TESS_CTRL]; + if (radv_pipeline_has_stage(graphics_pipeline, MESA_SHADER_TESS_CTRL)) { + if (!(graphics_pipeline->dynamic_states & RADV_DYNAMIC_PATCH_CONTROL_POINTS)) { + /* Bind the tessellation state from the pipeline when it's not dynamic. */ + struct radv_shader *tcs = graphics_pipeline->base.shaders[MESA_SHADER_TESS_CTRL]; - cmd_buffer->state.tess_num_patches = tcs->info.num_tess_patches; - cmd_buffer->state.tess_lds_size = tcs->info.tcs.num_lds_blocks; + cmd_buffer->state.tess_num_patches = tcs->info.num_tess_patches; + cmd_buffer->state.tess_lds_size = tcs->info.tcs.num_lds_blocks; + } + /* Always re-emit patch control points when a new pipeline with tessellation is bound + * because a bunch of parameters (user SGPRs, TCS vertices out, etc) can be different. + */ cmd_buffer->state.dirty |= RADV_CMD_DIRTY_DYNAMIC_PATCH_CONTROL_POINTS; } -- 2.7.4