summaryrefslogtreecommitdiffstats
path: root/src/glsl/lower_ubo_reference.cpp
diff options
context:
space:
mode:
authorSamuel Iglesias Gonsalvez <[email protected]>2015-10-19 10:37:14 +0200
committerSamuel Iglesias Gonsalvez <[email protected]>2015-10-19 11:16:50 +0200
commit6f3954618b0fe273af76af79ce9ec56566b79b2a (patch)
treedea06bc802c2861b03ac054e4faf7d0a2c333ff4 /src/glsl/lower_ubo_reference.cpp
parentb0a44f1017be51c3eb612da2a6ccd5df5695c25a (diff)
glsl: fix segfault when indirect indexing a buffer variable which is an array
Fixes a regression added by bb5aeb854915ba67abc56257f830d002c956439e. Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/glsl/lower_ubo_reference.cpp')
-rw-r--r--src/glsl/lower_ubo_reference.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/glsl/lower_ubo_reference.cpp b/src/glsl/lower_ubo_reference.cpp
index 1fbb09de0b1..e818c048461 100644
--- a/src/glsl/lower_ubo_reference.cpp
+++ b/src/glsl/lower_ubo_reference.cpp
@@ -284,7 +284,8 @@ interface_field_name(void *mem_ctx, char *base_name, ir_rvalue *d,
if (array_index->type != glsl_type::uint_type)
array_index = i2u(array_index);
- if (a->array->type->fields.array->is_array()) {
+ if (a->array->type->is_array() &&
+ a->array->type->fields.array->is_array()) {
ir_constant *base_size = new(mem_ctx)
ir_constant(a->array->type->fields.array->arrays_of_arrays_size());
array_index = mul(array_index, base_size);