summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/angle/src/compiler/translator/Compiler.cpp
diff options
context:
space:
mode:
authorAndrew Knight <andrew.knight@theqtcompany.com>2014-11-14 10:52:01 +0200
committerJani Heikkinen <jani.heikkinen@theqtcompany.com>2014-11-14 19:01:38 +0100
commitc6df5fe3ed0f2a722931be098914978cf17a666f (patch)
tree23abe340dbc427a3afd255c79316f79fef937059 /src/3rdparty/angle/src/compiler/translator/Compiler.cpp
parent32db2f425a0b85bc03d7de42d7b44337d0aa16f4 (diff)
ANGLE: Upgrade to version 1.2.30d6c255d238
The following patches have been changed: 0001-Fix-compilation-for-MSVC-2008-and-std-tuple.patch Removed because it is no longer possible to build ANGLE with MSVC2008 0002-Fix-compilation-of-ANGLE-with-mingw-tdm64-gcc-4.8.1.patch Removed because the minimum version of MinGW moved to 4.8.2 0005-Fix-build-when-SSE2-is-not-available.patch Removed because it was fixed upstream 0006-Fix-compilation-of-libGLESv2-with-older-MinGW-w64-he.patch Removed because older versions of MinGW are not supported 0007-Fix-ANGLE-build-with-Microsoft-Visual-Studio-14-CTP.patch Removed because it was fixed upstream Task-number: QTBUG-41903 Change-Id: I976d30802f7f6fee725cf9a9f1325d5e82609835 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com> Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
Diffstat (limited to 'src/3rdparty/angle/src/compiler/translator/Compiler.cpp')
-rw-r--r--src/3rdparty/angle/src/compiler/translator/Compiler.cpp63
1 files changed, 51 insertions, 12 deletions
diff --git a/src/3rdparty/angle/src/compiler/translator/Compiler.cpp b/src/3rdparty/angle/src/compiler/translator/Compiler.cpp
index 368cd2ae4a..5c62a64d10 100644
--- a/src/3rdparty/angle/src/compiler/translator/Compiler.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/Compiler.cpp
@@ -29,24 +29,27 @@
bool IsWebGLBasedSpec(ShShaderSpec spec)
{
- return spec == SH_WEBGL_SPEC || spec == SH_CSS_SHADERS_SPEC;
+ return (spec == SH_WEBGL_SPEC ||
+ spec == SH_CSS_SHADERS_SPEC ||
+ spec == SH_WEBGL2_SPEC);
}
size_t GetGlobalMaxTokenSize(ShShaderSpec spec)
{
// WebGL defines a max token legnth of 256, while ES2 leaves max token
// size undefined. ES3 defines a max size of 1024 characters.
- if (IsWebGLBasedSpec(spec))
+ switch (spec)
{
+ case SH_WEBGL_SPEC:
+ case SH_CSS_SHADERS_SPEC:
return 256;
- }
- else
- {
+ default:
return 1024;
}
}
namespace {
+
class TScopedPoolAllocator
{
public:
@@ -82,6 +85,24 @@ class TScopedSymbolTableLevel
private:
TSymbolTable* mTable;
};
+
+int MapSpecToShaderVersion(ShShaderSpec spec)
+{
+ switch (spec)
+ {
+ case SH_GLES2_SPEC:
+ case SH_WEBGL_SPEC:
+ case SH_CSS_SHADERS_SPEC:
+ return 100;
+ case SH_GLES3_SPEC:
+ case SH_WEBGL2_SPEC:
+ return 300;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
} // namespace
TShHandleBase::TShHandleBase()
@@ -178,9 +199,21 @@ bool TCompiler::compile(const char* const shaderStrings[],
(parseContext.treeRoot != NULL);
shaderVersion = parseContext.getShaderVersion();
+ if (success && MapSpecToShaderVersion(shaderSpec) < shaderVersion)
+ {
+ infoSink.info.prefix(EPrefixError);
+ infoSink.info << "unsupported shader version";
+ success = false;
+ }
if (success)
{
+ mPragma = parseContext.pragma();
+ if (mPragma.stdgl.invariantAll)
+ {
+ symbolTable.setGlobalInvariant();
+ }
+
TIntermNode* root = parseContext.treeRoot;
success = intermediate.postProcess(root);
@@ -360,7 +393,8 @@ void TCompiler::setResourceString()
<< ":MaxVertexOutputVectors:" << compileResources.MaxVertexOutputVectors
<< ":MaxFragmentInputVectors:" << compileResources.MaxFragmentInputVectors
<< ":MinProgramTexelOffset:" << compileResources.MinProgramTexelOffset
- << ":MaxProgramTexelOffset:" << compileResources.MaxProgramTexelOffset;
+ << ":MaxProgramTexelOffset:" << compileResources.MaxProgramTexelOffset
+ << ":NV_draw_buffers:" << compileResources.NV_draw_buffers;
builtInResourcesString = strstream.str();
}
@@ -377,7 +411,6 @@ void TCompiler::clearResults()
uniforms.clear();
expandedUniforms.clear();
varyings.clear();
- expandedVaryings.clear();
interfaceBlocks.clear();
builtInFunctionEmulator.Cleanup();
@@ -507,13 +540,12 @@ void TCompiler::collectVariables(TIntermNode* root)
&uniforms,
&varyings,
&interfaceBlocks,
- hashFunction);
+ hashFunction,
+ symbolTable);
root->traverse(&collect);
- // For backwards compatiblity with ShGetVariableInfo, expand struct
- // uniforms and varyings into separate variables for each field.
- sh::ExpandVariables(uniforms, &expandedUniforms);
- sh::ExpandVariables(varyings, &expandedVaryings);
+ // This is for enforcePackingRestriction().
+ sh::ExpandUniforms(uniforms, &expandedUniforms);
}
bool TCompiler::enforcePackingRestrictions()
@@ -581,3 +613,10 @@ const BuiltInFunctionEmulator& TCompiler::getBuiltInFunctionEmulator() const
{
return builtInFunctionEmulator;
}
+
+void TCompiler::writePragma()
+{
+ TInfoSinkBase &sink = infoSink.obj;
+ if (mPragma.stdgl.invariantAll)
+ sink << "#pragma STDGL invariant(all)\n";
+}