This will avoid a bunch of code when implementing arrays of arrays support.
Signed-off-by: Timothy Arceri <[email protected]> --- src/glsl/glsl_types.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h index dca5492..51147e9 100644 --- a/src/glsl/glsl_types.h +++ b/src/glsl/glsl_types.h @@ -213,6 +213,22 @@ struct glsl_type { } /** + * Query the type of the outermost elements in a single or + * multi dimension array + * + * \return + * Pointer to the type of elements in the outermost array for array types, + * or pointer to itself for non-array types. + */ + const glsl_type *outermost_element_type() const + { + if (is_array()) + return fields.array->outermost_element_type(); + else + return this; + } + + /** * Get the instance of a built-in scalar, vector, or matrix type */ static const glsl_type *get_instance(unsigned base_type, unsigned rows, -- 1.9.0 _______________________________________________ mesa-dev mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-dev
