Disallow operations on structures containing arrays in ESSL1
Comparing structures that contain arrays to each other and assigning
structures that contain arrays is "not defined" in ESSL 1.00 (section
5.7). Sections 5.8 and 5.9 further suggest that these operations are not
allowed. Additionally some platform drivers on Linux seem to reject
shaders produced by ANGLE which compare structures containing arrays.
This might require changing the output GLSL version for ESSL 3.00.
BUG=angleproject:954
TEST=angle_unittests
Change-Id: I5f3a016f360f940f2fc1ec1ff8e60d13a977eb69
Reviewed-on: https://chromium-review.googlesource.com/261531
Reviewed-by: Olli Etuaho <oetuaho@nvidia.com>
Tested-by: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/ParseContext.cpp b/src/compiler/translator/ParseContext.cpp
index d531bc4..884beeb 100644
--- a/src/compiler/translator/ParseContext.cpp
+++ b/src/compiler/translator/ParseContext.cpp
@@ -2791,13 +2791,20 @@
return false;
}
- // Check that type sizes match exactly on ops that require that:
+ // Check that type sizes match exactly on ops that require that.
+ // Also check restrictions for structs that contain arrays.
switch(op)
{
case EOpAssign:
case EOpInitialize:
case EOpEqual:
case EOpNotEqual:
+ // ESSL 1.00 sections 5.7, 5.8, 5.9
+ if (shaderVersion < 300 && left->getType().isStructureContainingArrays())
+ {
+ error(loc, "undefined operation for structs containing arrays", GetOperatorString(op));
+ return false;
+ }
case EOpLessThan:
case EOpGreaterThan:
case EOpLessThanEqual: