compiler/nir_types: Handle vectors in glsl_get_array_element

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.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
This commit is contained in:
Jason Ekstrand
2017-08-23 17:43:36 -07:00
parent ad77775809
commit df81b81fb9

View File

@@ -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;
}