glsl: fix segfault when indirect indexing a buffer variable which is an array
authorSamuel Iglesias Gonsalvez <siglesias@igalia.com>
Mon, 19 Oct 2015 08:37:14 +0000 (10:37 +0200)
committerSamuel Iglesias Gonsalvez <siglesias@igalia.com>
Mon, 19 Oct 2015 09:16:50 +0000 (11:16 +0200)
Fixes a regression added by bb5aeb854915ba67abc56257f830d002c956439e.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
src/glsl/lower_ubo_reference.cpp

index 1fbb09de0b155b2d92d209676a992c8acf256801..e818c0484611a8bb86a138689f6c76f4699d5473 100644 (file)
@@ -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);