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 <ian.d.romanick@intel.com>
Suggested-by: Timothy Arceri <t_arceri@yahoo.com.au>
Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
Ian Romanick 2014-07-19 14:07:18 -07:00
parent 146be3ddbe
commit 22f7a46d74

View file

@ -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.
*/