Invariant declaration doesn't make a variable active
Invariant declarations didn't affect static use before, but now they
are also skipped in CollectVariables so an invariant declaration is
not enough in itself to mark a variable as active. This fixes an
assert in CollectVariables.
BUG=chromium:829553
TEST=angle_unittests
Change-Id: I3e51d2916f091bcc283af136a4abc846ff71447d
Reviewed-on: https://chromium-review.googlesource.com/999532
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/CollectVariables.cpp b/src/compiler/translator/CollectVariables.cpp
index 05196fd..635f364 100644
--- a/src/compiler/translator/CollectVariables.cpp
+++ b/src/compiler/translator/CollectVariables.cpp
@@ -119,6 +119,7 @@
GLenum shaderType,
const TExtensionBehavior &extensionBehavior);
+ bool visitInvariantDeclaration(Visit visit, TIntermInvariantDeclaration *node) override;
void visitSymbol(TIntermSymbol *symbol) override;
bool visitDeclaration(Visit, TIntermDeclaration *node) override;
bool visitBinary(Visit visit, TIntermBinary *binaryNode) override;
@@ -336,11 +337,17 @@
}
}
-// We want to check whether a uniform/varying is statically used
-// because we only count the used ones in packing computing.
-// Also, gl_FragCoord, gl_PointCoord, and gl_FrontFacing count
-// toward varying counting if they are statically used in a fragment
-// shader.
+bool CollectVariablesTraverser::visitInvariantDeclaration(Visit visit,
+ TIntermInvariantDeclaration *node)
+{
+ // We should not mark variables as active just based on an invariant declaration, so we don't
+ // traverse the symbols declared invariant.
+ return false;
+}
+
+// We want to check whether a uniform/varying is active because we need to skip updating inactive
+// ones. We also only count the active ones in packing computing. Also, gl_FragCoord, gl_PointCoord,
+// and gl_FrontFacing count toward varying counting if they are active in a fragment shader.
void CollectVariablesTraverser::visitSymbol(TIntermSymbol *symbol)
{
ASSERT(symbol != nullptr);