diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 3036cd76a05..b41799a1666 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -3677,6 +3677,11 @@ typedef enum { */ nir_io_mediump_is_32bit = BITFIELD_BIT(3), + /** + * Whether nir_opt_vectorize_io should ignore FS inputs. + */ + nir_io_prefer_scalar_fs_inputs = BITFIELD_BIT(4), + /* Options affecting the GLSL compiler are below. */ /** diff --git a/src/compiler/nir/nir_opt_vectorize_io.c b/src/compiler/nir/nir_opt_vectorize_io.c index 5306f2112ae..7c2381e4466 100644 --- a/src/compiler/nir/nir_opt_vectorize_io.c +++ b/src/compiler/nir/nir_opt_vectorize_io.c @@ -439,6 +439,10 @@ nir_opt_vectorize_io(nir_shader *shader, nir_variable_mode modes) { assert(!(modes & ~(nir_var_shader_in | nir_var_shader_out))); + if (shader->info.stage == MESA_SHADER_FRAGMENT && + shader->options->io_options & nir_io_prefer_scalar_fs_inputs) + modes &= ~nir_var_shader_in; + if ((shader->info.stage == MESA_SHADER_TESS_CTRL || shader->info.stage == MESA_SHADER_GEOMETRY) && util_bitcount(modes) == 2) { diff --git a/src/gallium/drivers/radeonsi/si_get.c b/src/gallium/drivers/radeonsi/si_get.c index 75ced1f09ae..a9ac90dca52 100644 --- a/src/gallium/drivers/radeonsi/si_get.c +++ b/src/gallium/drivers/radeonsi/si_get.c @@ -1570,6 +1570,7 @@ void si_init_screen_get_functions(struct si_screen *sscreen) */ options->force_f2f16_rtz = true; options->io_options = nir_io_has_flexible_input_interpolation_except_flat | + nir_io_prefer_scalar_fs_inputs | nir_io_glsl_lower_derefs | (sscreen->options.optimize_io ? nir_io_glsl_opt_varyings : 0); options->lower_mediump_io = sscreen->info.gfx_level >= GFX8 && sscreen->options.fp16 ?