On 07/29/2014 11:18 PM, Timothy Arceri wrote: > On Tue, 2014-07-29 at 16:14 -0700, Ian Romanick wrote: >> From: Ian Romanick <ian.d.roman...@intel.com> >> >> Returns the type without any arrays. >> >> This will be used in later patches in this series. >> >> Signed-off-by: Ian Romanick <ian.d.roman...@intel.com> >> Suggested-by: Timothy Arceri <t_arc...@yahoo.com.au> >> Cc: Timothy Arceri <t_arc...@yahoo.com.au> >> --- >> 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 0b63d48..9cd132a 100644 >> --- a/src/glsl/glsl_types.h >> +++ b/src/glsl/glsl_types.h >> @@ -465,6 +465,18 @@ struct glsl_type { >> } >> >> /** >> + * 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; >> + } >> + > > Sorry I noticed this as I hit send on the last email with my reviewed by > but shouldn't this be: > > return this->is_array() ? this->fields.array->without_array() : this;
Right now we don't do arrays of arrays (except perhaps for geometry shaders?), so I didn't want to add support for a thing that I couldn't test. :) Also, I think I'd rather do the arrays-of-arrays without recursion. I was thinking: const glsl_type *t = this; while (t->is_array()) t = t->fields.array; return t; Some of these patches will likely get picked back to 10.2, so I'd like to do this as a follow-up patch. Does that sound good? >> + /** >> * Return the amount of atomic counter storage required for a type. >> */ >> unsigned atomic_size() const _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev