Invariant related processing.
* Fix a bug in PreProcessor for STDGL pragma.
* Record all invariant settings and set them in ShaderVariable.
* Write #pragma STDGL invariant(all) in GL
BUG=angle:776
TEST=https://www.khronos.org/registry/webgl/sdk/tests/conformance/glsl/misc/shaders-with-invariance.html
Change-Id: Ie28b75480deed79f0c9f26e3b98f1778d1290182
Reviewed-on: https://chromium-review.googlesource.com/223610
Tested-by: Zhenyao Mo <zmo@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/compiler/translator/OutputGLSLBase.cpp b/src/compiler/translator/OutputGLSLBase.cpp
index d03abb8..5f5e058 100644
--- a/src/compiler/translator/OutputGLSLBase.cpp
+++ b/src/compiler/translator/OutputGLSLBase.cpp
@@ -650,17 +650,18 @@
mDeclaringVariables = false;
}
break;
- case EOpInvariantDeclaration: {
- // Invariant declaration.
- ASSERT(visit == PreVisit);
+ case EOpInvariantDeclaration:
+ // Invariant declaration.
+ ASSERT(visit == PreVisit);
+ {
const TIntermSequence *sequence = node->getSequence();
ASSERT(sequence && sequence->size() == 1);
const TIntermSymbol *symbol = sequence->front()->getAsSymbolNode();
ASSERT(symbol);
- out << "invariant " << symbol->getSymbol() << ";";
- visitChildren = false;
- break;
+ out << "invariant " << hashVariableName(symbol->getSymbol()) << ";";
}
+ visitChildren = false;
+ break;
case EOpConstructFloat:
writeTriplet(visit, "float(", NULL, ")");
break;