From 22f7a46d74d702b84de77d4465069776e34f617d Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Sat, 19 Jul 2014 14:07:18 -0700 Subject: [PATCH] glsl: Add without_array type predicate Returns the type without any arrays. This will be used in later patches in this series. Signed-off-by: Ian Romanick Suggested-by: Timothy Arceri Reviewed-by: Timothy Arceri Reviewed-by: Kenneth Graunke --- src/glsl/glsl_types.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h index 50cd655dc76..92578ff47ac 100644 --- a/src/glsl/glsl_types.h +++ b/src/glsl/glsl_types.h @@ -464,6 +464,18 @@ struct glsl_type { return base_type == GLSL_TYPE_ERROR; } + /** + * Get the type stripped of any arrays + * + * \return + * Pointer to the type of elements of the first non-array type for array + * types, or pointer to itself for non-array types. + */ + const glsl_type *without_array() const + { + return this->is_array() ? this->fields.array : this; + } + /** * Return the amount of atomic counter storage required for a type. */ -- 2.30.2