Add an SH_GLSL_CORE_OUTPUT profile.
So we could generate shaders for Apple using core GL profile.
By switching to core profile, we still pass most WebGL conformance tests 1.0.2 on Linux, but not all, so apparently more work is needed.
However, I think it's OK to check this CL in because this output profile will be only used behind a chromium switch.
BUG=angleproject:933
TEST=webgl conformance tests
Change-Id: Iad70e1aebf82349d3fc5f4116c1d6bc4448193fd
Reviewed-on: https://chromium-review.googlesource.com/255282
Tested-by: Zhenyao Mo <zmo@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/compiler/translator/OutputGLSLBase.cpp b/src/compiler/translator/OutputGLSLBase.cpp
index b769d28..cea2b4a 100644
--- a/src/compiler/translator/OutputGLSLBase.cpp
+++ b/src/compiler/translator/OutputGLSLBase.cpp
@@ -46,6 +46,7 @@
}
return true;
}
+
} // namespace
TOutputGLSLBase::TOutputGLSLBase(TInfoSinkBase &objSink,
@@ -53,7 +54,8 @@
ShHashFunction64 hashFunction,
NameMap &nameMap,
TSymbolTable &symbolTable,
- int shaderVersion)
+ int shaderVersion,
+ ShShaderOutput output)
: TIntermTraverser(true, true, true),
mObjSink(objSink),
mDeclaringVariables(false),
@@ -61,7 +63,8 @@
mHashFunction(hashFunction),
mNameMap(nameMap),
mSymbolTable(symbolTable),
- mShaderVersion(shaderVersion)
+ mShaderVersion(shaderVersion),
+ mOutput(output)
{
}
@@ -91,7 +94,34 @@
TQualifier qualifier = type.getQualifier();
if (qualifier != EvqTemporary && qualifier != EvqGlobal)
{
- out << type.getQualifierString() << " ";
+ if (mOutput == SH_GLSL_CORE_OUTPUT)
+ {
+ switch (qualifier)
+ {
+ case EvqAttribute:
+ out << "in" << " ";
+ break;
+ case EvqVaryingIn:
+ out << "in" << " ";
+ break;
+ case EvqVaryingOut:
+ out << "out" << " ";
+ break;
+ case EvqInvariantVaryingIn:
+ out << "invariant in" << " ";
+ break;
+ case EvqInvariantVaryingOut:
+ out << "invariant out" << " ";
+ break;
+ default:
+ out << type.getQualifierString() << " ";
+ break;
+ }
+ }
+ else
+ {
+ out << type.getQualifierString() << " ";
+ }
}
// Declare the struct if we have not done so already.
if (type.getBasicType() == EbtStruct && !structDeclared(type.getStruct()))