From: Marek Olšák Date: Thu, 26 Sep 2019 23:54:09 +0000 (-0400) Subject: radeonsi/nir: simplify si_lower_nir signature X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=268e0e01f372ccbb3501ce57084acbe18cb4a196;p=mesa.git radeonsi/nir: simplify si_lower_nir signature just a cleanup --- diff --git a/src/gallium/drivers/radeonsi/si_compute.c b/src/gallium/drivers/radeonsi/si_compute.c index e9876ef9b69..ba8271d3fe3 100644 --- a/src/gallium/drivers/radeonsi/si_compute.c +++ b/src/gallium/drivers/radeonsi/si_compute.c @@ -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 diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h index f71cb040e7a..cb8d6dbcced 100644 --- a/src/gallium/drivers/radeonsi/si_shader.h +++ b/src/gallium/drivers/radeonsi/si_shader.h @@ -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 */ diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c b/src/gallium/drivers/radeonsi/si_shader_nir.c index e97e5ccb07b..aa82a7bd371 100644 --- a/src/gallium/drivers/radeonsi/si_shader_nir.c +++ b/src/gallium/drivers/radeonsi/si_shader_nir.c @@ -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, diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index b2071a21b31..04ff331444b 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -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