[Mesa-dev] [PATCH 14/27] nir: Add glsl_get_element_type() wrapper.

Timothy Arceri t_arceri at yahoo.com.au
Thu May 7 06:01:42 PDT 2015


On Tue, 2015-04-28 at 23:08 +0300, Abdiel Janulgue wrote:
> Signed-off-by: Abdiel Janulgue <abdiel.janulgue at linux.intel.com>
> ---
>  src/glsl/nir/nir_types.cpp | 5 +++++
>  src/glsl/nir/nir_types.h   | 2 ++
>  2 files changed, 7 insertions(+)
> 
> diff --git a/src/glsl/nir/nir_types.cpp b/src/glsl/nir/nir_types.cpp
> index f0d0b46..249678f 100644
> --- a/src/glsl/nir/nir_types.cpp
> +++ b/src/glsl/nir/nir_types.cpp
> @@ -82,6 +82,11 @@ glsl_get_base_type(const struct glsl_type *type)
>     return type->base_type;
>  }
>  
> +const struct glsl_type *
> +glsl_get_element_type(const struct glsl_type *type)
> +{
> +   return type->element_type();

I've sent a patch to remove the element_type() helper. I'm yet to see a
case where just using is_array() and/or without_array() don't result in
clearer code with the added advantage (in most cases) of free
multidimensional array support.

http://lists.freedesktop.org/archives/mesa-dev/2015-April/083195.html

> +}
>  unsigned
>  glsl_get_vector_elements(const struct glsl_type *type)
>  {
> diff --git a/src/glsl/nir/nir_types.h b/src/glsl/nir/nir_types.h
> index 276d4ad..125f075 100644
> --- a/src/glsl/nir/nir_types.h
> +++ b/src/glsl/nir/nir_types.h
> @@ -49,6 +49,8 @@ const struct glsl_type *glsl_get_array_element(const struct glsl_type *type);
>  
>  const struct glsl_type *glsl_get_column_type(const struct glsl_type *type);
>  
> +const struct glsl_type *glsl_get_element_type(const struct glsl_type *type);
> +
>  enum glsl_base_type glsl_get_base_type(const struct glsl_type *type);
>  
>  unsigned glsl_get_vector_elements(const struct glsl_type *type);




More information about the mesa-dev mailing list