Prerequisite code for simpler GlslangWrapper.
This makes two changes for the linking step:
* allows symbol names in TOutputGLSLBase::writeVariableType
* stores a list of inactive varying names in VaryingPacking
Bug: angleproject:2456
Change-Id: Id651721a008c049508303d18c45c6b96c76114d9
Reviewed-on: https://chromium-review.googlesource.com/1014707
Reviewed-by: Luc Ferron <lucferron@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
diff --git a/src/compiler/translator/OutputGLSLBase.cpp b/src/compiler/translator/OutputGLSLBase.cpp
index 553d6c1..7a1be2e 100644
--- a/src/compiler/translator/OutputGLSLBase.cpp
+++ b/src/compiler/translator/OutputGLSLBase.cpp
@@ -214,7 +214,7 @@
out << ") ";
}
-const char *TOutputGLSLBase::mapQualifierToString(TQualifier qualifier)
+const char *TOutputGLSLBase::mapQualifierToString(TQualifier qualifier, const TSymbol *symbol)
{
if (sh::IsGLSL410OrOlder(mOutput) && mShaderVersion >= 300 &&
(mCompileOptions & SH_REMOVE_INVARIANT_AND_CENTROID_FOR_ESSL3) != 0)
@@ -250,7 +250,7 @@
return sh::getQualifierString(qualifier);
}
-void TOutputGLSLBase::writeVariableType(const TType &type)
+void TOutputGLSLBase::writeVariableType(const TType &type, const TSymbol *symbol)
{
TQualifier qualifier = type.getQualifier();
TInfoSinkBase &out = objSink();
@@ -265,7 +265,7 @@
}
if (qualifier != EvqTemporary && qualifier != EvqGlobal)
{
- const char *qualifierString = mapQualifierToString(qualifier);
+ const char *qualifierString = mapQualifierToString(qualifier, symbol);
if (qualifierString && qualifierString[0] != '\0')
{
out << qualifierString << " ";
@@ -336,7 +336,7 @@
{
const TVariable *param = func->getParam(i);
const TType &type = param->getType();
- writeVariableType(type);
+ writeVariableType(type, param);
if (param->symbolType() != SymbolType::Empty)
out << " " << hashName(param);
@@ -894,7 +894,7 @@
TInfoSinkBase &out = objSink();
const TType &type = node->getType();
- writeVariableType(type);
+ writeVariableType(type, node->getFunction());
if (type.isArray())
out << ArrayString(type);
@@ -995,7 +995,7 @@
const TIntermSequence &sequence = *(node->getSequence());
TIntermTyped *variable = sequence.front()->getAsTyped();
writeLayoutQualifier(variable);
- writeVariableType(variable->getType());
+ writeVariableType(variable->getType(), &variable->getAsSymbolNode()->variable());
if (variable->getAsSymbolNode() == nullptr ||
variable->getAsSymbolNode()->variable().symbolType() != SymbolType::Empty)
{