Vulkan: Fix the issue with unused attributes / varyings
When an attribute, a uniform or a varying isn't used, we now remove
their layout and in/out qualifiers so that the shader can still refer
to these var names.
Bug: angleproject:2456
Change-Id: I5f1241d91bd46f663750adfab2562ef87ce69ae5
Reviewed-on: https://chromium-review.googlesource.com/1014009
Commit-Queue: Luc Ferron <lucferron@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/compiler/translator/OutputGLSLBase.cpp b/src/compiler/translator/OutputGLSLBase.cpp
index a7534b0..fd1958c 100644
--- a/src/compiler/translator/OutputGLSLBase.cpp
+++ b/src/compiler/translator/OutputGLSLBase.cpp
@@ -214,7 +214,16 @@
out << ") ";
}
-const char *TOutputGLSLBase::mapQualifierToString(TQualifier qualifier, const TSymbol *symbol)
+void TOutputGLSLBase::writeQualifier(TQualifier qualifier, const TSymbol *symbol)
+{
+ const char *result = mapQualifierToString(qualifier);
+ if (result && result[0] != '\0')
+ {
+ objSink() << result << " ";
+ }
+}
+
+const char *TOutputGLSLBase::mapQualifierToString(TQualifier qualifier)
{
if (sh::IsGLSL410OrOlder(mOutput) && mShaderVersion >= 300 &&
(mCompileOptions & SH_REMOVE_INVARIANT_AND_CENTROID_FOR_ESSL3) != 0)
@@ -265,11 +274,7 @@
}
if (qualifier != EvqTemporary && qualifier != EvqGlobal)
{
- const char *qualifierString = mapQualifierToString(qualifier, symbol);
- if (qualifierString && qualifierString[0] != '\0')
- {
- out << qualifierString << " ";
- }
+ writeQualifier(qualifier, symbol);
}
const TMemoryQualifier &memoryQualifier = type.getMemoryQualifier();