Add support for arrays as function return values in GLSL output
Output the array brackets and the array size correctly when a function's
return value type is array.
Tested with WebGL 2 test sdk/tests/deqp/data/gles3/shaders/arrays.html
BUG=angleproject:971
TEST=WebGL 2 conformance tests
Change-Id: I63aa8c54d2696f65351b23acb0749a487298ddfb
Reviewed-on: https://chromium-review.googlesource.com/265410
Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/compiler/translator/OutputGLSLBase.cpp b/src/compiler/translator/OutputGLSLBase.cpp
index 2720baf..6f7568e 100644
--- a/src/compiler/translator/OutputGLSLBase.cpp
+++ b/src/compiler/translator/OutputGLSLBase.cpp
@@ -777,7 +777,13 @@
case EOpPrototype:
// Function declaration.
ASSERT(visit == PreVisit);
- writeVariableType(node->getType());
+ {
+ const TType &type = node->getType();
+ writeVariableType(type);
+ if (type.isArray())
+ out << arrayBrackets(type);
+ }
+
out << " " << hashFunctionName(node->getName());
out << "(";
@@ -789,7 +795,13 @@
case EOpFunction: {
// Function definition.
ASSERT(visit == PreVisit);
- writeVariableType(node->getType());
+ {
+ const TType &type = node->getType();
+ writeVariableType(type);
+ if (type.isArray())
+ out << arrayBrackets(type);
+ }
+
out << " " << hashFunctionName(node->getName());
incrementDepth(node);