---
 src/glsl/glsl_parser_extras.cpp | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index f4b4924..2eb5fb7 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -674,15 +674,12 @@ static const char *
 _mesa_ast_get_matrix_column_type_name(const char *matrix_type_name)
 {
    static const char *vec_name[] = { "vec2", "vec3", "vec4" };
-   long rows;
 
-   if (strlen(matrix_type_name) == strlen("mat4")) {
-      rows = strtol(matrix_type_name + 3, NULL, 10);
-   } else {
-      assert(strlen(matrix_type_name) == strlen("mat4x2"));
-
-      rows = strtol(matrix_type_name + 5, NULL, 10);
-   }
+   /* The number of elements in a row of a matrix is specified by the last
+    * character of the matrix type name.
+    */
+   long rows = strtol(matrix_type_name + strlen(matrix_type_name) - 1,
+                      NULL, 10);
    return vec_name[rows - 2];
 }
 
-- 
1.8.1.5

_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to