Allow single-component constructors
authorIan Romanick <ian.d.romanick@intel.com>
Mon, 29 Mar 2010 22:36:02 +0000 (15:36 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Mon, 29 Mar 2010 23:07:34 +0000 (16:07 -0700)
This causes the following tests to pass:

    glslparsertest/shaders/CorrectVersion.V110.frag
    shaders/glsl-vs-sqrt-zero.frag
    shaders/glsl-vs-sqrt-zero.vert

This causes the following tests to fail.  These shaders were
previously failing to compile, but they were all failing for the wrong
reasons.

    glslparsertest/shaders/attribute1.vert
    glslparsertest/shaders/attribute2.vert
    glslparsertest/shaders/main2.vert

ast_function.cpp

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