From b16cf6c4c66f39bfef5b6dc7d5f5110b88ef813d Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Tue, 3 Sep 2019 17:48:07 +0200 Subject: [PATCH] radv: move ac_fill_shader_info() to radv_nir_shader_info_pass() Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen --- src/amd/vulkan/radv_nir_to_llvm.c | 45 ------------------------------- src/amd/vulkan/radv_shader_info.c | 38 ++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 45 deletions(-) diff --git a/src/amd/vulkan/radv_nir_to_llvm.c b/src/amd/vulkan/radv_nir_to_llvm.c index 43b2ea9cb12..dd31b848961 100644 --- a/src/amd/vulkan/radv_nir_to_llvm.c +++ b/src/amd/vulkan/radv_nir_to_llvm.c @@ -4498,48 +4498,6 @@ static void ac_compile_llvm_module(struct ac_llvm_compiler *ac_llvm, free(elf_buffer); } -static void -ac_fill_shader_info(struct radv_shader_info *shader_info, struct nir_shader *nir, const struct radv_nir_compiler_options *options) -{ - switch (nir->info.stage) { - case MESA_SHADER_COMPUTE: - for (int i = 0; i < 3; ++i) - shader_info->cs.block_size[i] = nir->info.cs.local_size[i]; - break; - case MESA_SHADER_FRAGMENT: - shader_info->ps.can_discard = nir->info.fs.uses_discard; - shader_info->ps.early_fragment_test = nir->info.fs.early_fragment_tests; - shader_info->ps.post_depth_coverage = nir->info.fs.post_depth_coverage; - break; - case MESA_SHADER_GEOMETRY: - shader_info->gs.vertices_in = nir->info.gs.vertices_in; - shader_info->gs.vertices_out = nir->info.gs.vertices_out; - shader_info->gs.output_prim = nir->info.gs.output_primitive; - shader_info->gs.invocations = nir->info.gs.invocations; - break; - case MESA_SHADER_TESS_EVAL: - shader_info->tes.primitive_mode = nir->info.tess.primitive_mode; - shader_info->tes.spacing = nir->info.tess.spacing; - shader_info->tes.ccw = nir->info.tess.ccw; - shader_info->tes.point_mode = nir->info.tess.point_mode; - shader_info->tes.as_es = options->key.vs_common_out.as_es; - shader_info->tes.export_prim_id = options->key.vs_common_out.export_prim_id; - shader_info->is_ngg = options->key.vs_common_out.as_ngg; - break; - case MESA_SHADER_TESS_CTRL: - shader_info->tcs.tcs_vertices_out = nir->info.tess.tcs_vertices_out; - break; - case MESA_SHADER_VERTEX: - shader_info->vs.as_es = options->key.vs_common_out.as_es; - shader_info->vs.as_ls = options->key.vs_common_out.as_ls; - shader_info->vs.export_prim_id = options->key.vs_common_out.export_prim_id; - shader_info->is_ngg = options->key.vs_common_out.as_ngg; - break; - default: - break; - } -} - void radv_compile_nir_shader(struct ac_llvm_compiler *ac_llvm, struct radv_shader_binary **rbinary, @@ -4560,9 +4518,6 @@ radv_compile_nir_shader(struct ac_llvm_compiler *ac_llvm, nir[nir_count - 1]->info.stage), options); - for (int i = 0; i < nir_count; ++i) - ac_fill_shader_info(shader_info, nir[i], options); - /* Determine the ES type (VS or TES) for the GS on GFX9. */ if (options->chip_class >= GFX9) { if (nir_count == 2 && diff --git a/src/amd/vulkan/radv_shader_info.c b/src/amd/vulkan/radv_shader_info.c index 8b608826a14..33ee0727373 100644 --- a/src/amd/vulkan/radv_shader_info.c +++ b/src/amd/vulkan/radv_shader_info.c @@ -638,4 +638,42 @@ radv_nir_shader_info_pass(const struct nir_shader *nir, if (nir->info.stage == MESA_SHADER_FRAGMENT) info->ps.num_interp = nir->num_inputs; + + switch (nir->info.stage) { + case MESA_SHADER_COMPUTE: + for (int i = 0; i < 3; ++i) + info->cs.block_size[i] = nir->info.cs.local_size[i]; + break; + case MESA_SHADER_FRAGMENT: + info->ps.can_discard = nir->info.fs.uses_discard; + info->ps.early_fragment_test = nir->info.fs.early_fragment_tests; + info->ps.post_depth_coverage = nir->info.fs.post_depth_coverage; + break; + case MESA_SHADER_GEOMETRY: + info->gs.vertices_in = nir->info.gs.vertices_in; + info->gs.vertices_out = nir->info.gs.vertices_out; + info->gs.output_prim = nir->info.gs.output_primitive; + info->gs.invocations = nir->info.gs.invocations; + break; + case MESA_SHADER_TESS_EVAL: + info->tes.primitive_mode = nir->info.tess.primitive_mode; + info->tes.spacing = nir->info.tess.spacing; + info->tes.ccw = nir->info.tess.ccw; + info->tes.point_mode = nir->info.tess.point_mode; + info->tes.as_es = options->key.vs_common_out.as_es; + info->tes.export_prim_id = options->key.vs_common_out.export_prim_id; + info->is_ngg = options->key.vs_common_out.as_ngg; + break; + case MESA_SHADER_TESS_CTRL: + info->tcs.tcs_vertices_out = nir->info.tess.tcs_vertices_out; + break; + case MESA_SHADER_VERTEX: + info->vs.as_es = options->key.vs_common_out.as_es; + info->vs.as_ls = options->key.vs_common_out.as_ls; + info->vs.export_prim_id = options->key.vs_common_out.export_prim_id; + info->is_ngg = options->key.vs_common_out.as_ngg; + break; + default: + break; + } } -- 2.30.2