summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTimothy Arceri <tarceri@itsqueeze.com>2022-05-18 12:00:30 +1000
committerMarge Bot <emma+marge@anholt.net>2022-05-19 01:05:32 +0000
commitc4cec842315313a24342d1d9a4dbd4ad11fbdd6c (patch)
treec85eb0b32b50c2cb35f9ce22f8595a47fb240193 /src
parent2f38adda6383f426195f435fadb5c3b0c9fc1659 (diff)
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: 7647023f3bb5 ("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>
Diffstat (limited to 'src')
-rw-r--r--src/compiler/nir/nir.h7
-rw-r--r--src/compiler/nir/nir_linking_helpers.c3
-rw-r--r--src/gallium/drivers/i915/i915_screen.c1
-rw-r--r--src/gallium/drivers/nouveau/nv30/nv30_screen.c1
-rw-r--r--src/gallium/drivers/r300/r300_screen.c4
5 files changed, 15 insertions, 1 deletions
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 *