nir/linker: fix ARRAY_SIZE query with xfb varyings
authorAlejandro Piñeiro <apinheiro@igalia.com>
Thu, 7 Mar 2019 15:57:10 +0000 (16:57 +0100)
committerAlejandro Piñeiro <apinheiro@igalia.com>
Fri, 8 Mar 2019 14:00:50 +0000 (15:00 +0100)
For a non-array varying, it is expecting ARRAY_SIZE as 1, instead of 0.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
src/compiler/glsl/gl_nir_link_xfb.c

index 587d65bfb3750616462f0b8adecd2154f99ec42d..7623492ba96ebd649f0ab62c98e2f29dbdc5898e 100644 (file)
@@ -156,7 +156,8 @@ gl_nir_link_assign_xfb_resources(struct gl_context *ctx,
       varying->Name = NULL;
       varying->Type = glsl_get_gl_type(xfb_varying->type);
       varying->BufferIndex = buffer_index;
-      varying->Size = glsl_get_length(xfb_varying->type);
+      varying->Size = glsl_type_is_array(xfb_varying->type) ?
+         glsl_get_length(xfb_varying->type) : 1;
       varying->Offset = xfb_varying->offset;
    }