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>
diff --git a/BUILD.gn b/BUILD.gn
index 7242b6f..9525b5d 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -109,7 +109,6 @@
"SPIRV/SpvBuilder.cpp",
"SPIRV/SpvBuilder.h",
"SPIRV/SpvPostProcess.cpp",
- "SPIRV/SpvTools.cpp",
"SPIRV/SpvTools.h",
"SPIRV/bitutils.h",
"SPIRV/disassemble.cpp",
@@ -208,8 +207,12 @@
defines = []
if (invoker.enable_opt) {
+ sources += [ "SPIRV/SpvTools.cpp" ]
defines += [ "ENABLE_OPT=1" ]
}
+ if (invoker.is_angle) {
+ defines += [ "GLSLANG_ANGLE" ]
+ }
if (is_win) {
sources += [ "glslang/OSDependent/Windows/ossource.cpp" ]
@@ -257,11 +260,13 @@
glslang_sources_common("glslang_lib_sources") {
enable_opt = !glslang_angle
enable_hlsl = !glslang_angle
+ is_angle = glslang_angle
}
glslang_sources_common("glslang_sources") {
enable_opt = true
enable_hlsl = true
+ is_angle = false
}
source_set("glslang_default_resource_limits_sources") {