From b59c5926cb0a5981a2e553c68e36312be7f122f9 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Wed, 23 Oct 2013 21:31:27 +1100 Subject: glsl: Add check for unsized arrays to glsl types The main purpose of this patch is to increase readability of the array code by introducing is_unsized_array() to glsl_types. Some redundent is_array() checks are also removed, and small number of other related clean ups. The introduction of is_unsized_array() should also make the ARB_arrays_of_arrays code simpler and more readable when it arrives. V2: Also replace code that checks for unsized arrays directly with the length variable Signed-off-by: Timothy Arceri v3 (Paul Berry ): clean up formatting. Separate whitespace cleanups to their own patch. Reviewed-by: Paul Berry --- src/glsl/linker.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/glsl/linker.cpp') diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index d8f655c3939..495a2abe280 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -1108,7 +1108,7 @@ private: */ static void fixup_type(const glsl_type **type, unsigned max_array_access) { - if ((*type)->is_array() && (*type)->length == 0) { + if ((*type)->is_unsized_array()) { *type = glsl_type::get_array_instance((*type)->fields.array, max_array_access + 1); assert(*type != NULL); @@ -1123,7 +1123,7 @@ private: { for (unsigned i = 0; i < type->length; i++) { const glsl_type *elem_type = type->fields.structure[i].type; - if (elem_type->is_array() && elem_type->length == 0) + if (elem_type->is_unsized_array()) return true; } return false; -- cgit v1.2.3