nir: replace lower_io_variables with a GLSL NIR flag

This stops using it in nir_lower_io_passes because all callers call it
only when it's true.

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26918>
This commit is contained in:
Marek Olšák
2023-12-30 16:27:07 -05:00
parent c4acab77a8
commit ecf0fe09f0
4 changed files with 14 additions and 13 deletions

View File

@@ -3564,6 +3564,14 @@ typedef enum {
* location, and then also as centroid, at_offset, and at_sample.
*/
nir_io_has_flexible_input_interpolation_except_flat = BITFIELD_BIT(0),
/* Options affecting the GLSL compiler are below. */
/**
* Lower load_deref/store_deref to load_input/store_output/etc. intrinsics.
* This is only affects GLSL compilation.
*/
nir_io_glsl_lower_derefs = BITFIELD_BIT(16),
} nir_io_options;
/** An instruction filtering callback
@@ -4012,16 +4020,10 @@ typedef struct nir_shader_compiler_options {
nir_lower_doubles_options lower_doubles_options;
nir_divergence_options divergence_analysis_options;
/**
* Lower load_deref/store_deref of inputs and outputs into
* load_input/store_input intrinsics. This is used by nir_lower_io_passes.
*/
bool lower_io_variables;
/**
* The masks of shader stages that support indirect indexing with
* load_input and store_output intrinsics. It's used when
* lower_io_variables is true. This is used by nir_lower_io_passes.
* load_input and store_output intrinsics. It's used by
* nir_lower_io_passes.
*/
uint8_t support_indirect_inputs;
uint8_t support_indirect_outputs;

View File

@@ -3190,8 +3190,7 @@ type_size_vec4(const struct glsl_type *type, bool bindless)
void
nir_lower_io_passes(nir_shader *nir, bool renumber_vs_inputs)
{
if (!nir->options->lower_io_variables ||
nir->info.stage == MESA_SHADER_COMPUTE)
if (nir->info.stage == MESA_SHADER_COMPUTE)
return;
bool has_indirect_inputs =

View File

@@ -1420,8 +1420,8 @@ void si_init_screen_get_functions(struct si_screen *sscreen)
* when execution mode is rtz instead of rtne.
*/
options->force_f2f16_rtz = true;
options->io_options = nir_io_has_flexible_input_interpolation_except_flat;
options->lower_io_variables = true;
options->io_options = nir_io_has_flexible_input_interpolation_except_flat |
nir_io_glsl_lower_derefs;
/* HW supports indirect indexing for: | Enabled in driver
* -------------------------------------------------------
* TCS inputs | Yes

View File

@@ -864,7 +864,7 @@ st_finalize_nir(struct st_context *st, struct gl_program *prog,
/* Lower load_deref/store_deref of inputs and outputs.
* This depends on st_nir_assign_varying_locations.
*/
if (nir->options->lower_io_variables) {
if (nir->options->io_options & nir_io_glsl_lower_derefs) {
nir_lower_io_passes(nir, false);
NIR_PASS(_, nir, nir_remove_dead_variables,
nir_var_shader_in | nir_var_shader_out, NULL);