Module: Mesa Branch: main Commit: 68c54c994a17a635123b85ef8d5f92a843742a5f URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=68c54c994a17a635123b85ef8d5f92a843742a5f
Author: Faith Ekstrand <faith.ekstr...@collabora.com> Date: Wed Apr 26 21:43:35 2023 -0500 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 <kher...@redhat.com> Reviewed-by: Alyssa Rosenzweig <aly...@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22580> --- src/compiler/glsl_types.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/compiler/glsl_types.c b/src/compiler/glsl_types.c index b6776cf5b8f..90226e24e35 100644 --- a/src/compiler/glsl_types.c +++ b/src/compiler/glsl_types.c @@ -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