Mesa (master): glsl: Handle array declarations in function parameters.
Kenneth Graunke
kwg at kemper.freedesktop.org
Sat Aug 21 22:38:43 UTC 2010
Module: Mesa
Branch: master
Commit: e511a35fc53fb75a2401d8a94c0c35634175c575
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e511a35fc53fb75a2401d8a94c0c35634175c575
Author: Kenneth Graunke <kenneth at whitecape.org>
Date: Sat Aug 21 15:30:34 2010 -0700
glsl: Handle array declarations in function parameters.
The 'vec4[12] foo' style already worked, but the 'vec4 foo[12]' style
did not. Also, 'vec4[] foo' was wrongly accepted.
Fixes piglit test cases array-19.vert and array-21.vert.
May fix fd.o bug #29684 (or at least part of it).
---
src/glsl/ast_to_hir.cpp | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 4188348..397c84e 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -2040,13 +2040,22 @@ ast_parameter_declarator::hir(exec_list *instructions,
return NULL;
}
+ /* This only handles "vec4 foo[..]". The earlier specifier->glsl_type(...)
+ * call already handled the "vec4[..] foo" case.
+ */
+ if (this->is_array) {
+ type = process_array_type(type, this->array_size, state);
+ }
+
+ if (type->array_size() == 0) {
+ _mesa_glsl_error(&loc, state, "arrays passed as parameters must have "
+ "a declared size.");
+ type = glsl_type::error_type;
+ }
+
is_void = false;
ir_variable *var = new(ctx) ir_variable(type, this->identifier, ir_var_in);
- /* FINISHME: Handle array declarations. Note that this requires
- * FINISHME: complete handling of constant expressions.
- */
-
/* Apply any specified qualifiers to the parameter declaration. Note that
* for function parameters the default mode is 'in'.
*/
More information about the mesa-commit
mailing list