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

@ -687,7 +687,7 @@ private:
TShader& operator=(TShader&);
};
#ifndef GLSLANG_WEB
#if !defined(GLSLANG_WEB) && !defined(GLSLANG_ANGLE)
//
// A reflection database and its interface, consistent with the OpenGL API reflection queries.
@ -805,7 +805,7 @@ public:
virtual void addStage(EShLanguage stage) = 0;
};
#endif // GLSLANG_WEB
#endif // !GLSLANG_WEB && !GLSLANG_ANGLE
// Make one TProgram per set of shaders that will get linked together. Add all
// the shaders that are to be linked together. After calling shader.parse()
@ -826,7 +826,7 @@ public:
TIntermediate* getIntermediate(EShLanguage stage) const { return intermediate[stage]; }
#ifndef GLSLANG_WEB
#if !defined(GLSLANG_WEB) && !defined(GLSLANG_ANGLE)
// Reflection Interface
@ -920,7 +920,7 @@ public:
// If resolver is not provided it uses the previous approach
// and respects auto assignment and offsets.
GLSLANG_EXPORT bool mapIO(TIoMapResolver* pResolver = nullptr, TIoMapper* pIoMapper = nullptr);
#endif
#endif // !GLSLANG_WEB && !GLSLANG_ANGLE
protected:
GLSLANG_EXPORT bool linkStage(EShLanguage, EShMessages);
@ -930,7 +930,7 @@ protected:
TIntermediate* intermediate[EShLangCount];
bool newedIntermediate[EShLangCount]; // track which intermediate were "new" versus reusing a singleton unit in a stage
TInfoSink* infoSink;
#ifndef GLSLANG_WEB
#if !defined(GLSLANG_WEB) && !defined(GLSLANG_ANGLE)
TReflection* reflection;
#endif
bool linked;