Fix exposing internal shader interface variables
Don't expose internal variables in the shader translator interface.
This affects the ViewID_OVR varying needed for instanced multiview,
which is so far the only variable of this kind.
This fixes the translator trying to add initialization for internal
variables in initializeOutputVariables. Since they are variables added
by ANGLE, they should never need extra initialization.
BUG=angleproject:2112
TEST=angle_unittests
Change-Id: I93ee2956c8180053806ce450d93f162f78a45d8f
Reviewed-on: https://chromium-review.googlesource.com/579050
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/VariableInfo.cpp b/src/compiler/translator/VariableInfo.cpp
index 7a11b24..18178d7 100644
--- a/src/compiler/translator/VariableInfo.cpp
+++ b/src/compiler/translator/VariableInfo.cpp
@@ -249,8 +249,15 @@
void CollectVariablesTraverser::visitSymbol(TIntermSymbol *symbol)
{
ASSERT(symbol != nullptr);
+
+ if (symbol->getName().isInternal())
+ {
+ // Internal variables are not collected.
+ return;
+ }
+
ShaderVariable *var = nullptr;
- const TString &symbolName = symbol->getSymbol();
+ const TString &symbolName = symbol->getName().getString();
if (IsVarying(symbol->getQualifier()))
{
@@ -577,6 +584,12 @@
// uniforms, varyings, outputs and interface blocks cannot be initialized in a shader, we
// must have only TIntermSymbol nodes in the sequence in the cases we are interested in.
const TIntermSymbol &variable = *variableNode->getAsSymbolNode();
+ if (variable.getName().isInternal())
+ {
+ // Internal variables are not collected.
+ continue;
+ }
+
if (typedNode.getBasicType() == EbtInterfaceBlock)
{
// TODO(jiajia.qin@intel.com): In order not to affect the old set of mInterfaceBlocks,