radeonsi/nir: simplify si_lower_nir signature
authorMarek Olšák <marek.olsak@amd.com>
Thu, 26 Sep 2019 23:54:09 +0000 (19:54 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 16 Oct 2019 01:52:09 +0000 (21:52 -0400)
just a cleanup

src/gallium/drivers/radeonsi/si_compute.c
src/gallium/drivers/radeonsi/si_shader.h
src/gallium/drivers/radeonsi/si_shader_nir.c
src/gallium/drivers/radeonsi/si_state_shaders.c

index e9876ef..ba8271d 100644 (file)
@@ -128,7 +128,7 @@ static void si_create_compute_state_async(void *job, int thread_index)
 
                si_nir_opts(sel->nir);
                si_nir_scan_shader(sel->nir, &sel->info);
-               si_lower_nir(sel);
+               si_lower_nir(sel->screen, sel->nir);
        }
 
        /* Store the declared LDS size into tgsi_shader_info for the shader
index f71cb04..cb8d6db 100644 (file)
@@ -757,7 +757,7 @@ void si_nir_scan_shader(const struct nir_shader *nir,
 void si_nir_scan_tess_ctrl(const struct nir_shader *nir,
                           struct tgsi_tessctrl_info *out);
 void si_nir_lower_ps_inputs(struct nir_shader *nir);
-void si_lower_nir(struct si_shader_selector *sel);
+void si_lower_nir(struct si_screen *sscreen, struct nir_shader *nir);
 void si_nir_opts(struct nir_shader *nir);
 
 /* si_state_shaders.c */
index e97e5cc..aa82a7b 100644 (file)
@@ -942,21 +942,21 @@ void si_nir_lower_ps_inputs(struct nir_shader *nir)
  * Perform "lowering" operations on the NIR that are run once when the shader
  * selector is created.
  */
-void si_lower_nir(struct si_shader_selector *sel)
+void si_lower_nir(struct si_screen *sscreen, struct nir_shader *nir)
 {
        /* Adjust the driver location of inputs and outputs. The state tracker
         * interprets them as slots, while the ac/nir backend interprets them
         * as individual components.
         */
-       if (sel->nir->info.stage != MESA_SHADER_FRAGMENT) {
-               nir_foreach_variable(variable, &sel->nir->inputs)
+       if (nir->info.stage != MESA_SHADER_FRAGMENT) {
+               nir_foreach_variable(variable, &nir->inputs)
                        variable->data.driver_location *= 4;
        }
 
-       nir_foreach_variable(variable, &sel->nir->outputs) {
+       nir_foreach_variable(variable, &nir->outputs) {
                variable->data.driver_location *= 4;
 
-               if (sel->nir->info.stage == MESA_SHADER_FRAGMENT) {
+               if (nir->info.stage == MESA_SHADER_FRAGMENT) {
                        if (variable->data.location == FRAG_RESULT_DEPTH)
                                variable->data.driver_location += 2;
                        else if (variable->data.location == FRAG_RESULT_STENCIL)
@@ -975,7 +975,7 @@ void si_lower_nir(struct si_shader_selector *sel)
        static const struct nir_lower_tex_options lower_tex_options = {
                .lower_txp = ~0u,
        };
-       NIR_PASS_V(sel->nir, nir_lower_tex, &lower_tex_options);
+       NIR_PASS_V(nir, nir_lower_tex, &lower_tex_options);
 
        const nir_lower_subgroups_options subgroups_options = {
                .subgroup_size = 64,
@@ -985,25 +985,25 @@ void si_lower_nir(struct si_shader_selector *sel)
                .lower_vote_trivial = false,
                .lower_vote_eq_to_ballot = true,
        };
-       NIR_PASS_V(sel->nir, nir_lower_subgroups, &subgroups_options);
+       NIR_PASS_V(nir, nir_lower_subgroups, &subgroups_options);
 
        /* Lower load constants to scalar and then clean up the mess */
-       NIR_PASS_V(sel->nir, nir_lower_load_const_to_scalar);
-       NIR_PASS_V(sel->nir, nir_lower_var_copies);
-       si_nir_opts(sel->nir);
+       NIR_PASS_V(nir, nir_lower_load_const_to_scalar);
+       NIR_PASS_V(nir, nir_lower_var_copies);
+       si_nir_opts(nir);
 
        /* Lower large variables that are always constant with load_constant
         * intrinsics, which get turned into PC-relative loads from a data
         * section next to the shader.
         */
-       NIR_PASS_V(sel->nir, nir_opt_large_constants,
+       NIR_PASS_V(nir, nir_opt_large_constants,
                   glsl_get_natural_size_align_bytes, 16);
 
-       ac_lower_indirect_derefs(sel->nir, sel->screen->info.chip_class);
+       ac_lower_indirect_derefs(nir, sscreen->info.chip_class);
 
-       si_nir_opts(sel->nir);
+       si_nir_opts(nir);
 
-       NIR_PASS_V(sel->nir, nir_lower_bool_to_int32);
+       NIR_PASS_V(nir, nir_lower_bool_to_int32);
 }
 
 static void declare_nir_input_vs(struct si_shader_context *ctx,
index b2071a2..04ff331 100644 (file)
@@ -2473,7 +2473,7 @@ static void si_init_shader_selector_async(void *job, int thread_index)
        compiler = &sscreen->compiler[thread_index];
 
        if (sel->nir)
-               si_lower_nir(sel);
+               si_lower_nir(sel->screen, sel->nir);
 
        /* Compile the main shader part for use with a prolog and/or epilog.
         * If this fails, the driver will try to compile a monolithic shader