Accept equality and assignment for arrays in parsing
This is enough to support the operations in GLSL output. HLSL output will
likely require additional work to support this.
BUG=angleproject:941
Change-Id: I728d511ab07af94bc3382dc2796c1e9ac79d1442
Reviewed-on: https://chromium-review.googlesource.com/260801
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/ParseContext.cpp b/src/compiler/translator/ParseContext.cpp
index 15fa778..a3fd403 100644
--- a/src/compiler/translator/ParseContext.cpp
+++ b/src/compiler/translator/ParseContext.cpp
@@ -2721,8 +2721,34 @@
{
if (left->isArray() || right->isArray())
{
- error(loc, "Invalid operation for arrays", GetOperatorString(op));
- return false;
+ if (shaderVersion < 300)
+ {
+ error(loc, "Invalid operation for arrays", GetOperatorString(op));
+ return false;
+ }
+
+ if (left->isArray() != right->isArray())
+ {
+ error(loc, "array / non-array mismatch", GetOperatorString(op));
+ return false;
+ }
+
+ switch (op)
+ {
+ case EOpEqual:
+ case EOpNotEqual:
+ case EOpAssign:
+ case EOpInitialize:
+ break;
+ default:
+ error(loc, "Invalid operation for arrays", GetOperatorString(op));
+ return false;
+ }
+ if (left->getArraySize() != right->getArraySize())
+ {
+ error(loc, "array size mismatch", GetOperatorString(op));
+ return false;
+ }
}
return true;
}