Module: Mesa Branch: main Commit: e2af0b0b3f31b7e80f262305c6fade1f384e2fe1 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e2af0b0b3f31b7e80f262305c6fade1f384e2fe1
Author: Qiang Yu <[email protected]> Date: Tue Aug 29 14:21:08 2023 +0800 aco: add create_end_for_merged_shader For radeonsi merged shader LS/ES part to pass args to next stage. 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 | 29 +++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/amd/compiler/aco_instruction_selection.cpp b/src/amd/compiler/aco_instruction_selection.cpp index 03f49fe3600..42f5cfc65e9 100644 --- a/src/amd/compiler/aco_instruction_selection.cpp +++ b/src/amd/compiler/aco_instruction_selection.cpp @@ -11747,6 +11747,30 @@ create_merged_jump_to_epilog(isel_context* ctx) ctx->block->instructions.emplace_back(std::move(jump)); } +static void +create_end_for_merged_shader(isel_context* ctx) +{ + std::vector<Operand> regs; + + unsigned max_args; + if (ctx->stage.sw == SWStage::VS) { + assert(ctx->args->vertex_id.used); + max_args = ctx->args->vertex_id.arg_index; + } else { + assert(ctx->stage.sw == SWStage::TES); + assert(ctx->args->tes_u.used); + max_args = ctx->args->tes_u.arg_index; + } + + struct ac_arg arg; + arg.used = true; + + for (arg.arg_index = 0; arg.arg_index < max_args; arg.arg_index++) + regs.emplace_back(get_arg_for_end(ctx, arg)); + + build_end_with_regs(ctx, regs); +} + void select_shader(isel_context& ctx, nir_shader* nir, const bool need_startpgm, const bool need_barrier, if_context* ic_merged_wave_info, const bool check_merged_wave_info, @@ -11828,7 +11852,10 @@ select_shader(isel_context& ctx, nir_shader* nir, const bool need_startpgm, cons if (ctx.program->info.merged_shader_compiled_separately && (ctx.stage.sw == SWStage::VS || ctx.stage.sw == SWStage::TES)) { assert(program->gfx_level >= GFX9); - create_merged_jump_to_epilog(&ctx); + if (ctx.options->is_opengl) + create_end_for_merged_shader(&ctx); + else + create_merged_jump_to_epilog(&ctx); } cleanup_context(&ctx);
