From a34bbb41c036a1a26ae71a39ee84223d3b5803db Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Wed, 29 Apr 2026 11:33:41 +0100 Subject: [PATCH] radv: inline shader_compile() Signed-off-by: Rhys Perry Reviewed-by: Samuel Pitoiset Part-of: --- src/amd/vulkan/radv_shader.c | 51 ++++++++++++++---------------------- 1 file changed, 20 insertions(+), 31 deletions(-) diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c index 5ba9102d7c0..6193befa821 100644 --- a/src/amd/vulkan/radv_shader.c +++ b/src/amd/vulkan/radv_shader.c @@ -3309,26 +3309,38 @@ radv_set_stage_key_robustness(const struct vk_pipeline_robustness_state *rs, mes key->vertex_robustness1 = 1u; } -static struct radv_shader_binary * -shader_compile(const struct radv_compiler_info *compiler_info, struct nir_shader *const *shaders, int shader_count, - mesa_shader_stage stage, const struct radv_shader_info *info, const struct radv_shader_args *args, - const struct radv_shader_stage_key *stage_key, struct radv_nir_compiler_options *options) +struct radv_shader_binary * +radv_shader_nir_to_asm(const struct radv_compiler_info *compiler_info, struct radv_shader_stage *pl_stage, + struct nir_shader *const *shaders, int shader_count, + const struct radv_graphics_state_key *gfx_state, bool keep_shader_info, bool keep_statistic_info) { - struct radv_shader_binary *binary = NULL; + mesa_shader_stage stage = shaders[shader_count - 1]->info.stage; + struct radv_shader_info *info = &pl_stage->info; + const struct radv_shader_args *args = &pl_stage->args; + bool dump_shader = false; + for (unsigned i = 0; i < shader_count; ++i) + dump_shader |= radv_can_dump_shader(compiler_info, shaders[i]); + + struct radv_nir_compiler_options options = {0}; + radv_fill_nir_compiler_options(compiler_info, &options, gfx_state, + radv_should_use_wgp_mode(compiler_info->ac->gfx_level, stage, info), dump_shader, + keep_shader_info, keep_statistic_info); + + struct radv_shader_binary *binary = NULL; #if AMD_LLVM_AVAILABLE - if (compiler_info->key.use_llvm || options->dump_shader || options->record_ir) + if (compiler_info->key.use_llvm || options.dump_shader || options.record_ir) ac_init_llvm_once(); if (compiler_info->key.use_llvm) { - llvm_compile_shader(options, info, shader_count, shaders, &binary, args); + llvm_compile_shader(&options, info, shader_count, shaders, &binary, args); #else if (false) { #endif } else { struct aco_shader_info ac_info; struct aco_compiler_options ac_opts; - radv_aco_convert_opts(&ac_opts, options, args, stage_key); + radv_aco_convert_opts(&ac_opts, &options, args, &pl_stage->key); radv_aco_convert_shader_info(&ac_info, info, args, compiler_info); aco_compile_shader(&ac_opts, &ac_info, shader_count, shaders, &args->ac, &radv_aco_build_shader_binary, (void **)&binary); @@ -3344,29 +3356,6 @@ shader_compile(const struct radv_compiler_info *compiler_info, struct nir_shader return binary; } -struct radv_shader_binary * -radv_shader_nir_to_asm(const struct radv_compiler_info *compiler_info, struct radv_shader_stage *pl_stage, - struct nir_shader *const *shaders, int shader_count, - const struct radv_graphics_state_key *gfx_state, bool keep_shader_info, bool keep_statistic_info) -{ - mesa_shader_stage stage = shaders[shader_count - 1]->info.stage; - struct radv_shader_info *info = &pl_stage->info; - - bool dump_shader = false; - for (unsigned i = 0; i < shader_count; ++i) - dump_shader |= radv_can_dump_shader(compiler_info, shaders[i]); - - struct radv_nir_compiler_options options = {0}; - radv_fill_nir_compiler_options(compiler_info, &options, gfx_state, - radv_should_use_wgp_mode(compiler_info->ac->gfx_level, stage, info), dump_shader, - keep_shader_info, keep_statistic_info); - - struct radv_shader_binary *binary = - shader_compile(compiler_info, shaders, shader_count, stage, info, &pl_stage->args, &pl_stage->key, &options); - - return binary; -} - void radv_shader_dump_asm(const struct radv_compiler_info *compiler_info, const struct radv_shader_debug_info *debug, const struct radv_shader_info *info)