Module: Mesa Branch: main Commit: 9c63138ae35ad1032cac4fd269fdf4d32a7ca164 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9c63138ae35ad1032cac4fd269fdf4d32a7ca164
Author: Qiang Yu <[email protected]> Date: Tue Aug 29 19:29:02 2023 +0800 aco: stop emit s_endpgm for first stage of merged shader Reviewed-by: Daniel Schürmann <[email protected]> Signed-off-by: Qiang Yu <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25631> --- src/amd/compiler/aco_instruction_selection.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/amd/compiler/aco_instruction_selection.cpp b/src/amd/compiler/aco_instruction_selection.cpp index 7971ab17042..8b4345ef7d5 100644 --- a/src/amd/compiler/aco_instruction_selection.cpp +++ b/src/amd/compiler/aco_instruction_selection.cpp @@ -11849,6 +11849,8 @@ select_shader(isel_context& ctx, nir_shader* nir, const bool need_startpgm, cons end_divergent_if(&ctx, ic_merged_wave_info); } + bool is_first_stage_of_merged_shader = false; + if (ctx.program->info.merged_shader_compiled_separately && (ctx.stage.sw == SWStage::VS || ctx.stage.sw == SWStage::TES)) { assert(program->gfx_level >= GFX9); @@ -11856,6 +11858,8 @@ select_shader(isel_context& ctx, nir_shader* nir, const bool need_startpgm, cons create_end_for_merged_shader(&ctx); else create_merged_jump_to_epilog(&ctx); + + is_first_stage_of_merged_shader = true; } cleanup_context(&ctx); @@ -11866,7 +11870,7 @@ select_shader(isel_context& ctx, nir_shader* nir, const bool need_startpgm, cons append_logical_end(ctx.block); ctx.block->kind |= block_kind_uniform; - if (!program->info.has_epilog || + if ((!program->info.has_epilog && !is_first_stage_of_merged_shader) || (nir->info.stage == MESA_SHADER_TESS_CTRL && program->gfx_level >= GFX9)) { Builder(program, ctx.block).sopp(aco_opcode::s_endpgm); }
