diff options
author | Jason Ekstrand <[email protected]> | 2015-04-10 17:38:17 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2015-04-22 18:10:41 -0700 |
commit | d61bd972d861d9246fe7f9de71158aa79368bb79 (patch) | |
tree | bb3ff12f23ab5d33545d7a4b524cb5196c8c72cc /src/glsl/nir/nir_lower_locals_to_regs.c | |
parent | 06f3c98b9da35b5f5c02bd30599fbde57a19520e (diff) |
nir/locals_to_regs: Hanadle indirect accesses of length-1 arrays
Reviewed-by: Connor Abbott <[email protected]>
Diffstat (limited to 'src/glsl/nir/nir_lower_locals_to_regs.c')
-rw-r--r-- | src/glsl/nir/nir_lower_locals_to_regs.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/glsl/nir/nir_lower_locals_to_regs.c b/src/glsl/nir/nir_lower_locals_to_regs.c index 48459f735ab..bc6a3d320c4 100644 --- a/src/glsl/nir/nir_lower_locals_to_regs.c +++ b/src/glsl/nir/nir_lower_locals_to_regs.c @@ -135,6 +135,14 @@ get_deref_reg_src(nir_deref_var *deref, nir_instr *instr, src.reg.base_offset = 0; src.reg.indirect = NULL; + /* It is possible for a user to create a shader that has an array with a + * single element and then proceed to access it indirectly. Indirectly + * accessing a non-array register is not allowed in NIR. In order to + * handle this case we just convert it to a direct reference. + */ + if (src.reg.reg->num_array_elems == 0) + return src; + nir_deref *tail = &deref->deref; while (tail->child != NULL) { const struct glsl_type *parent_type = tail->type; |