glsl/linker: use without_array() to retrieve type
authorIago Toral Quiroga <itoral@igalia.com>
Fri, 3 Nov 2017 09:46:30 +0000 (10:46 +0100)
committerIago Toral Quiroga <itoral@igalia.com>
Mon, 13 Nov 2017 08:22:26 +0000 (09:22 +0100)
This is what we do in the condition too, so it makes sense.

v2: Only compute without_array() once (Ilia).

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
src/compiler/glsl/link_varyings.cpp

index e6639306bedd8a09c1598ccee9e9f55a1e66bcc5..72309365a030773cfcc5ff185cd61ad8942f2cee 100644 (file)
@@ -566,9 +566,10 @@ validate_explicit_variable_location(struct gl_context *ctx,
       return false;
    }
 
-   if (type->without_array()->is_interface()) {
-      for (unsigned i = 0; i < type->without_array()->length; i++) {
-         glsl_struct_field *field = &type->fields.structure[i];
+   const glsl_type *type_without_array = type->without_array();
+   if (type_without_array->is_interface()) {
+      for (unsigned i = 0; i < type_without_array->length; i++) {
+         glsl_struct_field *field = &type_without_array->fields.structure[i];
          unsigned field_location = field->location -
             (field->patch ? VARYING_SLOT_PATCH0 : VARYING_SLOT_VAR0);
          if (!check_location_aliasing(explicit_locations, var,