diff options
author | Shahbaz Youssefi <ShabbyX@gmail.com> | 2020-07-03 15:42:53 -0400 |
---|---|---|
committer | Shahbaz Youssefi <ShabbyX@gmail.com> | 2020-07-08 15:33:20 -0400 |
commit | 8c49d15fbf4f7857c1f32a7b39ded0a99da660d3 (patch) | |
tree | a079007a1605f75d5bbd62ebc8c60873408055f5 /glslang/MachineIndependent/localintermediate.h | |
parent | f5ed7a69d5d64bd3ac802712c24995c6c12d23f8 (diff) | |
download | glslang-8c49d15fbf4f7857c1f32a7b39ded0a99da660d3.tar.gz |
Use GLSLANG_ANGLE to strip features to what ANGLE requires
This change strips a few features similar to GLSLANG_WEB but doesn't
remove every detail like the latter. It also hardcodes profile/version
to core/450.
In particular, TBuiltIns::initialize is specialized to remove most of
what is not supported or won't be supported by ANGLE. The result of
this function is parsed with TParseContext::parseShaderStrings which is
a performance bottleneck.
This change shaves about 300KB off of ANGLE's binary size and reduces
the cost of SetupBuiltinSymbolTable to nearly a sixth.
Signed-off-by: Shahbaz Youssefi <ShabbyX@gmail.com>
Diffstat (limited to 'glslang/MachineIndependent/localintermediate.h')
-rw-r--r-- | glslang/MachineIndependent/localintermediate.h | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/glslang/MachineIndependent/localintermediate.h b/glslang/MachineIndependent/localintermediate.h index a3ff8868..53be3f5f 100644 --- a/glslang/MachineIndependent/localintermediate.h +++ b/glslang/MachineIndependent/localintermediate.h @@ -241,7 +241,10 @@ class TIntermediate { public: explicit TIntermediate(EShLanguage l, int v = 0, EProfile p = ENoProfile) : language(l), - profile(p), version(v), treeRoot(0), +#ifndef GLSLANG_ANGLE + profile(p), version(v), +#endif + treeRoot(0), numEntryPoints(0), numErrors(0), numPushConstants(0), recursive(false), invertY(false), useStorageBuffer(false), @@ -295,9 +298,20 @@ public: #endif } - void setVersion(int v) { version = v; } + void setVersion(int v) + { +#ifndef GLSLANG_ANGLE + version = v; +#endif + } + void setProfile(EProfile p) + { +#ifndef GLSLANG_ANGLE + profile = p; +#endif + } + int getVersion() const { return version; } - void setProfile(EProfile p) { profile = p; } EProfile getProfile() const { return profile; } void setSpv(const SpvVersion& s) { @@ -929,8 +943,13 @@ protected: typedef std::list<TCall> TGraph; TGraph callGraph; +#ifdef GLSLANG_ANGLE + const EProfile profile = ECoreProfile; + const int version = 450; +#else EProfile profile; // source profile int version; // source version +#endif SpvVersion spvVersion; TIntermNode* treeRoot; std::map<std::string, TExtensionBehavior> requestedExtensions; // cumulation of all enabled or required extensions; not connected to what subset of the shader used them |