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>
This commit is contained in:
Shahbaz Youssefi 2020-07-03 15:42:53 -04:00
parent f5ed7a69d5
commit 8c49d15fbf
No known key found for this signature in database
GPG key ID: C6149357EC6727E0
17 changed files with 215 additions and 103 deletions

View file

@ -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