diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 401316ab6b6..c34a8ba99a6 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -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; diff --git a/src/compiler/nir/nir_lower_io.c b/src/compiler/nir/nir_lower_io.c index 4ad7b9312e3..247282d8e9e 100644 --- a/src/compiler/nir/nir_lower_io.c +++ b/src/compiler/nir/nir_lower_io.c @@ -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 = diff --git a/src/gallium/drivers/radeonsi/si_get.c b/src/gallium/drivers/radeonsi/si_get.c index ad5b77d65ac..093a1af08e2 100644 --- a/src/gallium/drivers/radeonsi/si_get.c +++ b/src/gallium/drivers/radeonsi/si_get.c @@ -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 diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp index eef8cad5a6f..c2403e3b3e1 100644 --- a/src/mesa/state_tracker/st_glsl_to_nir.cpp +++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp @@ -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);