summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2013-08-08 17:40:38 -0700
committerIan Romanick <[email protected]>2013-08-13 17:57:39 -0700
commit8025bac852dd059e164077522d3159d636ac2a9a (patch)
tree22eea87523b09b4f1eba9656e2008ceb3094943e /src
parent5d6dc93490324cec64a9653068d4095505594a2c (diff)
glsl: Require function return type arrays be explicitly sized
Fixes piglit array-function-return-unsized.vert. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Cc: "9.2" <[email protected]> (cherry picked from commit 1b35e33af420cd335610289aa2d8a175a7139a97)
Diffstat (limited to 'src')
-rw-r--r--src/glsl/ast_to_hir.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 2706b385f2e..992195c1940 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -3359,6 +3359,18 @@ ast_function::hir(exec_list *instructions,
"function `%s' return type has qualifiers", name);
}
+ /* Section 6.1 (Function Definitions) of the GLSL 1.20 spec says:
+ *
+ * "Arrays are allowed as arguments and as the return type. In both
+ * cases, the array must be explicitly sized."
+ */
+ if (return_type->is_array() && return_type->length == 0) {
+ YYLTYPE loc = this->get_location();
+ _mesa_glsl_error(& loc, state,
+ "function `%s' return type array must be explicitly "
+ "sized", name);
+ }
+
/* From page 17 (page 23 of the PDF) of the GLSL 1.20 spec:
*
* "[Sampler types] can only be declared as function parameters