[Mesa-dev] [PATCH v2 52/52] compiler/nir_types: Handle vectors in glsl_get_array_element

Lionel Landwerlin lionel.g.landwerlin at intel.com
Fri Oct 13 10:57:02 UTC 2017


Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>

On 13/10/17 06:48, Jason Ekstrand wrote:
> Most of NIR doesn't allow doing array indexing on a vector (though it
> does on a matrix).  However, nir_lower_io handles it just fine and this
> behavior is needed for shared variables in Vulkan.  This commit makes
> glsl_get_array_element do something sensible for vector types and makes
> nir_validate happy with them.
> ---
>   src/compiler/nir_types.cpp | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/src/compiler/nir_types.cpp b/src/compiler/nir_types.cpp
> index 5583bc0..978f7d7 100644
> --- a/src/compiler/nir_types.cpp
> +++ b/src/compiler/nir_types.cpp
> @@ -39,6 +39,8 @@ glsl_get_array_element(const glsl_type* type)
>   {
>      if (type->is_matrix())
>         return type->column_type();
> +   else if (type->is_vector())
> +      return type->get_scalar_type();
>      return type->fields.array;
>   }
>   




More information about the mesa-dev mailing list