Simplify interface block instance recording
Instead of storing instance names as part of TInterfaceBlock, store
instance names only in interface block instance symbols. Wherever the
instance name is needed it can be fetched from the instance symbol.
BUG=angleproject:2267
TEST=angle_end2end_tests
Change-Id: Ia265e4db7901eebec57c9c3769d84c17651a35ba
Reviewed-on: https://chromium-review.googlesource.com/803221
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 b35b6ec..49da220 100644
--- a/src/compiler/translator/CollectVariables.cpp
+++ b/src/compiler/translator/CollectVariables.cpp
@@ -132,7 +132,8 @@
Attribute recordAttribute(const TIntermSymbol &variable) const;
OutputVariable recordOutputVariable(const TIntermSymbol &variable) const;
Varying recordVarying(const TIntermSymbol &variable) const;
- void recordInterfaceBlock(const TType &interfaceBlockType,
+ void recordInterfaceBlock(const TString &instanceName,
+ const TType &interfaceBlockType,
InterfaceBlock *interfaceBlock) const;
Uniform recordUniform(const TIntermSymbol &variable) const;
@@ -316,7 +317,7 @@
{
ASSERT(glInType.getQualifier() == EvqPerVertexIn);
InterfaceBlock info;
- recordInterfaceBlock(glInType, &info);
+ recordInterfaceBlock("gl_in", glInType, &info);
info.staticUse = true;
mPerVertexInAdded = true;
@@ -646,7 +647,8 @@
}
// TODO(jiawei.shao@intel.com): implement GL_OES_shader_io_blocks.
-void CollectVariablesTraverser::recordInterfaceBlock(const TType &interfaceBlockType,
+void CollectVariablesTraverser::recordInterfaceBlock(const TString &instanceName,
+ const TType &interfaceBlockType,
InterfaceBlock *interfaceBlock) const
{
ASSERT(interfaceBlockType.getBasicType() == EbtInterfaceBlock);
@@ -657,8 +659,7 @@
interfaceBlock->name = blockType->name().c_str();
interfaceBlock->mappedName = getMappedName(TName(blockType->name()));
- interfaceBlock->instanceName =
- (blockType->hasInstanceName() ? blockType->instanceName().c_str() : "");
+ interfaceBlock->instanceName = instanceName.c_str();
ASSERT(!interfaceBlockType.isArrayOfArrays()); // Disallowed by GLSL ES 3.10 section 4.3.9
interfaceBlock->arraySize = interfaceBlockType.isArray() ? interfaceBlockType.getOutermostArraySize() : 0;
@@ -729,7 +730,7 @@
if (typedNode.getBasicType() == EbtInterfaceBlock)
{
InterfaceBlock interfaceBlock;
- recordInterfaceBlock(variable.getType(), &interfaceBlock);
+ recordInterfaceBlock(variable.getSymbol(), variable.getType(), &interfaceBlock);
switch (qualifier)
{