Mesa (master): ast_function: Fix check for "too few components".
Kenneth Graunke
kwg at kemper.freedesktop.org
Thu Sep 2 01:58:36 UTC 2010
Module: Mesa
Branch: master
Commit: 550237eedd772487151565f64384d35c1bf695a6
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=550237eedd772487151565f64384d35c1bf695a6
Author: Kenneth Graunke <kenneth at whitecape.org>
Date: Wed Sep 1 15:04:57 2010 -0700
ast_function: Fix check for "too few components".
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 | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp
index d7d1b3e..0c9f890 100644
--- a/src/glsl/ast_function.cpp
+++ b/src/glsl/ast_function.cpp
@@ -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);
More information about the mesa-commit
mailing list