nir/i915g/r300/nv30: skip marking varyings as flat in some drivers

Some older drivers don't support GLSL versions with the concept of flat
varyings and also don't support integers. Here we add a new setting to
make sure we don't use the optimisation that sets varyings to flat.
This setting helps us avoid marking varyings as flat and therefore
potentially having them changed to ints via varying packing.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6500
Fixes: 7647023f3b ("glsl: enable the use of the nir based varying linker")

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16573>
This commit is contained in:
Timothy Arceri 2022-05-18 12:00:30 +10:00 committed by Marge Bot
parent 2f38adda63
commit c4cec84231
5 changed files with 15 additions and 1 deletions

View file

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

View file

@ -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;
}

View file

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

View file

@ -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,
};

View file

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