nir: add a NIR option flag nir_io_prefer_scalar_fs_inputs

It's a NIR option because passing flags from radeonsi to the GLSL linker is
complicated.

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29406>
This commit is contained in:
Marek Olšák 2024-06-14 18:28:52 -04:00 committed by Marge Bot
parent 3622092614
commit 75777f1dc8
3 changed files with 10 additions and 0 deletions

View file

@ -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. */
/**

View file

@ -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) {

View file

@ -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 ?