summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2018-12-13 14:33:41 -0600
committerJason Ekstrand <[email protected]>2018-12-18 13:13:28 -0600
commit3fe0363dda84011a35ae1e7ed0a8e6aea49ae2f2 (patch)
treee71b9526139d93e62151d8029fd97d62ae3456e3 /src/compiler
parent8cc0f92492152bb315838944f7803e94d2ce33d3 (diff)
nir/lower_io_arrays_to_elements: Look at derefs for modes
This is instead of looking all the way back to the variable which may not exist for all derefs. This makes this code properly ignore casts with modes other than the mode[s] we care about (where casts aren't allowed). Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/nir/nir_lower_io_arrays_to_elements.c13
1 files changed, 8 insertions, 5 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 f0bc487d6be..4453eaa1f48 100644
--- a/src/compiler/nir/nir_lower_io_arrays_to_elements.c
+++ b/src/compiler/nir/nir_lower_io_arrays_to_elements.c
@@ -229,11 +229,11 @@ create_indirects_mask(nir_shader *shader, uint64_t *indirects,
continue;
nir_deref_instr *deref = nir_src_as_deref(intr->src[0]);
- nir_variable *var = nir_deref_instr_get_variable(deref);
-
- if (var->data.mode != mode)
+ if (deref->mode != mode)
continue;
+ nir_variable *var = nir_deref_instr_get_variable(deref);
+
nir_deref_path path;
nir_deref_path_init(&path, deref, NULL);
@@ -278,8 +278,11 @@ lower_io_arrays_to_elements(nir_shader *shader, nir_variable_mode mask,
intr->intrinsic != nir_intrinsic_interp_deref_at_offset)
continue;
- nir_variable *var =
- nir_deref_instr_get_variable(nir_src_as_deref(intr->src[0]));
+ nir_deref_instr *deref = nir_src_as_deref(intr->src[0]);
+ if (!(deref->mode & mask))
+ continue;
+
+ nir_variable *var = nir_deref_instr_get_variable(deref);
/* Skip indirects */
uint64_t loc_mask = ((uint64_t)1) << var->data.location;