summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2018-07-05 14:34:27 -0700
committerKenneth Graunke <[email protected]>2019-02-05 13:58:46 -0800
commit15c69021176395a08febde51ce14a43a15fee07d (patch)
tree90ba3e4dc3628434575818759ec218ca2960c788
parentba9dcc80fb2fc103835eef17153895f403d8654e (diff)
nir: Avoid splitting compact arrays into per-element variables.
Compact arrays are used for special variables like clip and cull distances, or tessellation levels. Drivers using compact arrays assume that these values will always be actual arrays. We don't want to turn a float[1] gl_CullDistance into a single float; that would confuse drivers. Today, i965 uses compact arrays, and Gallium drivers use nir_lower_io_arrays_to_elements, so we haven't had any overlap that would demonstrate the issue. Iris will use both. Reviewed-by: Timothy Arceri <[email protected]>
-rw-r--r--src/compiler/nir/nir_lower_io_arrays_to_elements.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_lower_io_arrays_to_elements.c b/src/compiler/nir/nir_lower_io_arrays_to_elements.c
index 73b6810b763..5fbde081476 100644
--- a/src/compiler/nir/nir_lower_io_arrays_to_elements.c
+++ b/src/compiler/nir/nir_lower_io_arrays_to_elements.c
@@ -291,6 +291,10 @@ lower_io_arrays_to_elements(nir_shader *shader, nir_variable_mode mask,
nir_variable *var = nir_deref_instr_get_variable(deref);
+ /* Drivers assume compact arrays are, in fact, arrays. */
+ if (var->data.compact)
+ continue;
+
/* Skip indirects */
uint64_t loc_mask = ((uint64_t)1) << var->data.location;
if (var->data.patch) {