radv: move ac_fill_shader_info() to radv_nir_shader_info_pass()
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 3 Sep 2019 15:48:07 +0000 (17:48 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 6 Sep 2019 13:52:05 +0000 (15:52 +0200)
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_nir_to_llvm.c
src/amd/vulkan/radv_shader_info.c

index 43b2ea9cb12a3371b52f080451092b285b7e53b2..dd31b848961347b4cf61742335f57bf0fce174a1 100644 (file)
@@ -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 &&
index 8b608826a14b8f04eebfa6c5aed86b950951cee8..33ee072737362bde726393318c3e61b0b0333576 100644 (file)
@@ -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;
+        }
 }