diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 968aa78ade3..329d642300e 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -3583,6 +3583,13 @@ typedef struct nir_shader_compiler_options { */ bool force_indirect_unrolling_sampler; + /* Some older drivers don't support GLSL versions with the concept of flat + * varyings and also don't support integers. This setting helps us avoid + * marking varyings as flat and potentially having them changed to ints via + * varying packing. + */ + bool no_integers; + /** * Specifies which type of indirectly accessed variables should force * loop unrolling. diff --git a/src/compiler/nir/nir_linking_helpers.c b/src/compiler/nir/nir_linking_helpers.c index 7c21b63dc19..613b4244e56 100644 --- a/src/compiler/nir/nir_linking_helpers.c +++ b/src/compiler/nir/nir_linking_helpers.c @@ -1392,7 +1392,8 @@ nir_link_opt_varyings(nir_shader *producer, nir_shader *consumer) /* The varying is loaded from same uniform, so no need to do any * interpolation. Mark it as flat explicitly. */ - if (in_var && in_var->data.interpolation <= INTERP_MODE_NOPERSPECTIVE) { + if (!consumer->options->no_integers && + in_var && in_var->data.interpolation <= INTERP_MODE_NOPERSPECTIVE) { in_var->data.interpolation = INTERP_MODE_FLAT; out_var->data.interpolation = INTERP_MODE_FLAT; } diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c index d359209fd9f..d6f3acb752a 100644 --- a/src/gallium/drivers/i915/i915_screen.c +++ b/src/gallium/drivers/i915/i915_screen.c @@ -123,6 +123,7 @@ static const nir_shader_compiler_options i915_compiler_options = { .force_indirect_unrolling = nir_var_all, .force_indirect_unrolling_sampler = true, .max_unroll_iterations = 32, + .no_integers = true, }; static const struct nir_shader_compiler_options gallivm_nir_options = { diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c index ac502110f69..480a3f2482a 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c @@ -498,6 +498,7 @@ static const nir_shader_compiler_options nv30_base_compiler_options = { .lower_vector_cmp = true, .force_indirect_unrolling_sampler = true, .max_unroll_iterations = 32, + .no_integers = true, .use_interpolated_input_intrinsics = true, }; diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index a6cd784d66d..05c0ca28a63 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -515,6 +515,7 @@ static const nir_shader_compiler_options r500_vs_compiler_options = { .max_unroll_iterations = 32, .use_interpolated_input_intrinsics = true, + .no_integers = true, }; static const nir_shader_compiler_options r500_fs_compiler_options = { @@ -543,6 +544,7 @@ static const nir_shader_compiler_options r500_fs_compiler_options = { .max_unroll_iterations = 32, .use_interpolated_input_intrinsics = true, + .no_integers = true, }; static const nir_shader_compiler_options r300_vs_compiler_options = { @@ -570,6 +572,7 @@ static const nir_shader_compiler_options r300_vs_compiler_options = { .max_unroll_iterations = 32, .use_interpolated_input_intrinsics = true, + .no_integers = true, }; static const nir_shader_compiler_options r300_fs_compiler_options = { @@ -597,6 +600,7 @@ static const nir_shader_compiler_options r300_fs_compiler_options = { .max_unroll_iterations = 64, .use_interpolated_input_intrinsics = true, + .no_integers = true, }; static const void *