Commit 82b5ab60 by Austin Kinross Committed by Jamie Madill

Compile out GLSL/ESSL translator output code if it's not needed

In WinRT we only use the HLSL code, so the GLSL/ESSL output code is not necessary and is only adding to our binary size. BUG=angleproject:1250 Change-Id: I9363ca3981bde50a230f8353c1bcc09f6ea209cb Reviewed-on: https://chromium-review.googlesource.com/317358Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Tryjob-Request: Austin Kinross <aukinros@microsoft.com> Tested-by: 's avatarAustin Kinross <aukinros@microsoft.com>
parent ff318af1
......@@ -58,6 +58,16 @@ component("translator") {
defines = [ "ANGLE_TRANSLATOR_IMPLEMENTATION" ]
if (angle_enable_essl) {
sources += rebase_path(compiler_gypi.angle_translator_lib_essl_sources, ".", "src")
defines += [ "ANGLE_ENABLE_ESSL" ]
}
if (angle_enable_glsl) {
sources += rebase_path(compiler_gypi.angle_translator_lib_glsl_sources, ".", "src")
defines += [ "ANGLE_ENABLE_GLSL" ]
}
if (angle_enable_hlsl) {
sources += rebase_path(compiler_gypi.angle_translator_lib_hlsl_sources, ".", "src")
defines += [ "ANGLE_ENABLE_HLSL" ]
......@@ -128,10 +138,21 @@ static_library("angle_common") {
static_library("translator_lib") {
sources = rebase_path(compiler_gypi.angle_translator_lib_sources, ".", "src")
defines = []
if (angle_enable_essl) {
sources += rebase_path(compiler_gypi.angle_translator_lib_essl_sources, ".", "src")
defines += [ "ANGLE_ENABLE_ESSL" ]
}
if (angle_enable_glsl) {
sources += rebase_path(compiler_gypi.angle_translator_lib_glsl_sources, ".", "src")
defines += [ "ANGLE_ENABLE_GLSL" ]
}
if (angle_enable_hlsl) {
sources += rebase_path(compiler_gypi.angle_translator_lib_hlsl_sources, ".", "src")
defines = [ "ANGLE_ENABLE_HLSL" ]
defines += [ "ANGLE_ENABLE_HLSL" ]
}
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [
......
......@@ -18,6 +18,8 @@ if (is_linux) {
angle_enable_gl = true
}
angle_enable_essl = true
angle_enable_glsl = true
angle_enable_hlsl = false
if (angle_enable_d3d9 || angle_enable_d3d11) {
......
......@@ -56,6 +56,8 @@ def generateWinRTProjects(generate_args, generation_dir, build_winphone, msvs_ve
args.append('-Dangle_build_winphone=' + ('1' if build_winphone else '0'))
args.append('-Dangle_enable_d3d9=0')
args.append('-Dangle_enable_gl=0')
args.append('-Dangle_enable_essl=0')
args.append('-Dangle_enable_glsl=0')
# Add all.gyp as the main gyp file to be generated.
args.append(os.path.join(script_dir, 'ANGLE.gyp'))
......
......@@ -81,7 +81,10 @@ typedef enum {
} ShShaderSpec;
typedef enum {
// ESSL output only supported in some configurations.
SH_ESSL_OUTPUT = 0x8B45,
// GLSL output only supported in some configurations.
SH_GLSL_COMPATIBILITY_OUTPUT = 0x8B46,
//Note: GL introduced core profiles in 1.5.
SH_GLSL_130_OUTPUT = 0x8B47,
......@@ -330,8 +333,8 @@ COMPILER_EXPORT const std::string &ShGetBuiltInResourcesString(const ShHandle ha
// spec: Specifies the language spec the compiler must conform to -
// SH_GLES2_SPEC or SH_WEBGL_SPEC.
// output: Specifies the output code type - SH_ESSL_OUTPUT, SH_GLSL_OUTPUT,
// SH_HLSL9_OUTPUT or SH_HLSL11_OUTPUT. Note: HLSL output is only
// supported in some configurations.
// SH_HLSL9_OUTPUT or SH_HLSL11_OUTPUT. Note: Each output type may only
// be supported in some configurations.
// resources: Specifies the built-in resources.
COMPILER_EXPORT ShHandle ShConstructCompiler(
sh::GLenum type,
......
......@@ -16,6 +16,8 @@
'angle_enable_d3d9%': 0,
'angle_enable_d3d11%': 0,
'angle_enable_gl%': 0,
'angle_enable_essl%': 1, # Enable this for all configs by default
'angle_enable_glsl%': 1, # Enable this for all configs by default
'angle_enable_hlsl%': 0,
'angle_link_glx%': 0,
'angle_gl_library_type%': 'shared_library',
......
......@@ -25,8 +25,6 @@
'compiler/translator/BaseTypes.h',
'compiler/translator/BuiltInFunctionEmulator.cpp',
'compiler/translator/BuiltInFunctionEmulator.h',
'compiler/translator/BuiltInFunctionEmulatorGLSL.cpp',
'compiler/translator/BuiltInFunctionEmulatorGLSL.h',
'compiler/translator/Cache.cpp',
'compiler/translator/Cache.h',
'compiler/translator/CallDAG.cpp',
......@@ -43,8 +41,6 @@
'compiler/translator/EmulatePrecision.cpp',
'compiler/translator/EmulatePrecision.h',
'compiler/translator/ExtensionBehavior.h',
'compiler/translator/ExtensionGLSL.cpp',
'compiler/translator/ExtensionGLSL.h',
'compiler/translator/FlagStd140Structs.cpp',
'compiler/translator/FlagStd140Structs.h',
'compiler/translator/ForLoopUnroll.cpp',
......@@ -72,12 +68,6 @@
'compiler/translator/NodeSearch.h',
'compiler/translator/Operator.cpp',
'compiler/translator/Operator.h',
'compiler/translator/OutputESSL.cpp',
'compiler/translator/OutputESSL.h',
'compiler/translator/OutputGLSL.cpp',
'compiler/translator/OutputGLSL.h',
'compiler/translator/OutputGLSLBase.cpp',
'compiler/translator/OutputGLSLBase.h',
'compiler/translator/ParseContext.cpp',
'compiler/translator/ParseContext.h',
'compiler/translator/PoolAlloc.cpp',
......@@ -100,10 +90,6 @@
'compiler/translator/SearchSymbol.h',
'compiler/translator/SymbolTable.cpp',
'compiler/translator/SymbolTable.h',
'compiler/translator/TranslatorESSL.cpp',
'compiler/translator/TranslatorESSL.h',
'compiler/translator/TranslatorGLSL.cpp',
'compiler/translator/TranslatorGLSL.h',
'compiler/translator/Types.cpp',
'compiler/translator/Types.h',
'compiler/translator/UnfoldShortCircuitAST.cpp',
......@@ -120,8 +106,6 @@
'compiler/translator/VariableInfo.h',
'compiler/translator/VariablePacker.cpp',
'compiler/translator/VariablePacker.h',
'compiler/translator/VersionGLSL.cpp',
'compiler/translator/VersionGLSL.h',
'compiler/translator/blocklayout.cpp',
'compiler/translator/blocklayout.h',
'compiler/translator/depgraph/DependencyGraph.cpp',
......@@ -148,6 +132,28 @@
'third_party/compiler/ArrayBoundsClamper.cpp',
'third_party/compiler/ArrayBoundsClamper.h',
],
'angle_translator_lib_essl_sources':
[
'compiler/translator/OutputESSL.cpp',
'compiler/translator/OutputESSL.h',
'compiler/translator/TranslatorESSL.cpp',
'compiler/translator/TranslatorESSL.h',
],
'angle_translator_lib_glsl_sources':
[
'compiler/translator/BuiltInFunctionEmulatorGLSL.cpp',
'compiler/translator/BuiltInFunctionEmulatorGLSL.h',
'compiler/translator/ExtensionGLSL.cpp',
'compiler/translator/ExtensionGLSL.h',
'compiler/translator/OutputGLSL.cpp',
'compiler/translator/OutputGLSL.h',
'compiler/translator/OutputGLSLBase.cpp',
'compiler/translator/OutputGLSLBase.h',
'compiler/translator/TranslatorGLSL.cpp',
'compiler/translator/TranslatorGLSL.h',
'compiler/translator/VersionGLSL.cpp',
'compiler/translator/VersionGLSL.h',
],
'angle_translator_lib_hlsl_sources':
[
'compiler/translator/ArrayReturnValueToOutParameter.cpp',
......@@ -253,6 +259,42 @@
},
'conditions':
[
['angle_enable_essl==1',
{
'defines':
[
'ANGLE_ENABLE_ESSL',
],
'direct_dependent_settings':
{
'defines':
[
'ANGLE_ENABLE_ESSL',
],
},
'sources':
[
'<@(angle_translator_lib_essl_sources)',
],
}],
['angle_enable_glsl==1',
{
'defines':
[
'ANGLE_ENABLE_GLSL',
],
'direct_dependent_settings':
{
'defines':
[
'ANGLE_ENABLE_GLSL',
],
},
'sources':
[
'<@(angle_translator_lib_glsl_sources)',
],
}],
['angle_enable_hlsl==1',
{
'defines':
......
......@@ -4,8 +4,14 @@
// found in the LICENSE file.
//
#ifdef ANGLE_ENABLE_ESSL
#include "compiler/translator/TranslatorESSL.h"
#endif
#ifdef ANGLE_ENABLE_GLSL
#include "compiler/translator/TranslatorGLSL.h"
#endif
#ifdef ANGLE_ENABLE_HLSL
#include "compiler/translator/TranslatorHLSL.h"
#endif // ANGLE_ENABLE_HLSL
......@@ -20,7 +26,13 @@ TCompiler* ConstructCompiler(
{
switch (output) {
case SH_ESSL_OUTPUT:
#ifdef ANGLE_ENABLE_ESSL
return new TranslatorESSL(type, spec);
#else
// This compiler is not supported in this
// configuration. Return NULL per the ShConstructCompiler API.
return nullptr;
#endif // ANGLE_ENABLE_ESSL
case SH_GLSL_130_OUTPUT:
case SH_GLSL_140_OUTPUT:
case SH_GLSL_150_CORE_OUTPUT:
......@@ -32,7 +44,13 @@ TCompiler* ConstructCompiler(
case SH_GLSL_440_CORE_OUTPUT:
case SH_GLSL_450_CORE_OUTPUT:
case SH_GLSL_COMPATIBILITY_OUTPUT:
#ifdef ANGLE_ENABLE_GLSL
return new TranslatorGLSL(type, spec, output);
#else
// This compiler is not supported in this
// configuration. Return NULL per the ShConstructCompiler API.
return nullptr;
#endif // ANGLE_ENABLE_GLSL
case SH_HLSL9_OUTPUT:
case SH_HLSL11_OUTPUT:
#ifdef ANGLE_ENABLE_HLSL
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment