ast_function: Fix check for "too few components".
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 1 Sep 2010 22:04:57 +0000 (15:04 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 2 Sep 2010 01:57:50 +0000 (18:57 -0700)
This was triggering even for matrix-from-matrix constructors.  It is
perfectly legal to construct a mat3 from a mat2 - the rest will be
filled in by the identity matrix.

Changes piglit test constructor-23.vert from FAIL to PASS, but the
generated code is incorrect.

src/glsl/ast_function.cpp

index d7d1b3eeb71ccca6fd1efec8e555f9b77f8eded3..0c9f8900384b19f5d0e377ee55d2cd3f397de1fb 100644 (file)
@@ -1151,7 +1151,8 @@ ast_function_expression::hir(exec_list *instructions,
        *    arguments to provide an initializer for every component in the
        *    constructed value."
        */
-      if ((components_used < type_components) && (components_used != 1)) {
+      if (components_used < type_components && components_used != 1
+         && matrix_parameters == 0) {
         _mesa_glsl_error(& loc, state, "too few components to construct "
                          "`%s'",
                          constructor_type->name);