nir/types: Support vectors in glsl_get_length()

This makes it consistent with glsl_get_array_element() which returns the
scalar type for vectors, column type for matrices, and array element
type for arrays.

Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22580>
This commit is contained in:
Faith Ekstrand
2023-04-26 21:43:35 -05:00
committed by Marge Bot
parent 1e1c450659
commit 68c54c994a

View File

@@ -3507,7 +3507,11 @@ glsl_get_cmat_description(const struct glsl_type *t)
unsigned
glsl_get_length(const struct glsl_type *t)
{
return glsl_type_is_matrix(t) ? t->matrix_columns : t->length;
if (glsl_type_is_matrix(t))
return t->matrix_columns;
else if (glsl_type_is_vector(t))
return t->vector_elements;
return t->length;
}
unsigned