diff options
author | Ben Murdoch <benm@google.com> | 2013-07-10 11:41:52 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2013-07-10 11:41:52 +0100 |
commit | 81866e5535a385325563c07027752faf5e36b70e (patch) | |
tree | 8aaaed313ca529cd2e44863b8f3e0af93897904b | |
parent | e9a0787ad1d3f95c18d7b5a2591748a85337975b (diff) | |
parent | 6be54267d813912fd2a56e37eeb291e04ecc2b8b (diff) | |
download | angle_dx11-81866e5535a385325563c07027752faf5e36b70e.tar.gz |
Merge from Chromium at DEPS revision r210036
This commit was generated by merge_to_master.py.
Change-Id: I96be576ce01669fa1ef8fccc331714fb198f0e37
43 files changed, 2893 insertions, 1108 deletions
diff --git a/src/common/version.h b/src/common/version.h index 2b2560fc..6c6cee6b 100644 --- a/src/common/version.h +++ b/src/common/version.h @@ -1,7 +1,7 @@ #define MAJOR_VERSION 1 -#define MINOR_VERSION 1 +#define MINOR_VERSION 2 #define BUILD_VERSION 0 -#define BUILD_REVISION 2422 +#define BUILD_REVISION 2424 #define STRINGIFY(x) #x #define MACRO_STRINGIFY(x) STRINGIFY(x) diff --git a/src/compiler/Compiler.cpp b/src/compiler/Compiler.cpp index f97714f2..4525cb92 100644 --- a/src/compiler/Compiler.cpp +++ b/src/compiler/Compiler.cpp @@ -1,5 +1,5 @@ // -// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved. +// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -27,52 +27,6 @@ bool isWebGLBasedSpec(ShShaderSpec spec) } namespace { -bool InitializeSymbolTable( - const TBuiltInStrings& builtInStrings, - ShShaderType type, ShShaderSpec spec, const ShBuiltInResources& resources, - TInfoSink& infoSink, TSymbolTable& symbolTable) -{ - TIntermediate intermediate(infoSink); - TExtensionBehavior extBehavior; - InitExtensionBehavior(resources, extBehavior); - // The builtins deliberately don't specify precisions for the function - // arguments and return types. For that reason we don't try to check them. - TParseContext parseContext(symbolTable, extBehavior, intermediate, type, spec, 0, false, NULL, infoSink); - parseContext.fragmentPrecisionHigh = resources.FragmentPrecisionHigh == 1; - - GlobalParseContext = &parseContext; - - assert(symbolTable.isEmpty()); - // - // Parse the built-ins. This should only happen once per - // language symbol table. - // - // Push the symbol table to give it an initial scope. This - // push should not have a corresponding pop, so that built-ins - // are preserved, and the test for an empty table fails. - // - symbolTable.push(); - - for (TBuiltInStrings::const_iterator i = builtInStrings.begin(); i != builtInStrings.end(); ++i) - { - const char* builtInShaders = i->c_str(); - int builtInLengths = static_cast<int>(i->size()); - if (builtInLengths <= 0) - continue; - - if (PaParseStrings(1, &builtInShaders, &builtInLengths, &parseContext) != 0) - { - infoSink.info.prefix(EPrefixInternalError); - infoSink.info << "Unable to parse built-ins"; - return false; - } - } - - IdentifyBuiltIns(type, spec, resources, symbolTable); - - return true; -} - class TScopedPoolAllocator { public: TScopedPoolAllocator(TPoolAllocator* allocator, bool pushPop) @@ -252,14 +206,42 @@ bool TCompiler::compile(const char* const shaderStrings[], return success; } -bool TCompiler::InitBuiltInSymbolTable(const ShBuiltInResources& resources) +bool TCompiler::InitBuiltInSymbolTable(const ShBuiltInResources &resources) { - TBuiltIns builtIns; - compileResources = resources; - builtIns.initialize(shaderType, shaderSpec, resources, extensionBehavior); - return InitializeSymbolTable(builtIns.getBuiltInStrings(), - shaderType, shaderSpec, resources, infoSink, symbolTable); + + assert(symbolTable.isEmpty()); + symbolTable.push(); + + TPublicType integer; + integer.type = EbtInt; + integer.size = 1; + integer.matrix = false; + integer.array = false; + + TPublicType floatingPoint; + floatingPoint.type = EbtFloat; + floatingPoint.size = 1; + floatingPoint.matrix = false; + floatingPoint.array = false; + + switch(shaderType) + { + case SH_FRAGMENT_SHADER: + symbolTable.setDefaultPrecision(integer, EbpMedium); + break; + case SH_VERTEX_SHADER: + symbolTable.setDefaultPrecision(integer, EbpHigh); + symbolTable.setDefaultPrecision(floatingPoint, EbpHigh); + break; + default: assert(false && "Language not supported"); + } + + InsertBuiltInFunctions(shaderType, shaderSpec, resources, extensionBehavior, symbolTable); + + IdentifyBuiltIns(shaderType, shaderSpec, resources, symbolTable); + + return true; } void TCompiler::clearResults() diff --git a/src/compiler/Initialize.cpp b/src/compiler/Initialize.cpp index d0ca47ad..0ed3b8df 100644 --- a/src/compiler/Initialize.cpp +++ b/src/compiler/Initialize.cpp @@ -1,5 +1,5 @@ // -// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved. +// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -14,479 +14,404 @@ #include "compiler/intermediate.h" -//============================================================================ -// -// Prototypes for built-in functions seen by both vertex and fragment shaders. -// -//============================================================================ -static TString BuiltInFunctionsCommon(const ShBuiltInResources& resources) +void InsertBuiltInFunctions(ShShaderType type, ShShaderSpec spec, const ShBuiltInResources &resources, + const TExtensionBehavior &extensionBehavior, TSymbolTable &symbolTable) { - TString s; + TType *float1 = new TType(EbtFloat, EbpUndefined, EvqGlobal, 1); + TType *float2 = new TType(EbtFloat, EbpUndefined, EvqGlobal, 2); + TType *float3 = new TType(EbtFloat, EbpUndefined, EvqGlobal, 3); + TType *float4 = new TType(EbtFloat, EbpUndefined, EvqGlobal, 4); + + TType *int2 = new TType(EbtInt, EbpUndefined, EvqGlobal, 2); + TType *int3 = new TType(EbtInt, EbpUndefined, EvqGlobal, 3); + TType *int4 = new TType(EbtInt, EbpUndefined, EvqGlobal, 4); // // Angle and Trigonometric Functions. // - s.append(TString("float radians(float degrees);")); - s.append(TString("vec2 radians(vec2 degrees);")); - s.append(TString("vec3 radians(vec3 degrees);")); - s.append(TString("vec4 radians(vec4 degrees);")); - - s.append(TString("float degrees(float radians);")); - s.append(TString("vec2 degrees(vec2 radians);")); - s.append(TString("vec3 degrees(vec3 radians);")); - s.append(TString("vec4 degrees(vec4 radians);")); - - s.append(TString("float sin(float angle);")); - s.append(TString("vec2 sin(vec2 angle);")); - s.append(TString("vec3 sin(vec3 angle);")); - s.append(TString("vec4 sin(vec4 angle);")); - - s.append(TString("float cos(float angle);")); - s.append(TString("vec2 cos(vec2 angle);")); - s.append(TString("vec3 cos(vec3 angle);")); - s.append(TString("vec4 cos(vec4 angle);")); - - s.append(TString("float tan(float angle);")); - s.append(TString("vec2 tan(vec2 angle);")); - s.append(TString("vec3 tan(vec3 angle);")); - s.append(TString("vec4 tan(vec4 angle);")); - - s.append(TString("float asin(float x);")); - s.append(TString("vec2 asin(vec2 x);")); - s.append(TString("vec3 asin(vec3 x);")); - s.append(TString("vec4 asin(vec4 x);")); - - s.append(TString("float acos(float x);")); - s.append(TString("vec2 acos(vec2 x);")); - s.append(TString("vec3 acos(vec3 x);")); - s.append(TString("vec4 acos(vec4 x);")); - - s.append(TString("float atan(float y, float x);")); - s.append(TString("vec2 atan(vec2 y, vec2 x);")); - s.append(TString("vec3 atan(vec3 y, vec3 x);")); - s.append(TString("vec4 atan(vec4 y, vec4 x);")); - - s.append(TString("float atan(float y_over_x);")); - s.append(TString("vec2 atan(vec2 y_over_x);")); - s.append(TString("vec3 atan(vec3 y_over_x);")); - s.append(TString("vec4 atan(vec4 y_over_x);")); + symbolTable.insertBuiltIn(float1, "radians", float1, "degrees"); + symbolTable.insertBuiltIn(float2, "radians", float2, "degrees"); + symbolTable.insertBuiltIn(float3, "radians", float3, "degrees"); + symbolTable.insertBuiltIn(float4, "radians", float4, "degrees"); + + symbolTable.insertBuiltIn(float1, "degrees", float1, "radians"); + symbolTable.insertBuiltIn(float2, "degrees", float2, "radians"); + symbolTable.insertBuiltIn(float3, "degrees", float3, "radians"); + symbolTable.insertBuiltIn(float4, "degrees", float4, "radians"); + + symbolTable.insertBuiltIn(float1, "sin", float1, "angle"); + symbolTable.insertBuiltIn(float2, "sin", float2, "angle"); + symbolTable.insertBuiltIn(float3, "sin", float3, "angle"); + symbolTable.insertBuiltIn(float4, "sin", float4, "angle"); + + symbolTable.insertBuiltIn(float1, "cos", float1, "angle"); + symbolTable.insertBuiltIn(float2, "cos", float2, "angle"); + symbolTable.insertBuiltIn(float3, "cos", float3, "angle"); + symbolTable.insertBuiltIn(float4, "cos", float4, "angle"); + + symbolTable.insertBuiltIn(float1, "tan", float1, "angle"); + symbolTable.insertBuiltIn(float2, "tan", float2, "angle"); + symbolTable.insertBuiltIn(float3, "tan", float3, "angle"); + symbolTable.insertBuiltIn(float4, "tan", float4, "angle"); + + symbolTable.insertBuiltIn(float1, "asin", float1, "x"); + symbolTable.insertBuiltIn(float2, "asin", float2, "x"); + symbolTable.insertBuiltIn(float3, "asin", float3, "x"); + symbolTable.insertBuiltIn(float4, "asin", float4, "x"); + + symbolTable.insertBuiltIn(float1, "acos", float1, "x"); + symbolTable.insertBuiltIn(float2, "acos", float2, "x"); + symbolTable.insertBuiltIn(float3, "acos", float3, "x"); + symbolTable.insertBuiltIn(float4, "acos", float4, "x"); + + symbolTable.insertBuiltIn(float1, "atan", float1, "y", float1, "x"); + symbolTable.insertBuiltIn(float2, "atan", float2, "y", float2, "x"); + symbolTable.insertBuiltIn(float3, "atan", float3, "y", float3, "x"); + symbolTable.insertBuiltIn(float4, "atan", float4, "y", float4, "x"); + + symbolTable.insertBuiltIn(float1, "atan", float1, "y_over_x"); + symbolTable.insertBuiltIn(float2, "atan", float2, "y_over_x"); + symbolTable.insertBuiltIn(float3, "atan", float3, "y_over_x"); + symbolTable.insertBuiltIn(float4, "atan", float4, "y_over_x"); // // Exponential Functions. // - s.append(TString("float pow(float x, float y);")); - s.append(TString("vec2 pow(vec2 x, vec2 y);")); - s.append(TString("vec3 pow(vec3 x, vec3 y);")); - s.append(TString("vec4 pow(vec4 x, vec4 y);")); - - s.append(TString("float exp(float x);")); - s.append(TString("vec2 exp(vec2 x);")); - s.append(TString("vec3 exp(vec3 x);")); - s.append(TString("vec4 exp(vec4 x);")); - - s.append(TString("float log(float x);")); - s.append(TString("vec2 log(vec2 x);")); - s.append(TString("vec3 log(vec3 x);")); - s.append(TString("vec4 log(vec4 x);")); - - s.append(TString("float exp2(float x);")); - s.append(TString("vec2 exp2(vec2 x);")); - s.append(TString("vec3 exp2(vec3 x);")); - s.append(TString("vec4 exp2(vec4 x);")); - - s.append(TString("float log2(float x);")); - s.append(TString("vec2 log2(vec2 x);")); - s.append(TString("vec3 log2(vec3 x);")); - s.append(TString("vec4 log2(vec4 x);")); - - s.append(TString("float sqrt(float x);")); - s.append(TString("vec2 sqrt(vec2 x);")); - s.append(TString("vec3 sqrt(vec3 x);")); - s.append(TString("vec4 sqrt(vec4 x);")); - - s.append(TString("float inversesqrt(float x);")); - s.append(TString("vec2 inversesqrt(vec2 x);")); - s.append(TString("vec3 inversesqrt(vec3 x);")); - s.append(TString("vec4 inversesqrt(vec4 x);")); + symbolTable.insertBuiltIn(float1, "pow", float1, "x", float1, "y"); + symbolTable.insertBuiltIn(float2, "pow", float2, "x", float2, "y"); + symbolTable.insertBuiltIn(float3, "pow", float3, "x", float3, "y"); + symbolTable.insertBuiltIn(float4, "pow", float4, "x", float4, "y"); + + symbolTable.insertBuiltIn(float1, "exp", float1, "x"); + symbolTable.insertBuiltIn(float2, "exp", float2, "x"); + symbolTable.insertBuiltIn(float3, "exp", float3, "x"); + symbolTable.insertBuiltIn(float4, "exp", float4, "x"); + + symbolTable.insertBuiltIn(float1, "log", float1, "x"); + symbolTable.insertBuiltIn(float2, "log", float2, "x"); + symbolTable.insertBuiltIn(float3, "log", float3, "x"); + symbolTable.insertBuiltIn(float4, "log", float4, "x"); + + symbolTable.insertBuiltIn(float1, "exp2", float1, "x"); + symbolTable.insertBuiltIn(float2, "exp2", float2, "x"); + symbolTable.insertBuiltIn(float3, "exp2", float3, "x"); + symbolTable.insertBuiltIn(float4, "exp2", float4, "x"); + + symbolTable.insertBuiltIn(float1, "log2", float1, "x"); + symbolTable.insertBuiltIn(float2, "log2", float2, "x"); + symbolTable.insertBuiltIn(float3, "log2", float3, "x"); + symbolTable.insertBuiltIn(float4, "log2", float4, "x"); + + symbolTable.insertBuiltIn(float1, "sqrt", float1, "x"); + symbolTable.insertBuiltIn(float2, "sqrt", float2, "x"); + symbolTable.insertBuiltIn(float3, "sqrt", float3, "x"); + symbolTable.insertBuiltIn(float4, "sqrt", float4, "x"); + + symbolTable.insertBuiltIn(float1, "inversesqrt", float1, "x"); + symbolTable.insertBuiltIn(float2, "inversesqrt", float2, "x"); + symbolTable.insertBuiltIn(float3, "inversesqrt", float3, "x"); + symbolTable.insertBuiltIn(float4, "inversesqrt", float4, "x"); // // Common Functions. // - s.append(TString("float abs(float x);")); - s.append(TString("vec2 abs(vec2 x);")); - s.append(TString("vec3 abs(vec3 x);")); - s.append(TString("vec4 abs(vec4 x);")); - - s.append(TString("float sign(float x);")); - s.append(TString("vec2 sign(vec2 x);")); - s.append(TString("vec3 sign(vec3 x);")); - s.append(TString("vec4 sign(vec4 x);")); - - s.append(TString("float floor(float x);")); - s.append(TString("vec2 floor(vec2 x);")); - s.append(TString("vec3 floor(vec3 x);")); - s.append(TString("vec4 floor(vec4 x);")); - - s.append(TString("float ceil(float x);")); - s.append(TString("vec2 ceil(vec2 x);")); - s.append(TString("vec3 ceil(vec3 x);")); - s.append(TString("vec4 ceil(vec4 x);")); - - s.append(TString("float fract(float x);")); - s.append(TString("vec2 fract(vec2 x);")); - s.append(TString("vec3 fract(vec3 x);")); - s.append(TString("vec4 fract(vec4 x);")); - - s.append(TString("float mod(float x, float y);")); - s.append(TString("vec2 mod(vec2 x, float y);")); - s.append(TString("vec3 mod(vec3 x, float y);")); - s.append(TString("vec4 mod(vec4 x, float y);")); - s.append(TString("vec2 mod(vec2 x, vec2 y);")); - s.append(TString("vec3 mod(vec3 x, vec3 y);")); - s.append(TString("vec4 mod(vec4 x, vec4 y);")); - - s.append(TString("float min(float x, float y);")); - s.append(TString("vec2 min(vec2 x, float y);")); - s.append(TString("vec3 min(vec3 x, float y);")); - s.append(TString("vec4 min(vec4 x, float y);")); - s.append(TString("vec2 min(vec2 x, vec2 y);")); - s.append(TString("vec3 min(vec3 x, vec3 y);")); - s.append(TString("vec4 min(vec4 x, vec4 y);")); - - s.append(TString("float max(float x, float y);")); - s.append(TString("vec2 max(vec2 x, float y);")); - s.append(TString("vec3 max(vec3 x, float y);")); - s.append(TString("vec4 max(vec4 x, float y);")); - s.append(TString("vec2 max(vec2 x, vec2 y);")); - s.append(TString("vec3 max(vec3 x, vec3 y);")); - s.append(TString("vec4 max(vec4 x, vec4 y);")); - - s.append(TString("float clamp(float x, float minVal, float maxVal);")); - s.append(TString("vec2 clamp(vec2 x, float minVal, float maxVal);")); - s.append(TString("vec3 clamp(vec3 x, float minVal, float maxVal);")); - s.append(TString("vec4 clamp(vec4 x, float minVal, float maxVal);")); - s.append(TString("vec2 clamp(vec2 x, vec2 minVal, vec2 maxVal);")); - s.append(TString("vec3 clamp(vec3 x, vec3 minVal, vec3 maxVal);")); - s.append(TString("vec4 clamp(vec4 x, vec4 minVal, vec4 maxVal);")); - - s.append(TString("float mix(float x, float y, float a);")); - s.append(TString("vec2 mix(vec2 x, vec2 y, float a);")); - s.append(TString("vec3 mix(vec3 x, vec3 y, float a);")); - s.append(TString("vec4 mix(vec4 x, vec4 y, float a);")); - s.append(TString("vec2 mix(vec2 x, vec2 y, vec2 a);")); - s.append(TString("vec3 mix(vec3 x, vec3 y, vec3 a);")); - s.append(TString("vec4 mix(vec4 x, vec4 y, vec4 a);")); - - s.append(TString("float step(float edge, float x);")); - s.append(TString("vec2 step(vec2 edge, vec2 x);")); - s.append(TString("vec3 step(vec3 edge, vec3 x);")); - s.append(TString("vec4 step(vec4 edge, vec4 x);")); - s.append(TString("vec2 step(float edge, vec2 x);")); - s.append(TString("vec3 step(float edge, vec3 x);")); - s.append(TString("vec4 step(float edge, vec4 x);")); - - s.append(TString("float smoothstep(float edge0, float edge1, float x);")); - s.append(TString("vec2 smoothstep(vec2 edge0, vec2 edge1, vec2 x);")); - s.append(TString("vec3 smoothstep(vec3 edge0, vec3 edge1, vec3 x);")); - s.append(TString("vec4 smoothstep(vec4 edge0, vec4 edge1, vec4 x);")); - s.append(TString("vec2 smoothstep(float edge0, float edge1, vec2 x);")); - s.append(TString("vec3 smoothstep(float edge0, float edge1, vec3 x);")); - s.append(TString("vec4 smoothstep(float edge0, float edge1, vec4 x);")); + symbolTable.insertBuiltIn(float1, "abs", float1, "x"); + symbolTable.insertBuiltIn(float2, "abs", float2, "x"); + symbolTable.insertBuiltIn(float3, "abs", float3, "x"); + symbolTable.insertBuiltIn(float4, "abs", float4, "x"); + + symbolTable.insertBuiltIn(float1, "sign", float1, "x"); + symbolTable.insertBuiltIn(float2, "sign", float2, "x"); + symbolTable.insertBuiltIn(float3, "sign", float3, "x"); + symbolTable.insertBuiltIn(float4, "sign", float4, "x"); + + symbolTable.insertBuiltIn(float1, "floor", float1, "x"); + symbolTable.insertBuiltIn(float2, "floor", float2, "x"); + symbolTable.insertBuiltIn(float3, "floor", float3, "x"); + symbolTable.insertBuiltIn(float4, "floor", float4, "x"); + + symbolTable.insertBuiltIn(float1, "ceil", float1, "x"); + symbolTable.insertBuiltIn(float2, "ceil", float2, "x"); + symbolTable.insertBuiltIn(float3, "ceil", float3, "x"); + symbolTable.insertBuiltIn(float4, "ceil", float4, "x"); + + symbolTable.insertBuiltIn(float1, "fract", float1, "x"); + symbolTable.insertBuiltIn(float2, "fract", float2, "x"); + symbolTable.insertBuiltIn(float3, "fract", float3, "x"); + symbolTable.insertBuiltIn(float4, "fract", float4, "x"); + + symbolTable.insertBuiltIn(float1, "mod", float1, "x", float1, "y"); + symbolTable.insertBuiltIn(float2, "mod", float2, "x", float1, "y"); + symbolTable.insertBuiltIn(float3, "mod", float3, "x", float1, "y"); + symbolTable.insertBuiltIn(float4, "mod", float4, "x", float1, "y"); + symbolTable.insertBuiltIn(float2, "mod", float2, "x", float2, "y"); + symbolTable.insertBuiltIn(float3, "mod", float3, "x", float3, "y"); + symbolTable.insertBuiltIn(float4, "mod", float4, "x", float4, "y"); + + symbolTable.insertBuiltIn(float1, "min", float1, "x", float1, "y"); + symbolTable.insertBuiltIn(float2, "min", float2, "x", float1, "y"); + symbolTable.insertBuiltIn(float3, "min", float3, "x", float1, "y"); + symbolTable.insertBuiltIn(float4, "min", float4, "x", float1, "y"); + symbolTable.insertBuiltIn(float2, "min", float2, "x", float2, "y"); + symbolTable.insertBuiltIn(float3, "min", float3, "x", float3, "y"); + symbolTable.insertBuiltIn(float4, "min", float4, "x", float4, "y"); + + symbolTable.insertBuiltIn(float1, "max", float1, "x", float1, "y"); + symbolTable.insertBuiltIn(float2, "max", float2, "x", float1, "y"); + symbolTable.insertBuiltIn(float3, "max", float3, "x", float1, "y"); + symbolTable.insertBuiltIn(float4, "max", float4, "x", float1, "y"); + symbolTable.insertBuiltIn(float2, "max", float2, "x", float2, "y"); + symbolTable.insertBuiltIn(float3, "max", float3, "x", float3, "y"); + symbolTable.insertBuiltIn(float4, "max", float4, "x", float4, "y"); + + symbolTable.insertBuiltIn(float1, "clamp", float1, "x", float1, "minVal", float1, "maxVal"); + symbolTable.insertBuiltIn(float2, "clamp", float2, "x", float1, "minVal", float1, "maxVal"); + symbolTable.insertBuiltIn(float3, "clamp", float3, "x", float1, "minVal", float1, "maxVal"); + symbolTable.insertBuiltIn(float4, "clamp", float4, "x", float1, "minVal", float1, "maxVal"); + symbolTable.insertBuiltIn(float2, "clamp", float2, "x", float2, "minVal", float2, "maxVal"); + symbolTable.insertBuiltIn(float3, "clamp", float3, "x", float3, "minVal", float3, "maxVal"); + symbolTable.insertBuiltIn(float4, "clamp", float4, "x", float4, "minVal", float4, "maxVal"); + + symbolTable.insertBuiltIn(float1, "mix", float1, "x", float1, "y", float1, "a"); + symbolTable.insertBuiltIn(float2, "mix", float2, "x", float2, "y", float1, "a"); + symbolTable.insertBuiltIn(float3, "mix", float3, "x", float3, "y", float1, "a"); + symbolTable.insertBuiltIn(float4, "mix", float4, "x", float4, "y", float1, "a"); + symbolTable.insertBuiltIn(float2, "mix", float2, "x", float2, "y", float2, "a"); + symbolTable.insertBuiltIn(float3, "mix", float3, "x", float3, "y", float3, "a"); + symbolTable.insertBuiltIn(float4, "mix", float4, "x", float4, "y", float4, "a"); + + symbolTable.insertBuiltIn(float1, "step", float1, "edge", float1, "x"); + symbolTable.insertBuiltIn(float2, "step", float2, "edge", float2, "x"); + symbolTable.insertBuiltIn(float3, "step", float3, "edge", float3, "x"); + symbolTable.insertBuiltIn(float4, "step", float4, "edge", float4, "x"); + symbolTable.insertBuiltIn(float2, "step", float1, "edge", float2, "x"); + symbolTable.insertBuiltIn(float3, "step", float1, "edge", float3, "x"); + symbolTable.insertBuiltIn(float4, "step", float1, "edge", float4, "x"); + + symbolTable.insertBuiltIn(float1, "smoothstep", float1, "edge0", float1, "edge1", float1, "x"); + symbolTable.insertBuiltIn(float2, "smoothstep", float2, "edge0", float2, "edge1", float2, "x"); + symbolTable.insertBuiltIn(float3, "smoothstep", float3, "edge0", float3, "edge1", float3, "x"); + symbolTable.insertBuiltIn(float4, "smoothstep", float4, "edge0", float4, "edge1", float4, "x"); + symbolTable.insertBuiltIn(float2, "smoothstep", float1, "edge0", float1, "edge1", float2, "x"); + symbolTable.insertBuiltIn(float3, "smoothstep", float1, "edge0", float1, "edge1", float3, "x"); + symbolTable.insertBuiltIn(float4, "smoothstep", float1, "edge0", float1, "edge1", float4, "x"); // // Geometric Functions. // - s.append(TString("float length(float x);")); - s.append(TString("float length(vec2 x);")); - s.append(TString("float length(vec3 x);")); - s.append(TString("float length(vec4 x);")); - - s.append(TString("float distance(float p0, float p1);")); - s.append(TString("float distance(vec2 p0, vec2 p1);")); - s.append(TString("float distance(vec3 p0, vec3 p1);")); - s.append(TString("float distance(vec4 p0, vec4 p1);")); - - s.append(TString("float dot(float x, float y);")); - s.append(TString("float dot(vec2 x, vec2 y);")); - s.append(TString("float dot(vec3 x, vec3 y);")); - s.append(TString("float dot(vec4 x, vec4 y);")); - - s.append(TString("vec3 cross(vec3 x, vec3 y);")); - s.append(TString("float normalize(float x);")); - s.append(TString("vec2 normalize(vec2 x);")); - s.append(TString("vec3 normalize(vec3 x);")); - s.append(TString("vec4 normalize(vec4 x);")); - - s.append(TString("float faceforward(float N, float I, float Nref);")); - s.append(TString("vec2 faceforward(vec2 N, vec2 I, vec2 Nref);")); - s.append(TString("vec3 faceforward(vec3 N, vec3 I, vec3 Nref);")); - s.append(TString("vec4 faceforward(vec4 N, vec4 I, vec4 Nref);")); - - s.append(TString("float reflect(float I, float N);")); - s.append(TString("vec2 reflect(vec2 I, vec2 N);")); - s.append(TString("vec3 reflect(vec3 I, vec3 N);")); - s.append(TString("vec4 reflect(vec4 I, vec4 N);")); - - s.append(TString("float refract(float I, float N, float eta);")); - s.append(TString("vec2 refract(vec2 I, vec2 N, float eta);")); - s.append(TString("vec3 refract(vec3 I, vec3 N, float eta);")); - s.append(TString("vec4 refract(vec4 I, vec4 N, float eta);")); + symbolTable.insertBuiltIn(float1, "length", float1, "x"); + symbolTable.insertBuiltIn(float1, "length", float2, "x"); + symbolTable.insertBuiltIn(float1, "length", float3, "x"); + symbolTable.insertBuiltIn(float1, "length", float4, "x"); + + symbolTable.insertBuiltIn(float1, "distance", float1, "p0", float1, "p1"); + symbolTable.insertBuiltIn(float1, "distance", float2, "p0", float2, "p1"); + symbolTable.insertBuiltIn(float1, "distance", float3, "p0", float3, "p1"); + symbolTable.insertBuiltIn(float1, "distance", float4, "p0", float4, "p1"); + + symbolTable.insertBuiltIn(float1, "dot", float1, "x", float1, "y"); + symbolTable.insertBuiltIn(float1, "dot", float2, "x", float2, "y"); + symbolTable.insertBuiltIn(float1, "dot", float3, "x", float3, "y"); + symbolTable.insertBuiltIn(float1, "dot", float4, "x", float4, "y"); + + symbolTable.insertBuiltIn(float3, "cross", float3, "x", float3, "y"); + symbolTable.insertBuiltIn(float1, "normalize", float1, "x"); + symbolTable.insertBuiltIn(float2, "normalize", float2, "x"); + symbolTable.insertBuiltIn(float3, "normalize", float3, "x"); + symbolTable.insertBuiltIn(float4, "normalize", float4, "x"); + + symbolTable.insertBuiltIn(float1, "faceforward", float1, "N", float1, "I", float1, "Nref"); + symbolTable.insertBuiltIn(float2, "faceforward", float2, "N", float2, "I", float2, "Nref"); + symbolTable.insertBuiltIn(float3, "faceforward", float3, "N", float3, "I", float3, "Nref"); + symbolTable.insertBuiltIn(float4, "faceforward", float4, "N", float4, "I", float4, "Nref"); + + symbolTable.insertBuiltIn(float1, "reflect", float1, "I", float1, "N"); + symbolTable.insertBuiltIn(float2, "reflect", float2, "I", float2, "N"); + symbolTable.insertBuiltIn(float3, "reflect", float3, "I", float3, "N"); + symbolTable.insertBuiltIn(float4, "reflect", float4, "I", float4, "N"); + + symbolTable.insertBuiltIn(float1, "refract", float1, "I", float1, "N", float1, "eta"); + symbolTable.insertBuiltIn(float2, "refract", float2, "I", float2, "N", float1, "eta"); + symbolTable.insertBuiltIn(float3, "refract", float3, "I", float3, "N", float1, "eta"); + symbolTable.insertBuiltIn(float4, "refract", float4, "I", float4, "N", float1, "eta"); + + TType *mat2 = new TType(EbtFloat, EbpUndefined, EvqGlobal, 2, true); + TType *mat3 = new TType(EbtFloat, EbpUndefined, EvqGlobal, 3, true); + TType *mat4 = new TType(EbtFloat, EbpUndefined, EvqGlobal, 4, true); // // Matrix Functions. // - s.append(TString("mat2 matrixCompMult(mat2 x, mat2 y);")); - s.append(TString("mat3 matrixCompMult(mat3 x, mat3 y);")); - s.append(TString("mat4 matrixCompMult(mat4 x, mat4 y);")); + symbolTable.insertBuiltIn(mat2, "matrixCompMult", mat2, "x", mat2, "y"); + symbolTable.insertBuiltIn(mat3, "matrixCompMult", mat3, "x", mat3, "y"); + symbolTable.insertBuiltIn(mat4, "matrixCompMult", mat4, "x", mat4, "y"); + + TType *bool1 = new TType(EbtBool, EbpUndefined, EvqGlobal, 1); + TType *bool2 = new TType(EbtBool, EbpUndefined, EvqGlobal, 2); + TType *bool3 = new TType(EbtBool, EbpUndefined, EvqGlobal, 3); + TType *bool4 = new TType(EbtBool, EbpUndefined, EvqGlobal, 4); // // Vector relational functions. // - s.append(TString("bvec2 lessThan(vec2 x, vec2 y);")); - s.append(TString("bvec3 lessThan(vec3 x, vec3 y);")); - s.append(TString("bvec4 lessThan(vec4 x, vec4 y);")); - - s.append(TString("bvec2 lessThan(ivec2 x, ivec2 y);")); - s.append(TString("bvec3 lessThan(ivec3 x, ivec3 y);")); - s.append(TString("bvec4 lessThan(ivec4 x, ivec4 y);")); + symbolTable.insertBuiltIn(bool2, "lessThan", float2, "x", float2, "y"); + symbolTable.insertBuiltIn(bool3, "lessThan", float3, "x", float3, "y"); + symbolTable.insertBuiltIn(bool4, "lessThan", float4, "x", float4, "y"); - s.append(TString("bvec2 lessThanEqual(vec2 x, vec2 y);")); - s.append(TString("bvec3 lessThanEqual(vec3 x, vec3 y);")); - s.append(TString("bvec4 lessThanEqual(vec4 x, vec4 y);")); + symbolTable.insertBuiltIn(bool2, "lessThan", int2, "x", int2, "y"); + symbolTable.insertBuiltIn(bool3, "lessThan", int3, "x", int3, "y"); + symbolTable.insertBuiltIn(bool4, "lessThan", int4, "x", int4, "y"); - s.append(TString("bvec2 lessThanEqual(ivec2 x, ivec2 y);")); - s.append(TString("bvec3 lessThanEqual(ivec3 x, ivec3 y);")); - s.append(TString("bvec4 lessThanEqual(ivec4 x, ivec4 y);")); + symbolTable.insertBuiltIn(bool2, "lessThanEqual", float2, "x", float2, "y"); + symbolTable.insertBuiltIn(bool3, "lessThanEqual", float3, "x", float3, "y"); + symbolTable.insertBuiltIn(bool4, "lessThanEqual", float4, "x", float4, "y"); - s.append(TString("bvec2 greaterThan(vec2 x, vec2 y);")); - s.append(TString("bvec3 greaterThan(vec3 x, vec3 y);")); - s.append(TString("bvec4 greaterThan(vec4 x, vec4 y);")); + symbolTable.insertBuiltIn(bool2, "lessThanEqual", int2, "x", int2, "y"); + symbolTable.insertBuiltIn(bool3, "lessThanEqual", int3, "x", int3, "y"); + symbolTable.insertBuiltIn(bool4, "lessThanEqual", int4, "x", int4, "y"); - s.append(TString("bvec2 greaterThan(ivec2 x, ivec2 y);")); - s.append(TString("bvec3 greaterThan(ivec3 x, ivec3 y);")); - s.append(TString("bvec4 greaterThan(ivec4 x, ivec4 y);")); + symbolTable.insertBuiltIn(bool2, "greaterThan", float2, "x", float2, "y"); + symbolTable.insertBuiltIn(bool3, "greaterThan", float3, "x", float3, "y"); + symbolTable.insertBuiltIn(bool4, "greaterThan", float4, "x", float4, "y"); - s.append(TString("bvec2 greaterThanEqual(vec2 x, vec2 y);")); - s.append(TString("bvec3 greaterThanEqual(vec3 x, vec3 y);")); - s.append(TString("bvec4 greaterThanEqual(vec4 x, vec4 y);")); + symbolTable.insertBuiltIn(bool2, "greaterThan", int2, "x", int2, "y"); + symbolTable.insertBuiltIn(bool3, "greaterThan", int3, "x", int3, "y"); + symbolTable.insertBuiltIn(bool4, "greaterThan", int4, "x", int4, "y"); - s.append(TString("bvec2 greaterThanEqual(ivec2 x, ivec2 y);")); - s.append(TString("bvec3 greaterThanEqual(ivec3 x, ivec3 y);")); - s.append(TString("bvec4 greaterThanEqual(ivec4 x, ivec4 y);")); + symbolTable.insertBuiltIn(bool2, "greaterThanEqual", float2, "x", float2, "y"); + symbolTable.insertBuiltIn(bool3, "greaterThanEqual", float3, "x", float3, "y"); + symbolTable.insertBuiltIn(bool4, "greaterThanEqual", float4, "x", float4, "y"); - s.append(TString("bvec2 equal(vec2 x, vec2 y);")); - s.append(TString("bvec3 equal(vec3 x, vec3 y);")); - s.append(TString("bvec4 equal(vec4 x, vec4 y);")); + symbolTable.insertBuiltIn(bool2, "greaterThanEqual", int2, "x", int2, "y"); + symbolTable.insertBuiltIn(bool3, "greaterThanEqual", int3, "x", int3, "y"); + symbolTable.insertBuiltIn(bool4, "greaterThanEqual", int4, "x", int4, "y"); - s.append(TString("bvec2 equal(ivec2 x, ivec2 y);")); - s.append(TString("bvec3 equal(ivec3 x, ivec3 y);")); - s.append(TString("bvec4 equal(ivec4 x, ivec4 y);")); + symbolTable.insertBuiltIn(bool2, "equal", float2, "x", float2, "y"); + symbolTable.insertBuiltIn(bool3, "equal", float3, "x", float3, "y"); + symbolTable.insertBuiltIn(bool4, "equal", float4, "x", float4, "y"); - s.append(TString("bvec2 equal(bvec2 x, bvec2 y);")); - s.append(TString("bvec3 equal(bvec3 x, bvec3 y);")); - s.append(TString("bvec4 equal(bvec4 x, bvec4 y);")); + symbolTable.insertBuiltIn(bool2, "equal", int2, "x", int2, "y"); + symbolTable.insertBuiltIn(bool3, "equal", int3, "x", int3, "y"); + symbolTable.insertBuiltIn(bool4, "equal", int4, "x", int4, "y"); - s.append(TString("bvec2 notEqual(vec2 x, vec2 y);")); - s.append(TString("bvec3 notEqual(vec3 x, vec3 y);")); - s.append(TString("bvec4 notEqual(vec4 x, vec4 y);")); + symbolTable.insertBuiltIn(bool2, "equal", bool2, "x", bool2, "y"); + symbolTable.insertBuiltIn(bool3, "equal", bool3, "x", bool3, "y"); + symbolTable.insertBuiltIn(bool4, "equal", bool4, "x", bool4, "y"); - s.append(TString("bvec2 notEqual(ivec2 x, ivec2 y);")); - s.append(TString("bvec3 notEqual(ivec3 x, ivec3 y);")); - s.append(TString("bvec4 notEqual(ivec4 x, ivec4 y);")); + symbolTable.insertBuiltIn(bool2, "notEqual", float2, "x", float2, "y"); + symbolTable.insertBuiltIn(bool3, "notEqual", float3, "x", float3, "y"); + symbolTable.insertBuiltIn(bool4, "notEqual", float4, "x", float4, "y"); - s.append(TString("bvec2 notEqual(bvec2 x, bvec2 y);")); - s.append(TString("bvec3 notEqual(bvec3 x, bvec3 y);")); - s.append(TString("bvec4 notEqual(bvec4 x, bvec4 y);")); + symbolTable.insertBuiltIn(bool2, "notEqual", int2, "x", int2, "y"); + symbolTable.insertBuiltIn(bool3, "notEqual", int3, "x", int3, "y"); + symbolTable.insertBuiltIn(bool4, "notEqual", int4, "x", int4, "y"); - s.append(TString("bool any(bvec2 x);")); - s.append(TString("bool any(bvec3 x);")); - s.append(TString("bool any(bvec4 x);")); + symbolTable.insertBuiltIn(bool2, "notEqual", bool2, "x", bool2, "y"); + symbolTable.insertBuiltIn(bool3, "notEqual", bool3, "x", bool3, "y"); + symbolTable.insertBuiltIn(bool4, "notEqual", bool4, "x", bool4, "y"); - s.append(TString("bool all(bvec2 x);")); - s.append(TString("bool all(bvec3 x);")); - s.append(TString("bool all(bvec4 x);")); + symbolTable.insertBuiltIn(bool1, "any", bool2, "x"); + symbolTable.insertBuiltIn(bool1, "any", bool3, "x"); + symbolTable.insertBuiltIn(bool1, "any", bool4, "x"); - s.append(TString("bvec2 not(bvec2 x);")); - s.append(TString("bvec3 not(bvec3 x);")); - s.append(TString("bvec4 not(bvec4 x);")); + symbolTable.insertBuiltIn(bool1, "all", bool2, "x"); + symbolTable.insertBuiltIn(bool1, "all", bool3, "x"); + symbolTable.insertBuiltIn(bool1, "all", bool4, "x"); - // - // Texture Functions. - // - s.append(TString("vec4 texture2D(sampler2D sampler, vec2 coord);")); - s.append(TString("vec4 texture2DProj(sampler2D sampler, vec3 coord);")); - s.append(TString("vec4 texture2DProj(sampler2D sampler, vec4 coord);")); - s.append(TString("vec4 textureCube(samplerCube sampler, vec3 coord);")); - - if (resources.OES_EGL_image_external) { - s.append(TString("vec4 texture2D(samplerExternalOES sampler, vec2 coord);")); - s.append(TString("vec4 texture2DProj(samplerExternalOES sampler, vec3 coord);")); - s.append(TString("vec4 texture2DProj(samplerExternalOES sampler, vec4 coord);")); - } + symbolTable.insertBuiltIn(bool2, "not", bool2, "x"); + symbolTable.insertBuiltIn(bool3, "not", bool3, "x"); + symbolTable.insertBuiltIn(bool4, "not", bool4, "x"); - if (resources.ARB_texture_rectangle) { - s.append(TString("vec4 texture2DRect(sampler2DRect sampler, vec2 coord);")); - s.append(TString("vec4 texture2DRectProj(sampler2DRect sampler, vec3 coord);")); - s.append(TString("vec4 texture2DRectProj(sampler2DRect sampler, vec4 coord);")); - } + TType *sampler2D = new TType(EbtSampler2D, EbpUndefined, EvqGlobal, 1); + TType *samplerCube = new TType(EbtSamplerCube, EbpUndefined, EvqGlobal, 1); // - // Noise functions. + // Texture Functions // - //s.append(TString("float noise1(float x);")); - //s.append(TString("float noise1(vec2 x);")); - //s.append(TString("float noise1(vec3 x);")); - //s.append(TString("float noise1(vec4 x);")); - - //s.append(TString("vec2 noise2(float x);")); - //s.append(TString("vec2 noise2(vec2 x);")); - //s.append(TString("vec2 noise2(vec3 x);")); - //s.append(TString("vec2 noise2(vec4 x);")); - - //s.append(TString("vec3 noise3(float x);")); - //s.append(TString("vec3 noise3(vec2 x);")); - //s.append(TString("vec3 noise3(vec3 x);")); - //s.append(TString("vec3 noise3(vec4 x);")); - - //s.append(TString("vec4 noise4(float x);")); - //s.append(TString("vec4 noise4(vec2 x);")); - //s.append(TString("vec4 noise4(vec3 x);")); - //s.append(TString("vec4 noise4(vec4 x);")); - - return s; -} + symbolTable.insertBuiltIn(float4, "texture2D", sampler2D, "sampler", float2, "coord"); + symbolTable.insertBuiltIn(float4, "texture2DProj", sampler2D, "sampler", float3, "coord"); + symbolTable.insertBuiltIn(float4, "texture2DProj", sampler2D, "sampler", float4, "coord"); + symbolTable.insertBuiltIn(float4, "textureCube", samplerCube, "sampler", float3, "coord"); -//============================================================================ -// -// Prototypes for built-in functions seen by vertex shaders only. -// -//============================================================================ -static TString BuiltInFunctionsVertex(const ShBuiltInResources& resources) -{ - TString s; - - // - // Geometric Functions. - // - //s.append(TString("vec4 ftransform();")); - - // - // Texture Functions. - // - s.append(TString("vec4 texture2DLod(sampler2D sampler, vec2 coord, float lod);")); - s.append(TString("vec4 texture2DProjLod(sampler2D sampler, vec3 coord, float lod);")); - s.append(TString("vec4 texture2DProjLod(sampler2D sampler, vec4 coord, float lod);")); - s.append(TString("vec4 textureCubeLod(samplerCube sampler, vec3 coord, float lod);")); + if (resources.OES_EGL_image_external) + { + TType *samplerExternalOES = new TType(EbtSamplerExternalOES, EbpUndefined, EvqGlobal, 1); - return s; -} + symbolTable.insertBuiltIn(float4, "texture2D", samplerExternalOES, "sampler", float2, "coord"); + symbolTable.insertBuiltIn(float4, "texture2DProj", samplerExternalOES, "sampler", float3, "coord"); + symbolTable.insertBuiltIn(float4, "texture2DProj", samplerExternalOES, "sampler", float4, "coord"); + } -//============================================================================ -// -// Prototypes for built-in functions seen by fragment shaders only. -// -//============================================================================ -static TString BuiltInFunctionsFragment(const ShBuiltInResources& resources) -{ - TString s; + if (resources.ARB_texture_rectangle) + { + TType *sampler2DRect = new TType(EbtSampler2DRect, EbpUndefined, EvqGlobal, 1); - // - // Texture Functions. - // - s.append(TString("vec4 texture2D(sampler2D sampler, vec2 coord, float bias);")); - s.append(TString("vec4 texture2DProj(sampler2D sampler, vec3 coord, float bias);")); - s.append(TString("vec4 texture2DProj(sampler2D sampler, vec4 coord, float bias);")); - s.append(TString("vec4 textureCube(samplerCube sampler, vec3 coord, float bias);")); - - if (resources.OES_standard_derivatives) { - s.append(TString("float dFdx(float p);")); - s.append(TString("vec2 dFdx(vec2 p);")); - s.append(TString("vec3 dFdx(vec3 p);")); - s.append(TString("vec4 dFdx(vec4 p);")); - - s.append(TString("float dFdy(float p);")); - s.append(TString("vec2 dFdy(vec2 p);")); - s.append(TString("vec3 dFdy(vec3 p);")); - s.append(TString("vec4 dFdy(vec4 p);")); - - s.append(TString("float fwidth(float p);")); - s.append(TString("vec2 fwidth(vec2 p);")); - s.append(TString("vec3 fwidth(vec3 p);")); - s.append(TString("vec4 fwidth(vec4 p);")); + symbolTable.insertBuiltIn(float4, "texture2DRect", sampler2DRect, "sampler", float2, "coord"); + symbolTable.insertBuiltIn(float4, "texture2DRectProj", sampler2DRect, "sampler", float3, "coord"); + symbolTable.insertBuiltIn(float4, "texture2DRectProj", sampler2DRect, "sampler", float4, "coord"); } - return s; -} + if(type == SH_FRAGMENT_SHADER) + { + symbolTable.insertBuiltIn(float4, "texture2D", sampler2D, "sampler", float2, "coord", float1, "bias"); + symbolTable.insertBuiltIn(float4, "texture2DProj", sampler2D, "sampler", float3, "coord", float1, "bias"); + symbolTable.insertBuiltIn(float4, "texture2DProj", sampler2D, "sampler", float4, "coord", float1, "bias"); + symbolTable.insertBuiltIn(float4, "textureCube", samplerCube, "sampler", float3, "coord", float1, "bias"); + + if (resources.OES_standard_derivatives) + { + symbolTable.insertBuiltIn(float1, "dFdx", float1, "p"); + symbolTable.insertBuiltIn(float2, "dFdx", float2, "p"); + symbolTable.insertBuiltIn(float3, "dFdx", float3, "p"); + symbolTable.insertBuiltIn(float4, "dFdx", float4, "p"); + + symbolTable.insertBuiltIn(float1, "dFdy", float1, "p"); + symbolTable.insertBuiltIn(float2, "dFdy", float2, "p"); + symbolTable.insertBuiltIn(float3, "dFdy", float3, "p"); + symbolTable.insertBuiltIn(float4, "dFdy", float4, "p"); + + symbolTable.insertBuiltIn(float1, "fwidth", float1, "p"); + symbolTable.insertBuiltIn(float2, "fwidth", float2, "p"); + symbolTable.insertBuiltIn(float3, "fwidth", float3, "p"); + symbolTable.insertBuiltIn(float4, "fwidth", float4, "p"); + } + } -//============================================================================ -// -// Standard uniforms. -// -//============================================================================ -static TString StandardUniforms() -{ - TString s; + if(type == SH_VERTEX_SHADER) + { + symbolTable.insertBuiltIn(float4, "texture2DLod", sampler2D, "sampler", float2, "coord", float1, "lod"); + symbolTable.insertBuiltIn(float4, "texture2DProjLod", sampler2D, "sampler", float3, "coord", float1, "lod"); + symbolTable.insertBuiltIn(float4, "texture2DProjLod", sampler2D, "sampler", float4, "coord", float1, "lod"); + symbolTable.insertBuiltIn(float4, "textureCubeLod", samplerCube, "sampler", float3, "coord", float1, "lod"); + } // // Depth range in window coordinates // - s.append(TString("struct gl_DepthRangeParameters {")); - s.append(TString(" highp float near;")); // n - s.append(TString(" highp float far;")); // f - s.append(TString(" highp float diff;")); // f - n - s.append(TString("};")); - s.append(TString("uniform gl_DepthRangeParameters gl_DepthRange;")); - - return s; -} - -//============================================================================ -// -// Default precision for vertex shaders. -// -//============================================================================ -static TString DefaultPrecisionVertex() -{ - TString s; - - s.append(TString("precision highp int;")); - s.append(TString("precision highp float;")); - - return s; -} - -//============================================================================ -// -// Default precision for fragment shaders. -// -//============================================================================ -static TString DefaultPrecisionFragment() -{ - TString s; - - s.append(TString("precision mediump int;")); - // No default precision for float in fragment shaders - - return s; -} - -//============================================================================ -// -// Implementation dependent built-in constants. -// -//============================================================================ -static TString BuiltInConstants(ShShaderSpec spec, const ShBuiltInResources &resources, const TExtensionBehavior& extensionBehavior) -{ - TStringStream s; - - s << "const int gl_MaxVertexAttribs = " << resources.MaxVertexAttribs << ";"; - s << "const int gl_MaxVertexUniformVectors = " << resources.MaxVertexUniformVectors << ";"; + TFieldList *fields = NewPoolTFieldList(); + TField *near = new TField(new TType(EbtFloat, EbpHigh, EvqGlobal, 1), NewPoolTString("near")); + TField *far = new TField(new TType(EbtFloat, EbpHigh, EvqGlobal, 1), NewPoolTString("far")); + TField *diff = new TField(new TType(EbtFloat, EbpHigh, EvqGlobal, 1), NewPoolTString("diff")); + fields->push_back(near); + fields->push_back(far); + fields->push_back(diff); + TStructure *depthRangeStruct = new TStructure(NewPoolTString("gl_DepthRangeParameters"), fields); + TVariable *depthRangeParameters = new TVariable(&depthRangeStruct->name(), depthRangeStruct, true); + symbolTable.insert(*depthRangeParameters); + TVariable *depthRange = new TVariable(NewPoolTString("gl_DepthRange"), TType(depthRangeStruct)); + depthRange->setQualifier(EvqUniform); + symbolTable.insert(*depthRange); - s << "const int gl_MaxVaryingVectors = " << resources.MaxVaryingVectors << ";"; - s << "const int gl_MaxVertexTextureImageUnits = " << resources.MaxVertexTextureImageUnits << ";"; - s << "const int gl_MaxCombinedTextureImageUnits = " << resources.MaxCombinedTextureImageUnits << ";"; - s << "const int gl_MaxTextureImageUnits = " << resources.MaxTextureImageUnits << ";"; - s << "const int gl_MaxFragmentUniformVectors = " << resources.MaxFragmentUniformVectors << ";"; + // + // Implementation dependent built-in constants. + // + symbolTable.insertConstInt("gl_MaxVertexAttribs", resources.MaxVertexAttribs); + symbolTable.insertConstInt("gl_MaxVertexUniformVectors", resources.MaxVertexUniformVectors); + symbolTable.insertConstInt("gl_MaxVaryingVectors", resources.MaxVaryingVectors); + symbolTable.insertConstInt("gl_MaxVertexTextureImageUnits", resources.MaxVertexTextureImageUnits); + symbolTable.insertConstInt("gl_MaxCombinedTextureImageUnits", resources.MaxCombinedTextureImageUnits); + symbolTable.insertConstInt("gl_MaxTextureImageUnits", resources.MaxTextureImageUnits); + symbolTable.insertConstInt("gl_MaxFragmentUniformVectors", resources.MaxFragmentUniformVectors); if (spec != SH_CSS_SHADERS_SPEC) { @@ -494,40 +419,13 @@ static TString BuiltInConstants(ShShaderSpec spec, const ShBuiltInResources &res const bool usingMRTExtension = (iter != extensionBehavior.end() && (iter->second == EBhEnable || iter->second == EBhRequire)); const int maxDrawBuffers = (usingMRTExtension ? resources.MaxDrawBuffers : 1); - s << "const int gl_MaxDrawBuffers = " << maxDrawBuffers << ";"; + symbolTable.insertConstInt("gl_MaxDrawBuffers", maxDrawBuffers); } - - return s.str(); -} - -void TBuiltIns::initialize(ShShaderType type, ShShaderSpec spec, - const ShBuiltInResources& resources, - const TExtensionBehavior& extensionBehavior) -{ - switch (type) { - case SH_FRAGMENT_SHADER: - builtInStrings.push_back(DefaultPrecisionFragment()); - builtInStrings.push_back(BuiltInFunctionsCommon(resources)); - builtInStrings.push_back(BuiltInFunctionsFragment(resources)); - builtInStrings.push_back(StandardUniforms()); - break; - - case SH_VERTEX_SHADER: - builtInStrings.push_back(DefaultPrecisionVertex()); - builtInStrings.push_back(BuiltInFunctionsCommon(resources)); - builtInStrings.push_back(BuiltInFunctionsVertex(resources)); - builtInStrings.push_back(StandardUniforms()); - break; - - default: assert(false && "Language not supported"); - } - - builtInStrings.push_back(BuiltInConstants(spec, resources, extensionBehavior)); } void IdentifyBuiltIns(ShShaderType type, ShShaderSpec spec, - const ShBuiltInResources& resources, - TSymbolTable& symbolTable) + const ShBuiltInResources &resources, + TSymbolTable &symbolTable) { // // First, insert some special built-in variables that are not in @@ -571,8 +469,6 @@ void IdentifyBuiltIns(ShShaderType type, ShShaderSpec spec, // expected to be resolved through a library of functions, versus as // operations. // - symbolTable.relateToOperator("not", EOpVectorLogicalNot); - symbolTable.relateToOperator("matrixCompMult", EOpMul); symbolTable.relateToOperator("equal", EOpVectorEqual); @@ -623,6 +519,7 @@ void IdentifyBuiltIns(ShShaderType type, ShShaderSpec spec, symbolTable.relateToOperator("any", EOpAny); symbolTable.relateToOperator("all", EOpAll); + symbolTable.relateToOperator("not", EOpVectorLogicalNot); // Map language-specific operators. switch(type) { diff --git a/src/compiler/Initialize.h b/src/compiler/Initialize.h index c76a05a3..d08700cc 100644 --- a/src/compiler/Initialize.h +++ b/src/compiler/Initialize.h @@ -1,5 +1,5 @@ // -// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved. +// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -11,20 +11,8 @@ #include "compiler/ShHandle.h" #include "compiler/SymbolTable.h" -typedef TVector<TString> TBuiltInStrings; - -class TBuiltIns { -public: - POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator) - - void initialize(ShShaderType type, ShShaderSpec spec, - const ShBuiltInResources& resources, - const TExtensionBehavior& extensionBehavior); - const TBuiltInStrings& getBuiltInStrings() { return builtInStrings; } - -protected: - TBuiltInStrings builtInStrings; -}; +void InsertBuiltInFunctions(ShShaderType type, ShShaderSpec spec, const ShBuiltInResources &resources, + const TExtensionBehavior &extensionBehavior, TSymbolTable &table); void IdentifyBuiltIns(ShShaderType type, ShShaderSpec spec, const ShBuiltInResources& resources, diff --git a/src/compiler/Intermediate.cpp b/src/compiler/Intermediate.cpp index a2b3ddec..3b662218 100644 --- a/src/compiler/Intermediate.cpp +++ b/src/compiler/Intermediate.cpp @@ -1019,23 +1019,22 @@ bool TIntermBinary::promote(TInfoSink& infoSink) bool CompareStruct(const TType& leftNodeType, ConstantUnion* rightUnionArray, ConstantUnion* leftUnionArray) { - const TTypeList* fields = leftNodeType.getStruct(); + const TFieldList& fields = leftNodeType.getStruct()->fields(); - size_t structSize = fields->size(); + size_t structSize = fields.size(); size_t index = 0; for (size_t j = 0; j < structSize; j++) { - size_t size = (*fields)[j]->getObjectSize(); + size_t size = fields[j]->type()->getObjectSize(); for (size_t i = 0; i < size; i++) { - if ((*fields)[j]->getBasicType() == EbtStruct) { - if (!CompareStructure(*(*fields)[j], &rightUnionArray[index], &leftUnionArray[index])) + if (fields[j]->type()->getBasicType() == EbtStruct) { + if (!CompareStructure(*(fields[j]->type()), &rightUnionArray[index], &leftUnionArray[index])) return false; } else { if (leftUnionArray[index] != rightUnionArray[index]) return false; index++; } - } } return true; diff --git a/src/compiler/OutputGLSLBase.cpp b/src/compiler/OutputGLSLBase.cpp index 35901cf6..d677c756 100644 --- a/src/compiler/OutputGLSLBase.cpp +++ b/src/compiler/OutputGLSLBase.cpp @@ -79,25 +79,9 @@ void TOutputGLSLBase::writeVariableType(const TType& type) if ((qualifier != EvqTemporary) && (qualifier != EvqGlobal)) out << type.getQualifierString() << " "; // Declare the struct if we have not done so already. - if ((type.getBasicType() == EbtStruct) && - (mDeclaredStructs.find(type.getTypeName()) == mDeclaredStructs.end())) + if ((type.getBasicType() == EbtStruct) && !structDeclared(type.getStruct())) { - out << "struct " << hashName(type.getTypeName()) << "{\n"; - const TTypeList* structure = type.getStruct(); - ASSERT(structure != NULL); - for (size_t i = 0; i < structure->size(); ++i) - { - const TType* fieldType = (*structure)[i]; - ASSERT(fieldType != NULL); - if (writeVariablePrecision(fieldType->getPrecision())) - out << " "; - out << getTypeName(*fieldType) << " " << hashName(fieldType->getFieldName()); - if (fieldType->isArray()) - out << arrayBrackets(*fieldType); - out << ";\n"; - } - out << "}"; - mDeclaredStructs.insert(type.getTypeName()); + declareStruct(type.getStruct()); } else { @@ -138,15 +122,16 @@ const ConstantUnion* TOutputGLSLBase::writeConstantUnion(const TType& type, if (type.getBasicType() == EbtStruct) { - out << hashName(type.getTypeName()) << "("; - const TTypeList* structure = type.getStruct(); - ASSERT(structure != NULL); - for (size_t i = 0; i < structure->size(); ++i) + const TStructure* structure = type.getStruct(); + out << hashName(structure->name()) << "("; + + const TFieldList& fields = structure->fields(); + for (size_t i = 0; i < fields.size(); ++i) { - const TType* fieldType = (*structure)[i]; + const TType* fieldType = fields[i]->type(); ASSERT(fieldType != NULL); pConstUnion = writeConstantUnion(*fieldType, pConstUnion); - if (i != structure->size() - 1) out << ", "; + if (i != fields.size() - 1) out << ", "; } out << ")"; } @@ -260,12 +245,18 @@ bool TOutputGLSLBase::visitBinary(Visit visit, TIntermBinary* node) case EOpIndexDirectStruct: if (visit == InVisit) { + // Here we are writing out "foo.bar", where "foo" is struct + // and "bar" is field. In AST, it is represented as a binary + // node, where left child represents "foo" and right child "bar". + // The node itself represents ".". The struct field "bar" is + // actually stored as an index into TStructure::fields. out << "."; - // TODO(alokp): ASSERT - TString fieldName = node->getType().getFieldName(); + const TStructure* structure = node->getLeft()->getType().getStruct(); + const TIntermConstantUnion* index = node->getRight()->getAsConstantUnion(); + const TField* field = structure->fields()[index->getIConst(0)]; - const TType& structType = node->getLeft()->getType(); - if (!mSymbolTable.findBuiltIn(structType.getTypeName())) + TString fieldName = field->name(); + if (!mSymbolTable.findBuiltIn(structure->name())) fieldName = hashName(fieldName); out << fieldName; @@ -596,7 +587,7 @@ bool TOutputGLSLBase::visitAggregate(Visit visit, TIntermAggregate* node) { const TType& type = node->getType(); ASSERT(type.getBasicType() == EbtStruct); - out << hashName(type.getTypeName()) << "("; + out << hashName(type.getStruct()->name()) << "("; } else if (visit == InVisit) { @@ -765,7 +756,7 @@ TString TOutputGLSLBase::getTypeName(const TType& type) else { if (type.getBasicType() == EbtStruct) - out << hashName(type.getTypeName()); + out << hashName(type.getStruct()->name()); else out << type.getBasicString(); } @@ -798,3 +789,29 @@ TString TOutputGLSLBase::hashFunctionName(const TString& mangled_name) return name; return hashName(name); } + +bool TOutputGLSLBase::structDeclared(const TStructure* structure) const +{ + return mDeclaredStructs.find(structure->name()) != mDeclaredStructs.end(); +} + +void TOutputGLSLBase::declareStruct(const TStructure* structure) +{ + TInfoSinkBase& out = objSink(); + + out << "struct " << hashName(structure->name()) << "{\n"; + const TFieldList& fields = structure->fields(); + for (size_t i = 0; i < fields.size(); ++i) + { + const TField* field = fields[i]; + if (writeVariablePrecision(field->type()->getPrecision())) + out << " "; + out << getTypeName(*field->type()) << " " << hashName(field->name()); + if (field->type()->isArray()) + out << arrayBrackets(*field->type()); + out << ";\n"; + } + out << "}"; + + mDeclaredStructs.insert(structure->name()); +} diff --git a/src/compiler/OutputGLSLBase.h b/src/compiler/OutputGLSLBase.h index c9f72d56..df4ad68c 100644 --- a/src/compiler/OutputGLSLBase.h +++ b/src/compiler/OutputGLSLBase.h @@ -52,6 +52,9 @@ protected: TString hashFunctionName(const TString& mangled_name); private: + bool structDeclared(const TStructure* structure) const; + void declareStruct(const TStructure* structure); + TInfoSinkBase& mObjSink; bool mDeclaringVariables; diff --git a/src/compiler/OutputHLSL.cpp b/src/compiler/OutputHLSL.cpp index c6c6e33a..e0afe546 100644 --- a/src/compiler/OutputHLSL.cpp +++ b/src/compiler/OutputHLSL.cpp @@ -1296,7 +1296,10 @@ bool OutputHLSL::visitBinary(Visit visit, TIntermBinary *node) case EOpIndexDirectStruct: if (visit == InVisit) { - out << "." + decorateField(node->getType().getFieldName(), node->getLeft()->getType()); + const TStructure* structure = node->getLeft()->getType().getStruct(); + const TIntermConstantUnion* index = node->getRight()->getAsConstantUnion(); + const TField* field = structure->fields()[index->getIConst(0)]; + out << "." + decorateField(field->name(), node->getLeft()->getType()); return false; } @@ -1365,18 +1368,18 @@ bool OutputHLSL::visitBinary(Visit visit, TIntermBinary *node) out << "!("; } - const TTypeList *fields = node->getLeft()->getType().getStruct(); + const TFieldList &fields = node->getLeft()->getType().getStruct()->fields(); - for (size_t i = 0; i < fields->size(); i++) + for (size_t i = 0; i < fields.size(); i++) { - const TType *fieldType = (*fields)[i]; + const TField *field = fields[i]; node->getLeft()->traverse(this); - out << "." + decorateField(fieldType->getFieldName(), node->getLeft()->getType()) + " == "; + out << "." + decorateField(field->name(), node->getLeft()->getType()) + " == "; node->getRight()->traverse(this); - out << "." + decorateField(fieldType->getFieldName(), node->getLeft()->getType()); + out << "." + decorateField(field->name(), node->getLeft()->getType()); - if (i < fields->size() - 1) + if (i < fields.size() - 1) { out << " && "; } @@ -1626,7 +1629,7 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node) { if (variable->getType().getStruct()) { - addConstructor(variable->getType(), scopedStruct(variable->getType().getTypeName()), NULL); + addConstructor(variable->getType(), scopedStruct(variable->getType().getStruct()->name()), NULL); } if (!variable->getAsSymbolNode() || variable->getAsSymbolNode()->getSymbol() != "") // Variable declaration @@ -1753,7 +1756,7 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node) { if (symbol->getType().getStruct()) { - addConstructor(symbol->getType(), scopedStruct(symbol->getType().getTypeName()), NULL); + addConstructor(symbol->getType(), scopedStruct(symbol->getType().getStruct()->name()), NULL); } out << argumentString(symbol); @@ -2014,8 +2017,8 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node) outputTriplet(visit, "mat4(", ", ", ")"); break; case EOpConstructStruct: - addConstructor(node->getType(), scopedStruct(node->getType().getTypeName()), &node->getSequence()); - outputTriplet(visit, structLookup(node->getType().getTypeName()) + "_ctor(", ", ", ")"); + addConstructor(node->getType(), scopedStruct(node->getType().getStruct()->name()), &node->getSequence()); + outputTriplet(visit, structLookup(node->getType().getStruct()->name()) + "_ctor(", ", ", ")"); break; case EOpLessThan: outputTriplet(visit, "(", " < ", ")"); break; case EOpGreaterThan: outputTriplet(visit, "(", " > ", ")"); break; @@ -2586,22 +2589,23 @@ TString OutputHLSL::typeString(const TType &type) { if (type.getBasicType() == EbtStruct) { - if (type.getTypeName() != "") + const TString& typeName = type.getStruct()->name(); + if (typeName != "") { - return structLookup(type.getTypeName()); + return structLookup(typeName); } else // Nameless structure, define in place { - const TTypeList &fields = *type.getStruct(); + const TFieldList &fields = type.getStruct()->fields(); TString string = "struct\n" "{\n"; for (unsigned int i = 0; i < fields.size(); i++) { - const TType &field = *fields[i]; + const TField *field = fields[i]; - string += " " + typeString(field) + " " + decorate(field.getFieldName()) + arrayString(field) + ";\n"; + string += " " + typeString(*field->type()) + " " + decorate(field->name()) + arrayString(*field->type()) + ";\n"; } string += "} "; @@ -2739,13 +2743,13 @@ void OutputHLSL::addConstructor(const TType &type, const TString &name, const TI structure += "struct " + decorate(name) + "\n" "{\n"; - const TTypeList &fields = *type.getStruct(); + const TFieldList &fields = type.getStruct()->fields(); for (unsigned int i = 0; i < fields.size(); i++) { - const TType &field = *fields[i]; + const TField *field = fields[i]; - structure += " " + typeString(field) + " " + decorateField(field.getFieldName(), type) + arrayString(field) + ";\n"; + structure += " " + typeString(*field->type()) + " " + decorateField(field->name(), type) + arrayString(*field->type()) + ";\n"; } structure += "};\n"; @@ -2757,7 +2761,7 @@ void OutputHLSL::addConstructor(const TType &type, const TString &name, const TI for (unsigned int i = 0; i < fields.size(); i++) { - ctorParameters.push_back(*fields[i]); + ctorParameters.push_back(*fields[i]->type()); } } else if (parameters) @@ -2930,17 +2934,17 @@ const ConstantUnion *OutputHLSL::writeConstantUnion(const TType &type, const Con if (type.getBasicType() == EbtStruct) { - out << structLookup(type.getTypeName()) + "_ctor("; + out << structLookup(type.getStruct()->name()) + "_ctor("; - const TTypeList *structure = type.getStruct(); + const TFieldList &fields = type.getStruct()->fields(); - for (size_t i = 0; i < structure->size(); i++) + for (size_t i = 0; i < fields.size(); i++) { - const TType *fieldType = (*structure)[i]; + const TType *fieldType = fields[i]->type(); constUnion = writeConstantUnion(*fieldType, constUnion); - if (i != structure->size() - 1) + if (i != fields.size() - 1) { out << ", "; } @@ -3047,7 +3051,7 @@ TString OutputHLSL::decorateUniform(const TString &string, const TType &type) TString OutputHLSL::decorateField(const TString &string, const TType &structure) { - if (structure.getTypeName().compare(0, 3, "gl_") != 0) + if (structure.getStruct()->name().compare(0, 3, "gl_") != 0) { return decorate(string); } @@ -3095,7 +3099,7 @@ int OutputHLSL::uniformRegister(TIntermSymbol *uniform) void OutputHLSL::declareUniform(const TType &type, const TString &name, int index) { - const TTypeList *structure = type.getStruct(); + TStructure *structure = type.getStruct(); if (!structure) { @@ -3103,18 +3107,18 @@ void OutputHLSL::declareUniform(const TType &type, const TString &name, int inde } else { + const TFieldList &fields = structure->fields(); + if (type.isArray()) { int elementIndex = index; for (int i = 0; i < type.getArraySize(); i++) { - for (size_t j = 0; j < structure->size(); j++) + for (size_t j = 0; j < fields.size(); j++) { - const TType &fieldType = *(*structure)[j]; - const TString &fieldName = fieldType.getFieldName(); - - const TString uniformName = name + "[" + str(i) + "]." + fieldName; + const TType &fieldType = *fields[j]->type(); + const TString uniformName = name + "[" + str(i) + "]." + fields[j]->name(); declareUniform(fieldType, uniformName, elementIndex); elementIndex += fieldType.totalRegisterCount(); } @@ -3124,12 +3128,10 @@ void OutputHLSL::declareUniform(const TType &type, const TString &name, int inde { int fieldIndex = index; - for (size_t i = 0; i < structure->size(); i++) + for (size_t i = 0; i < fields.size(); i++) { - const TType &fieldType = *(*structure)[i]; - const TString &fieldName = fieldType.getFieldName(); - - const TString uniformName = name + "." + fieldName; + const TType &fieldType = *fields[i]->type(); + const TString uniformName = name + "." + fields[i]->name(); declareUniform(fieldType, uniformName, fieldIndex); fieldIndex += fieldType.totalRegisterCount(); } diff --git a/src/compiler/ParseHelper.cpp b/src/compiler/ParseHelper.cpp index 76855f1b..fd2e9539 100644 --- a/src/compiler/ParseHelper.cpp +++ b/src/compiler/ParseHelper.cpp @@ -535,7 +535,7 @@ bool TParseContext::constructorErrorCheck(const TSourceLoc& line, TIntermNode* n return true; } - if (op == EOpConstructStruct && !type->isArray() && int(type->getStruct()->size()) != function.getParamCount()) { + if (op == EOpConstructStruct && !type->isArray() && int(type->getStruct()->fields().size()) != function.getParamCount()) { error(line, "Number of constructor parameters does not match the number of structure fields", "constructor"); return true; } @@ -658,9 +658,9 @@ bool TParseContext::containsSampler(TType& type) return true; if (type.getBasicType() == EbtStruct) { - TTypeList& structure = *type.getStruct(); - for (unsigned int i = 0; i < structure.size(); ++i) { - if (containsSampler(*structure[i])) + const TFieldList& fields = type.getStruct()->fields(); + for (unsigned int i = 0; i < fields.size(); ++i) { + if (containsSampler(*fields[i]->type())) return true; } } @@ -1063,9 +1063,9 @@ TIntermTyped* TParseContext::addConstructor(TIntermNode* node, const TType* type TIntermAggregate* aggrNode = node->getAsAggregate(); - TTypeList::const_iterator memberTypes; + TFieldList::const_iterator memberFields; if (op == EOpConstructStruct) - memberTypes = type->getStruct()->begin(); + memberFields = type->getStruct()->fields().begin(); TType elementType = *type; if (type->isArray()) @@ -1087,7 +1087,7 @@ TIntermTyped* TParseContext::addConstructor(TIntermNode* node, const TType* type if (type->isArray()) newNode = constructStruct(node, &elementType, 1, node->getLine(), false); else if (op == EOpConstructStruct) - newNode = constructStruct(node, *memberTypes, 1, node->getLine(), false); + newNode = constructStruct(node, (*memberFields)->type(), 1, node->getLine(), false); else newNode = constructBuiltIn(type, op, node, node->getLine(), false); @@ -1118,7 +1118,7 @@ TIntermTyped* TParseContext::addConstructor(TIntermNode* node, const TType* type if (type->isArray()) newNode = constructStruct(*p, &elementType, paramCount+1, node->getLine(), true); else if (op == EOpConstructStruct) - newNode = constructStruct(*p, memberTypes[paramCount], paramCount+1, node->getLine(), true); + newNode = constructStruct(*p, memberFields[paramCount]->type(), paramCount+1, node->getLine(), true); else newNode = constructBuiltIn(type, op, *p, node->getLine(), true); @@ -1370,14 +1370,14 @@ TIntermTyped* TParseContext::addConstArrayNode(int index, TIntermTyped* node, co // TIntermTyped* TParseContext::addConstStruct(TString& identifier, TIntermTyped* node, const TSourceLoc& line) { - const TTypeList* fields = node->getType().getStruct(); + const TFieldList& fields = node->getType().getStruct()->fields(); size_t instanceSize = 0; - for (size_t index = 0; index < fields->size(); ++index) { - if ((*fields)[index]->getFieldName() == identifier) { + for (size_t index = 0; index < fields.size(); ++index) { + if (fields[index]->name() == identifier) { break; } else { - instanceSize += (*fields)[index]->getObjectSize(); + instanceSize += fields[index]->type()->getObjectSize(); } } @@ -1423,21 +1423,21 @@ const int kWebGLMaxStructNesting = 4; } // namespace -bool TParseContext::structNestingErrorCheck(const TSourceLoc& line, const TType& fieldType) +bool TParseContext::structNestingErrorCheck(const TSourceLoc& line, const TField& field) { if (!isWebGLBasedSpec(shaderSpec)) { return false; } - if (fieldType.getBasicType() != EbtStruct) { + if (field.type()->getBasicType() != EbtStruct) { return false; } // We're already inside a structure definition at this point, so add // one to the field's struct nesting. - if (1 + fieldType.getDeepestStructNesting() > kWebGLMaxStructNesting) { + if (1 + field.type()->getDeepestStructNesting() > kWebGLMaxStructNesting) { std::stringstream extraInfoStream; - extraInfoStream << "Reference of struct type " << fieldType.getTypeName() + extraInfoStream << "Reference of struct type " << field.name() << " exceeds maximum struct nesting of " << kWebGLMaxStructNesting; std::string extraInfo = extraInfoStream.str(); error(line, "", "", extraInfo.c_str()); diff --git a/src/compiler/ParseHelper.h b/src/compiler/ParseHelper.h index 289ec2f2..b2025b84 100644 --- a/src/compiler/ParseHelper.h +++ b/src/compiler/ParseHelper.h @@ -124,7 +124,7 @@ struct TParseContext { bool enterStructDeclaration(const TSourceLoc& line, const TString& identifier); void exitStructDeclaration(); - bool structNestingErrorCheck(const TSourceLoc& line, const TType& fieldType); + bool structNestingErrorCheck(const TSourceLoc& line, const TField& field); }; int PaParseStrings(size_t count, const char* const string[], const int length[], diff --git a/src/compiler/SymbolTable.cpp b/src/compiler/SymbolTable.cpp index f6b6ab6f..51180aff 100644 --- a/src/compiler/SymbolTable.cpp +++ b/src/compiler/SymbolTable.cpp @@ -20,44 +20,31 @@ #include <climits> TType::TType(const TPublicType &p) : - type(p.type), precision(p.precision), qualifier(p.qualifier), size(p.size), matrix(p.matrix), array(p.array), arraySize(p.arraySize), - structure(0), structureSize(0), deepestStructNesting(0), fieldName(0), mangled(0), typeName(0) + type(p.type), precision(p.precision), qualifier(p.qualifier), size(p.size), matrix(p.matrix), array(p.array), arraySize(p.arraySize), structure(0) { - if (p.userDef) { + if (p.userDef) structure = p.userDef->getStruct(); - typeName = NewPoolTString(p.userDef->getTypeName().c_str()); - computeDeepestStructNesting(); - } } // // Recursively generate mangled names. // -void TType::buildMangledName(TString& mangledName) +TString TType::buildMangledName() const { + TString mangledName; if (isMatrix()) mangledName += 'm'; else if (isVector()) mangledName += 'v'; switch (type) { - case EbtFloat: mangledName += 'f'; break; - case EbtInt: mangledName += 'i'; break; - case EbtBool: mangledName += 'b'; break; - case EbtSampler2D: mangledName += "s2"; break; - case EbtSamplerCube: mangledName += "sC"; break; - case EbtStruct: - mangledName += "struct-"; - if (typeName) - mangledName += *typeName; - {// support MSVC++6.0 - for (unsigned int i = 0; i < structure->size(); ++i) { - mangledName += '-'; - (*structure)[i]->buildMangledName(mangledName); - } - } - default: - break; + case EbtFloat: mangledName += 'f'; break; + case EbtInt: mangledName += 'i'; break; + case EbtBool: mangledName += 'b'; break; + case EbtSampler2D: mangledName += "s2"; break; + case EbtSamplerCube: mangledName += "sC"; break; + case EbtStruct: mangledName += structure->mangledName(); break; + default: break; } mangledName += static_cast<char>('0' + getNominalSize()); @@ -68,6 +55,7 @@ void TType::buildMangledName(TString& mangledName) mangledName += buf; mangledName += ']'; } + return mangledName; } size_t TType::getObjectSize() const @@ -75,7 +63,7 @@ size_t TType::getObjectSize() const size_t totalSize = 0; if (getBasicType() == EbtStruct) - totalSize = getStructSize(); + totalSize = structure->objectSize(); else if (matrix) totalSize = size * size; else @@ -92,57 +80,47 @@ size_t TType::getObjectSize() const return totalSize; } -size_t TType::getStructSize() const +bool TStructure::containsArrays() const { - if (!getStruct()) { - assert(false && "Not a struct"); - return 0; - } - - if (structureSize == 0) { - for (TTypeList::const_iterator tl = getStruct()->begin(); tl != getStruct()->end(); tl++) { - size_t fieldSize = (*tl)->getObjectSize(); - if (fieldSize > INT_MAX - structureSize) - structureSize = INT_MAX; - else - structureSize += fieldSize; - } + for (size_t i = 0; i < mFields->size(); ++i) { + const TType* fieldType = (*mFields)[i]->type(); + if (fieldType->isArray() || fieldType->isStructureContainingArrays()) + return true; } - - return structureSize; + return false; } -void TType::computeDeepestStructNesting() +TString TStructure::buildMangledName() const { - if (!getStruct()) { - return; - } - - int maxNesting = 0; - for (TTypeList::const_iterator tl = getStruct()->begin(); tl != getStruct()->end(); ++tl) { - maxNesting = std::max(maxNesting, (*tl)->getDeepestStructNesting()); + TString mangledName("struct-"); + mangledName += *mName; + for (size_t i = 0; i < mFields->size(); ++i) { + mangledName += '-'; + mangledName += (*mFields)[i]->type()->getMangledName(); } - - deepestStructNesting = 1 + maxNesting; + return mangledName; } -bool TType::isStructureContainingArrays() const +size_t TStructure::calculateObjectSize() const { - if (!structure) - { - return false; + size_t size = 0; + for (size_t i = 0; i < mFields->size(); ++i) { + size_t fieldSize = (*mFields)[i]->type()->getObjectSize(); + if (fieldSize > INT_MAX - size) + size = INT_MAX; + else + size += fieldSize; } + return size; +} - for (TTypeList::const_iterator member = structure->begin(); member != structure->end(); member++) - { - if ((*member)->isArray() || - (*member)->isStructureContainingArrays()) - { - return true; - } +int TStructure::calculateDeepestNesting() const +{ + int maxNesting = 0; + for (size_t i = 0; i < mFields->size(); ++i) { + maxNesting = std::max(maxNesting, (*mFields)[i]->type()->getDeepestStructNesting()); } - - return false; + return 1 + maxNesting; } // diff --git a/src/compiler/SymbolTable.h b/src/compiler/SymbolTable.h index f6e19598..a5406027 100644 --- a/src/compiler/SymbolTable.h +++ b/src/compiler/SymbolTable.h @@ -1,5 +1,5 @@ // -// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved. +// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -273,6 +273,35 @@ public: return table[currentLevel()]->insert(symbol); } + bool insertConstInt(const char *name, int value) + { + TVariable *constant = new TVariable(NewPoolTString(name), TType(EbtInt, EbpUndefined, EvqConst, 1)); + constant->getConstPointer()->setIConst(value); + return insert(*constant); + } + + bool insertBuiltIn(TType *rvalue, const char *name, TType *ptype1, const char *pname1, TType *ptype2 = 0, const char *pname2 = 0, TType *ptype3 = 0, const char *pname3 = 0) + { + TFunction *function = new TFunction(NewPoolTString(name), *rvalue); + + TParameter param1 = {NewPoolTString(pname1), ptype1}; + function->addParameter(param1); + + if (pname2) + { + TParameter param2 = {NewPoolTString(pname2), ptype2}; + function->addParameter(param2); + } + + if (pname3) + { + TParameter param3 = {NewPoolTString(pname3), ptype3}; + function->addParameter(param3); + } + + return insert(*function); + } + TSymbol* find(const TString& name, bool* builtIn = 0, bool *sameScope = 0) { int level = currentLevel(); diff --git a/src/compiler/Types.h b/src/compiler/Types.h index 472f1a74..5946af04 100644 --- a/src/compiler/Types.h +++ b/src/compiler/Types.h @@ -7,21 +7,86 @@ #ifndef _TYPES_INCLUDED #define _TYPES_INCLUDED +#include "common/angleutils.h" + #include "compiler/BaseTypes.h" #include "compiler/Common.h" #include "compiler/debug.h" -class TType; struct TPublicType; +class TType; + +class TField +{ +public: + POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator); + TField(TType* type, TString* name) : mType(type), mName(name) {} + + // TODO(alokp): We should only return const type. + // Fix it by tweaking grammar. + TType* type() { return mType; } + const TType* type() const { return mType; } + + const TString& name() const { return *mName; } -typedef TVector<TType*> TTypeList; +private: + DISALLOW_COPY_AND_ASSIGN(TField); + TType* mType; + TString* mName; +}; -inline TTypeList* NewPoolTTypeList() +typedef TVector<TField*> TFieldList; +inline TFieldList* NewPoolTFieldList() { - void* memory = GlobalPoolAllocator.allocate(sizeof(TTypeList)); - return new(memory) TTypeList; + void* memory = GlobalPoolAllocator.allocate(sizeof(TFieldList)); + return new(memory) TFieldList; } +class TStructure +{ +public: + POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator); + TStructure(TString* name, TFieldList* fields) + : mName(name), + mFields(fields), + mObjectSize(0), + mDeepestNesting(0) { + } + + const TString& name() const { return *mName; } + const TFieldList& fields() const { return *mFields; } + + const TString& mangledName() const { + if (mMangledName.empty()) + mMangledName = buildMangledName(); + return mMangledName; + } + size_t objectSize() const { + if (mObjectSize == 0) + mObjectSize = calculateObjectSize(); + return mObjectSize; + }; + int deepestNesting() const { + if (mDeepestNesting == 0) + mDeepestNesting = calculateDeepestNesting(); + return mDeepestNesting; + } + bool containsArrays() const; + +private: + DISALLOW_COPY_AND_ASSIGN(TStructure); + TString buildMangledName() const; + size_t calculateObjectSize() const; + int calculateDeepestNesting() const; + + TString* mName; + TFieldList* mFields; + + mutable TString mMangledName; + mutable size_t mObjectSize; + mutable int mDeepestNesting; +}; + // // Base class for things that have a type. // @@ -31,16 +96,13 @@ public: POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator) TType() {} TType(TBasicType t, TPrecision p, TQualifier q = EvqTemporary, int s = 1, bool m = false, bool a = false) : - type(t), precision(p), qualifier(q), size(s), matrix(m), array(a), arraySize(0), - structure(0), structureSize(0), deepestStructNesting(0), fieldName(0), mangled(0), typeName(0) + type(t), precision(p), qualifier(q), size(s), matrix(m), array(a), arraySize(0), structure(0) { } explicit TType(const TPublicType &p); - TType(TTypeList* userDef, const TString& n, TPrecision p = EbpUndefined) : - type(EbtStruct), precision(p), qualifier(EvqTemporary), size(1), matrix(false), array(false), arraySize(0), - structure(userDef), structureSize(0), deepestStructNesting(0), fieldName(0), mangled(0) + TType(TStructure* userDef, TPrecision p = EbpUndefined) : + type(EbtStruct), precision(p), qualifier(EvqTemporary), size(1), matrix(false), array(false), arraySize(0), structure(userDef) { - typeName = NewPoolTString(n.c_str()); } TBasicType getBasicType() const { return type; } @@ -60,15 +122,14 @@ public: int elementRegisterCount() const { - TTypeList *structure = getStruct(); - if (structure) { + const TFieldList &fields = getStruct()->fields(); int registerCount = 0; - for (size_t i = 0; i < structure->size(); i++) + for (size_t i = 0; i < fields.size(); i++) { - registerCount += (*structure)[i]->totalRegisterCount(); + registerCount += fields[i]->type()->totalRegisterCount(); } return registerCount; @@ -106,38 +167,15 @@ public: bool isVector() const { return size > 1 && !matrix; } bool isScalar() const { return size == 1 && !matrix && !structure; } - TTypeList* getStruct() const { return structure; } - void setStruct(TTypeList* s) { structure = s; computeDeepestStructNesting(); } - - const TString& getTypeName() const - { - assert(typeName); - return *typeName; - } - void setTypeName(const TString& n) - { - typeName = NewPoolTString(n.c_str()); - } - - bool isField() const { return fieldName != 0; } - const TString& getFieldName() const - { - assert(fieldName); - return *fieldName; - } - void setFieldName(const TString& n) - { - fieldName = NewPoolTString(n.c_str()); - } + TStructure* getStruct() const { return structure; } + void setStruct(TStructure* s) { structure = s; } - TString& getMangledName() { - if (!mangled) { - mangled = NewPoolTString(""); - buildMangledName(*mangled); - *mangled += ';' ; + const TString& getMangledName() const { + if (mangled.empty()) { + mangled = buildMangledName(); + mangled += ';'; } - - return *mangled; + return mangled; } bool sameElementType(const TType& right) const { @@ -185,14 +223,16 @@ public: // For type "nesting2", this method would return 2 -- the number // of structures through which indirection must occur to reach the // deepest field (nesting2.field1.position). - int getDeepestStructNesting() const { return deepestStructNesting; } + int getDeepestStructNesting() const { + return structure ? structure->deepestNesting() : 0; + } - bool isStructureContainingArrays() const; + bool isStructureContainingArrays() const { + return structure ? structure->containsArrays() : false; + } private: - void buildMangledName(TString&); - size_t getStructSize() const; - void computeDeepestStructNesting(); + TString buildMangledName() const; TBasicType type : 6; TPrecision precision; @@ -202,13 +242,9 @@ private: unsigned int array : 1; int arraySize; - TTypeList* structure; // 0 unless this is a struct - mutable size_t structureSize; - int deepestStructNesting; + TStructure* structure; // 0 unless this is a struct - TString *fieldName; // for structure field names - TString *mangled; - TString *typeName; // for structure field type name + mutable TString mangled; }; // diff --git a/src/compiler/VariableInfo.cpp b/src/compiler/VariableInfo.cpp index 5a1402e0..84db807a 100644 --- a/src/compiler/VariableInfo.cpp +++ b/src/compiler/VariableInfo.cpp @@ -131,12 +131,13 @@ void getUserDefinedVariableInfo(const TType& type, { ASSERT(type.getBasicType() == EbtStruct); - const TTypeList* structure = type.getStruct(); - for (size_t i = 0; i < structure->size(); ++i) { - const TType* fieldType = (*structure)[i]; - getVariableInfo(*fieldType, - name + "." + fieldType->getFieldName(), - mappedName + "." + TIntermTraverser::hash(fieldType->getFieldName(), hashFunction), + const TFieldList& fields = type.getStruct()->fields(); + for (size_t i = 0; i < fields.size(); ++i) { + const TType& fieldType = *(fields[i]->type()); + const TString& fieldName = fields[i]->name(); + getVariableInfo(fieldType, + name + "." + fieldName, + mappedName + "." + TIntermTraverser::hash(fieldName, hashFunction), infoList, hashFunction); } diff --git a/src/compiler/glslang.y b/src/compiler/glslang.y index bcb9aec5..2c25d5b1 100644 --- a/src/compiler/glslang.y +++ b/src/compiler/glslang.y @@ -77,8 +77,8 @@ WHICH GENERATES THE GLSL ES PARSER (glslang_tab.cpp AND glslang_tab.h). TQualifier qualifier; TFunction* function; TParameter param; - TType* field; - TTypeList* structure; + TField* field; + TFieldList* fieldList; }; } interm; } @@ -166,7 +166,7 @@ static void yyerror(YYLTYPE* yylloc, TParseContext* context, const char* reason) %type <interm.type> type_specifier_no_prec type_specifier_nonarray %type <interm.type> struct_specifier %type <interm.field> struct_declarator -%type <interm> struct_declarator_list struct_declaration struct_declaration_list +%type <interm.fieldList> struct_declarator_list struct_declaration struct_declaration_list %type <interm.function> function_header function_declarator function_identifier %type <interm.function> function_header_with_parameters function_call_header %type <interm> function_call_header_with_parameters function_call_header_no_parameters function_call_generic function_prototype @@ -317,7 +317,7 @@ postfix_expression $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpHigh, EvqConst), @2); } else if ($1->isArray()) { if ($1->getType().getStruct()) - $$->setType(TType($1->getType().getStruct(), $1->getType().getTypeName())); + $$->setType(TType($1->getType().getStruct())); else $$->setType(TType($1->getBasicType(), $1->getPrecision(), EvqTemporary, $1->getNominalSize(), $1->isMatrix())); @@ -391,44 +391,38 @@ postfix_expression } } else if ($1->getBasicType() == EbtStruct) { bool fieldFound = false; - const TTypeList* fields = $1->getType().getStruct(); - if (fields == 0) { - context->error(@2, "structure has no fields", "Internal Error"); - context->recover(); - $$ = $1; - } else { - unsigned int i; - for (i = 0; i < fields->size(); ++i) { - if ((*fields)[i]->getFieldName() == *$3.string) { - fieldFound = true; - break; - } + const TFieldList& fields = $1->getType().getStruct()->fields(); + unsigned int i; + for (i = 0; i < fields.size(); ++i) { + if (fields[i]->name() == *$3.string) { + fieldFound = true; + break; } - if (fieldFound) { - if ($1->getType().getQualifier() == EvqConst) { - $$ = context->addConstStruct(*$3.string, $1, @2); - if ($$ == 0) { - context->recover(); - $$ = $1; - } - else { - $$->setType(*(*fields)[i]); - // change the qualifier of the return type, not of the structure field - // as the structure definition is shared between various structures. - $$->getTypePointer()->setQualifier(EvqConst); - } - } else { - ConstantUnion *unionArray = new ConstantUnion[1]; - unionArray->setIConst(i); - TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, *(*fields)[i], @3); - $$ = context->intermediate.addIndex(EOpIndexDirectStruct, $1, index, @2); - $$->setType(*(*fields)[i]); + } + if (fieldFound) { + if ($1->getType().getQualifier() == EvqConst) { + $$ = context->addConstStruct(*$3.string, $1, @2); + if ($$ == 0) { + context->recover(); + $$ = $1; + } + else { + $$->setType(*fields[i]->type()); + // change the qualifier of the return type, not of the structure field + // as the structure definition is shared between various structures. + $$->getTypePointer()->setQualifier(EvqConst); } } else { - context->error(@2, " no such field in structure", $3.string->c_str()); - context->recover(); - $$ = $1; + ConstantUnion *unionArray = new ConstantUnion[1]; + unionArray->setIConst(i); + TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, *fields[i]->type(), @3); + $$ = context->intermediate.addIndex(EOpIndexDirectStruct, $1, index, @2); + $$->setType(*fields[i]->type()); } + } else { + context->error(@2, " no such field in structure", $3.string->c_str()); + context->recover(); + $$ = $1; } } else { context->error(@2, " field selection requires structure, vector, or matrix on left hand side", $3.string->c_str()); @@ -1625,7 +1619,7 @@ struct_specifier if (context->reservedErrorCheck(@2, *$2.string)) context->recover(); - TType* structure = new TType($5.structure, *$2.string); + TType* structure = new TType(new TStructure($2.string, $5)); TVariable* userTypeDef = new TVariable($2.string, *structure, true); if (! context->symbolTable.insert(*userTypeDef)) { context->error(@2, "redefinition", $2.string->c_str(), "struct"); @@ -1636,7 +1630,7 @@ struct_specifier context->exitStructDeclaration(); } | STRUCT LEFT_BRACE { if (context->enterStructDeclaration(@2, *$2.string)) context->recover(); } struct_declaration_list RIGHT_BRACE { - TType* structure = new TType($4.structure, TString("")); + TType* structure = new TType(new TStructure(NewPoolTString(""), $4)); $$.setBasic(EbtStruct, EvqTemporary, @1); $$.userDef = structure; context->exitStructDeclaration(); @@ -1649,15 +1643,15 @@ struct_declaration_list } | struct_declaration_list struct_declaration { $$ = $1; - for (size_t i = 0; i < $2.structure->size(); ++i) { - TType* field = (*$2.structure)[i]; - for (size_t j = 0; j < $$.structure->size(); ++j) { - if ((*$$.structure)[j]->getFieldName() == field->getFieldName()) { - context->error(@2, "duplicate field name in structure:", "struct", field->getFieldName().c_str()); + for (size_t i = 0; i < $2->size(); ++i) { + TField* field = (*$2)[i]; + for (size_t j = 0; j < $$->size(); ++j) { + if ((*$$)[j]->name() == field->name()) { + context->error(@2, "duplicate field name in structure:", "struct", field->name().c_str()); context->recover(); } } - $$.structure->push_back(field); + $$->push_back(field); } } ; @@ -1666,14 +1660,14 @@ struct_declaration : type_specifier struct_declarator_list SEMICOLON { $$ = $2; - if (context->voidErrorCheck(@1, (*$2.structure)[0]->getFieldName(), $1)) { + if (context->voidErrorCheck(@1, (*$2)[0]->name(), $1)) { context->recover(); } - for (unsigned int i = 0; i < $$.structure->size(); ++i) { + for (unsigned int i = 0; i < $$->size(); ++i) { // // Careful not to replace already known aspects of type, like array-ness // - TType* type = (*$$.structure)[i]; + TType* type = (*$$)[i]->type(); type->setBasicType($1.type); type->setNominalSize($1.size); type->setMatrix($1.matrix); @@ -1686,25 +1680,22 @@ struct_declaration } if ($1.array) type->setArraySize($1.arraySize); - if ($1.userDef) { + if ($1.userDef) type->setStruct($1.userDef->getStruct()); - type->setTypeName($1.userDef->getTypeName()); - } - if (context->structNestingErrorCheck(@1, *type)) { + if (context->structNestingErrorCheck(@1, *(*$$)[i])) context->recover(); - } } } ; struct_declarator_list : struct_declarator { - $$.structure = NewPoolTTypeList(); - $$.structure->push_back($1); + $$ = NewPoolTFieldList(); + $$->push_back($1); } | struct_declarator_list COMMA struct_declarator { - $$.structure->push_back($3); + $$->push_back($3); } ; @@ -1713,20 +1704,20 @@ struct_declarator if (context->reservedErrorCheck(@1, *$1.string)) context->recover(); - $$ = new TType(EbtVoid, EbpUndefined); - $$->setFieldName(*$1.string); + TType* type = new TType(EbtVoid, EbpUndefined); + $$ = new TField(type, $1.string); } | identifier LEFT_BRACKET constant_expression RIGHT_BRACKET { if (context->reservedErrorCheck(@1, *$1.string)) context->recover(); - $$ = new TType(EbtVoid, EbpUndefined); - $$->setFieldName(*$1.string); - - int size; - if (context->arraySizeErrorCheck(@2, $3, size)) + TType* type = new TType(EbtVoid, EbpUndefined); + int size = 0; + if (context->arraySizeErrorCheck(@3, $3, size)) context->recover(); - $$->setArraySize(size); + type->setArraySize(size); + + $$ = new TField(type, $1.string); } ; diff --git a/src/compiler/glslang_tab.cpp b/src/compiler/glslang_tab.cpp index 71ccf949..21117ee7 100644 --- a/src/compiler/glslang_tab.cpp +++ b/src/compiler/glslang_tab.cpp @@ -260,8 +260,8 @@ typedef union YYSTYPE TQualifier qualifier; TFunction* function; TParameter param; - TType* field; - TTypeList* structure; + TField* field; + TFieldList* fieldList; }; } interm; @@ -714,26 +714,26 @@ static const yytype_int16 yyrhs[] = static const yytype_uint16 yyrline[] = { 0, 179, 179, 180, 183, 226, 229, 242, 247, 252, - 258, 261, 336, 339, 440, 450, 463, 471, 571, 574, - 582, 585, 591, 595, 602, 608, 617, 625, 680, 690, - 693, 703, 713, 734, 735, 736, 741, 742, 750, 761, - 762, 770, 781, 785, 786, 796, 806, 816, 829, 830, - 840, 853, 857, 861, 865, 866, 879, 880, 893, 894, - 907, 908, 925, 926, 939, 940, 941, 942, 943, 947, - 950, 961, 969, 996, 1001, 1015, 1052, 1055, 1062, 1070, - 1091, 1112, 1122, 1150, 1155, 1165, 1170, 1180, 1183, 1186, - 1189, 1195, 1202, 1205, 1227, 1245, 1269, 1292, 1296, 1314, - 1322, 1354, 1374, 1395, 1404, 1427, 1430, 1436, 1444, 1452, - 1460, 1470, 1477, 1480, 1483, 1489, 1492, 1507, 1511, 1515, - 1519, 1523, 1528, 1533, 1538, 1543, 1548, 1553, 1558, 1563, - 1568, 1573, 1578, 1583, 1587, 1591, 1599, 1607, 1611, 1624, - 1624, 1638, 1638, 1647, 1650, 1666, 1702, 1706, 1712, 1719, - 1734, 1738, 1742, 1743, 1749, 1750, 1751, 1752, 1753, 1757, - 1758, 1758, 1758, 1768, 1769, 1773, 1773, 1774, 1774, 1779, - 1782, 1792, 1795, 1801, 1802, 1806, 1814, 1818, 1828, 1833, - 1850, 1850, 1855, 1855, 1862, 1862, 1870, 1873, 1879, 1882, - 1888, 1892, 1899, 1906, 1913, 1920, 1931, 1940, 1944, 1951, - 1954, 1960, 1960 + 258, 261, 336, 339, 434, 444, 457, 465, 565, 568, + 576, 579, 585, 589, 596, 602, 611, 619, 674, 684, + 687, 697, 707, 728, 729, 730, 735, 736, 744, 755, + 756, 764, 775, 779, 780, 790, 800, 810, 823, 824, + 834, 847, 851, 855, 859, 860, 873, 874, 887, 888, + 901, 902, 919, 920, 933, 934, 935, 936, 937, 941, + 944, 955, 963, 990, 995, 1009, 1046, 1049, 1056, 1064, + 1085, 1106, 1116, 1144, 1149, 1159, 1164, 1174, 1177, 1180, + 1183, 1189, 1196, 1199, 1221, 1239, 1263, 1286, 1290, 1308, + 1316, 1348, 1368, 1389, 1398, 1421, 1424, 1430, 1438, 1446, + 1454, 1464, 1471, 1474, 1477, 1483, 1486, 1501, 1505, 1509, + 1513, 1517, 1522, 1527, 1532, 1537, 1542, 1547, 1552, 1557, + 1562, 1567, 1572, 1577, 1581, 1585, 1593, 1601, 1605, 1618, + 1618, 1632, 1632, 1641, 1644, 1660, 1693, 1697, 1703, 1710, + 1725, 1729, 1733, 1734, 1740, 1741, 1742, 1743, 1744, 1748, + 1749, 1749, 1749, 1759, 1760, 1764, 1764, 1765, 1765, 1770, + 1773, 1783, 1786, 1792, 1793, 1797, 1805, 1809, 1819, 1824, + 1841, 1841, 1846, 1846, 1853, 1853, 1861, 1864, 1870, 1873, + 1879, 1883, 1890, 1897, 1904, 1911, 1922, 1931, 1935, 1942, + 1945, 1951, 1951 }; #endif @@ -2404,7 +2404,7 @@ yyreduce: (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpHigh, EvqConst), (yylsp[(2) - (4)])); } else if ((yyvsp[(1) - (4)].interm.intermTypedNode)->isArray()) { if ((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct()) - (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getTypeName())); + (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getType().getStruct())); else (yyval.interm.intermTypedNode)->setType(TType((yyvsp[(1) - (4)].interm.intermTypedNode)->getBasicType(), (yyvsp[(1) - (4)].interm.intermTypedNode)->getPrecision(), EvqTemporary, (yyvsp[(1) - (4)].interm.intermTypedNode)->getNominalSize(), (yyvsp[(1) - (4)].interm.intermTypedNode)->isMatrix())); @@ -2486,44 +2486,38 @@ yyreduce: } } else if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getBasicType() == EbtStruct) { bool fieldFound = false; - const TTypeList* fields = (yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getStruct(); - if (fields == 0) { - context->error((yylsp[(2) - (3)]), "structure has no fields", "Internal Error"); - context->recover(); - (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode); - } else { - unsigned int i; - for (i = 0; i < fields->size(); ++i) { - if ((*fields)[i]->getFieldName() == *(yyvsp[(3) - (3)].lex).string) { - fieldFound = true; - break; - } + const TFieldList& fields = (yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getStruct()->fields(); + unsigned int i; + for (i = 0; i < fields.size(); ++i) { + if (fields[i]->name() == *(yyvsp[(3) - (3)].lex).string) { + fieldFound = true; + break; } - if (fieldFound) { - if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) { - (yyval.interm.intermTypedNode) = context->addConstStruct(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)])); - if ((yyval.interm.intermTypedNode) == 0) { - context->recover(); - (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode); - } - else { - (yyval.interm.intermTypedNode)->setType(*(*fields)[i]); - // change the qualifier of the return type, not of the structure field - // as the structure definition is shared between various structures. - (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst); - } - } else { - ConstantUnion *unionArray = new ConstantUnion[1]; - unionArray->setIConst(i); - TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, *(*fields)[i], (yylsp[(3) - (3)])); - (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirectStruct, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yylsp[(2) - (3)])); - (yyval.interm.intermTypedNode)->setType(*(*fields)[i]); + } + if (fieldFound) { + if ((yyvsp[(1) - (3)].interm.intermTypedNode)->getType().getQualifier() == EvqConst) { + (yyval.interm.intermTypedNode) = context->addConstStruct(*(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)])); + if ((yyval.interm.intermTypedNode) == 0) { + context->recover(); + (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode); + } + else { + (yyval.interm.intermTypedNode)->setType(*fields[i]->type()); + // change the qualifier of the return type, not of the structure field + // as the structure definition is shared between various structures. + (yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst); } } else { - context->error((yylsp[(2) - (3)]), " no such field in structure", (yyvsp[(3) - (3)].lex).string->c_str()); - context->recover(); - (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode); + ConstantUnion *unionArray = new ConstantUnion[1]; + unionArray->setIConst(i); + TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, *fields[i]->type(), (yylsp[(3) - (3)])); + (yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirectStruct, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yylsp[(2) - (3)])); + (yyval.interm.intermTypedNode)->setType(*fields[i]->type()); } + } else { + context->error((yylsp[(2) - (3)]), " no such field in structure", (yyvsp[(3) - (3)].lex).string->c_str()); + context->recover(); + (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode); } } else { context->error((yylsp[(2) - (3)]), " field selection requires structure, vector, or matrix on left hand side", (yyvsp[(3) - (3)].lex).string->c_str()); @@ -4080,7 +4074,7 @@ yyreduce: if (context->reservedErrorCheck((yylsp[(2) - (6)]), *(yyvsp[(2) - (6)].lex).string)) context->recover(); - TType* structure = new TType((yyvsp[(5) - (6)].interm).structure, *(yyvsp[(2) - (6)].lex).string); + TType* structure = new TType(new TStructure((yyvsp[(2) - (6)].lex).string, (yyvsp[(5) - (6)].interm.fieldList))); TVariable* userTypeDef = new TVariable((yyvsp[(2) - (6)].lex).string, *structure, true); if (! context->symbolTable.insert(*userTypeDef)) { context->error((yylsp[(2) - (6)]), "redefinition", (yyvsp[(2) - (6)].lex).string->c_str(), "struct"); @@ -4100,7 +4094,7 @@ yyreduce: case 142: { - TType* structure = new TType((yyvsp[(4) - (5)].interm).structure, TString("")); + TType* structure = new TType(new TStructure(NewPoolTString(""), (yyvsp[(4) - (5)].interm.fieldList))); (yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yylsp[(1) - (5)])); (yyval.interm.type).userDef = structure; context->exitStructDeclaration(); @@ -4110,23 +4104,23 @@ yyreduce: case 143: { - (yyval.interm) = (yyvsp[(1) - (1)].interm); + (yyval.interm.fieldList) = (yyvsp[(1) - (1)].interm.fieldList); } break; case 144: { - (yyval.interm) = (yyvsp[(1) - (2)].interm); - for (size_t i = 0; i < (yyvsp[(2) - (2)].interm).structure->size(); ++i) { - TType* field = (*(yyvsp[(2) - (2)].interm).structure)[i]; - for (size_t j = 0; j < (yyval.interm).structure->size(); ++j) { - if ((*(yyval.interm).structure)[j]->getFieldName() == field->getFieldName()) { - context->error((yylsp[(2) - (2)]), "duplicate field name in structure:", "struct", field->getFieldName().c_str()); + (yyval.interm.fieldList) = (yyvsp[(1) - (2)].interm.fieldList); + for (size_t i = 0; i < (yyvsp[(2) - (2)].interm.fieldList)->size(); ++i) { + TField* field = (*(yyvsp[(2) - (2)].interm.fieldList))[i]; + for (size_t j = 0; j < (yyval.interm.fieldList)->size(); ++j) { + if ((*(yyval.interm.fieldList))[j]->name() == field->name()) { + context->error((yylsp[(2) - (2)]), "duplicate field name in structure:", "struct", field->name().c_str()); context->recover(); } } - (yyval.interm).structure->push_back(field); + (yyval.interm.fieldList)->push_back(field); } } break; @@ -4134,16 +4128,16 @@ yyreduce: case 145: { - (yyval.interm) = (yyvsp[(2) - (3)].interm); + (yyval.interm.fieldList) = (yyvsp[(2) - (3)].interm.fieldList); - if (context->voidErrorCheck((yylsp[(1) - (3)]), (*(yyvsp[(2) - (3)].interm).structure)[0]->getFieldName(), (yyvsp[(1) - (3)].interm.type))) { + if (context->voidErrorCheck((yylsp[(1) - (3)]), (*(yyvsp[(2) - (3)].interm.fieldList))[0]->name(), (yyvsp[(1) - (3)].interm.type))) { context->recover(); } - for (unsigned int i = 0; i < (yyval.interm).structure->size(); ++i) { + for (unsigned int i = 0; i < (yyval.interm.fieldList)->size(); ++i) { // // Careful not to replace already known aspects of type, like array-ness // - TType* type = (*(yyval.interm).structure)[i]; + TType* type = (*(yyval.interm.fieldList))[i]->type(); type->setBasicType((yyvsp[(1) - (3)].interm.type).type); type->setNominalSize((yyvsp[(1) - (3)].interm.type).size); type->setMatrix((yyvsp[(1) - (3)].interm.type).matrix); @@ -4156,14 +4150,11 @@ yyreduce: } if ((yyvsp[(1) - (3)].interm.type).array) type->setArraySize((yyvsp[(1) - (3)].interm.type).arraySize); - if ((yyvsp[(1) - (3)].interm.type).userDef) { + if ((yyvsp[(1) - (3)].interm.type).userDef) type->setStruct((yyvsp[(1) - (3)].interm.type).userDef->getStruct()); - type->setTypeName((yyvsp[(1) - (3)].interm.type).userDef->getTypeName()); - } - if (context->structNestingErrorCheck((yylsp[(1) - (3)]), *type)) { + if (context->structNestingErrorCheck((yylsp[(1) - (3)]), *(*(yyval.interm.fieldList))[i])) context->recover(); - } } } break; @@ -4171,15 +4162,15 @@ yyreduce: case 146: { - (yyval.interm).structure = NewPoolTTypeList(); - (yyval.interm).structure->push_back((yyvsp[(1) - (1)].interm.field)); + (yyval.interm.fieldList) = NewPoolTFieldList(); + (yyval.interm.fieldList)->push_back((yyvsp[(1) - (1)].interm.field)); } break; case 147: { - (yyval.interm).structure->push_back((yyvsp[(3) - (3)].interm.field)); + (yyval.interm.fieldList)->push_back((yyvsp[(3) - (3)].interm.field)); } break; @@ -4189,8 +4180,8 @@ yyreduce: if (context->reservedErrorCheck((yylsp[(1) - (1)]), *(yyvsp[(1) - (1)].lex).string)) context->recover(); - (yyval.interm.field) = new TType(EbtVoid, EbpUndefined); - (yyval.interm.field)->setFieldName(*(yyvsp[(1) - (1)].lex).string); + TType* type = new TType(EbtVoid, EbpUndefined); + (yyval.interm.field) = new TField(type, (yyvsp[(1) - (1)].lex).string); } break; @@ -4200,13 +4191,13 @@ yyreduce: if (context->reservedErrorCheck((yylsp[(1) - (4)]), *(yyvsp[(1) - (4)].lex).string)) context->recover(); - (yyval.interm.field) = new TType(EbtVoid, EbpUndefined); - (yyval.interm.field)->setFieldName(*(yyvsp[(1) - (4)].lex).string); - - int size; - if (context->arraySizeErrorCheck((yylsp[(2) - (4)]), (yyvsp[(3) - (4)].interm.intermTypedNode), size)) + TType* type = new TType(EbtVoid, EbpUndefined); + int size = 0; + if (context->arraySizeErrorCheck((yylsp[(3) - (4)]), (yyvsp[(3) - (4)].interm.intermTypedNode), size)) context->recover(); - (yyval.interm.field)->setArraySize(size); + type->setArraySize(size); + + (yyval.interm.field) = new TField(type, (yyvsp[(1) - (4)].lex).string); } break; diff --git a/src/compiler/glslang_tab.h b/src/compiler/glslang_tab.h index 4789f5c2..2f0f1106 100644 --- a/src/compiler/glslang_tab.h +++ b/src/compiler/glslang_tab.h @@ -178,8 +178,8 @@ typedef union YYSTYPE TQualifier qualifier; TFunction* function; TParameter param; - TType* field; - TTypeList* structure; + TField* field; + TFieldList* fieldList; }; } interm; diff --git a/src/libGLESv2/Context.cpp b/src/libGLESv2/Context.cpp index 91a5ec5c..e084db1a 100644 --- a/src/libGLESv2/Context.cpp +++ b/src/libGLESv2/Context.cpp @@ -60,6 +60,7 @@ Context::Context(const gl::Context *shareContext, rx::Renderer *renderer, bool n mState.rasterizer.polygonOffsetFactor = 0.0f; mState.rasterizer.polygonOffsetUnits = 0.0f; mState.rasterizer.pointDrawMode = false; + mState.rasterizer.multiSample = false; mState.scissorTest = false; mState.scissor.x = 0; mState.scissor.y = 0; @@ -1741,7 +1742,11 @@ bool Context::applyRenderTarget(GLenum drawMode, bool ignoreViewport) // Applies the fixed-function state (culling, depth test, alpha blending, stenciling, etc) to the Direct3D 9 device void Context::applyState(GLenum drawMode) { + Framebuffer *framebufferObject = getDrawFramebuffer(); + int samples = framebufferObject->getSamples(); + mState.rasterizer.pointDrawMode = (drawMode == GL_POINTS); + mState.rasterizer.multiSample = (samples != 0); mRenderer->setRasterizerState(mState.rasterizer); unsigned int mask = 0; @@ -1749,10 +1754,10 @@ void Context::applyState(GLenum drawMode) { if (mState.sampleCoverageValue != 0) { - Framebuffer *framebufferObject = getDrawFramebuffer(); + float threshold = 0.5f; - for (int i = 0; i < framebufferObject->getSamples(); ++i) + for (int i = 0; i < samples; ++i) { mask <<= 1; diff --git a/src/libGLESv2/ProgramBinary.cpp b/src/libGLESv2/ProgramBinary.cpp index 82aca7a1..135facd8 100644 --- a/src/libGLESv2/ProgramBinary.cpp +++ b/src/libGLESv2/ProgramBinary.cpp @@ -1939,27 +1939,6 @@ bool ProgramBinary::link(InfoLog &infoLog, const AttributeBindings &attributeBin } bool success = true; - mVertexExecutable = mRenderer->compileToExecutable(infoLog, vertexHLSL.c_str(), rx::SHADER_VERTEX); - mPixelExecutable = mRenderer->compileToExecutable(infoLog, pixelHLSL.c_str(), rx::SHADER_PIXEL); - - if (usesGeometryShader()) - { - std::string geometryHLSL = generateGeometryShaderHLSL(registers, packing, fragmentShader, vertexShader); - mGeometryExecutable = mRenderer->compileToExecutable(infoLog, geometryHLSL.c_str(), rx::SHADER_GEOMETRY); - } - - if (!mVertexExecutable || !mPixelExecutable || (usesGeometryShader() && !mGeometryExecutable)) - { - infoLog.append("Failed to create D3D shaders."); - success = false; - - delete mVertexExecutable; - mVertexExecutable = NULL; - delete mPixelExecutable; - mPixelExecutable = NULL; - delete mGeometryExecutable; - mGeometryExecutable = NULL; - } if (!linkAttributes(infoLog, attributeBindings, fragmentShader, vertexShader)) { @@ -1979,6 +1958,31 @@ bool ProgramBinary::link(InfoLog &infoLog, const AttributeBindings &attributeBin mUniforms.push_back(new Uniform(GL_FLOAT, GL_HIGH_FLOAT, "gl_DepthRange.diff", 0)); } + if (success) + { + mVertexExecutable = mRenderer->compileToExecutable(infoLog, vertexHLSL.c_str(), rx::SHADER_VERTEX); + mPixelExecutable = mRenderer->compileToExecutable(infoLog, pixelHLSL.c_str(), rx::SHADER_PIXEL); + + if (usesGeometryShader()) + { + std::string geometryHLSL = generateGeometryShaderHLSL(registers, packing, fragmentShader, vertexShader); + mGeometryExecutable = mRenderer->compileToExecutable(infoLog, geometryHLSL.c_str(), rx::SHADER_GEOMETRY); + } + + if (!mVertexExecutable || !mPixelExecutable || (usesGeometryShader() && !mGeometryExecutable)) + { + infoLog.append("Failed to create D3D shaders."); + success = false; + + delete mVertexExecutable; + mVertexExecutable = NULL; + delete mPixelExecutable; + mPixelExecutable = NULL; + delete mGeometryExecutable; + mGeometryExecutable = NULL; + } + } + return success; } diff --git a/src/libGLESv2/angletypes.h b/src/libGLESv2/angletypes.h index 37f67f41..b2f0cad2 100644 --- a/src/libGLESv2/angletypes.h +++ b/src/libGLESv2/angletypes.h @@ -1,5 +1,5 @@ // -// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved. +// Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -54,6 +54,7 @@ struct RasterizerState GLfloat polygonOffsetUnits; bool pointDrawMode; + bool multiSample; }; struct BlendState diff --git a/src/libGLESv2/renderer/BufferStorage11.cpp b/src/libGLESv2/renderer/BufferStorage11.cpp index 4c37bdbf..3647d8a8 100644 --- a/src/libGLESv2/renderer/BufferStorage11.cpp +++ b/src/libGLESv2/renderer/BufferStorage11.cpp @@ -160,12 +160,20 @@ void BufferStorage11::setData(const void* data, unsigned int size, unsigned int bufferDesc.MiscFlags = 0; bufferDesc.StructureByteStride = 0; - D3D11_SUBRESOURCE_DATA initialData; - initialData.pSysMem = data; - initialData.SysMemPitch = size; - initialData.SysMemSlicePitch = 0; + if (data) + { + D3D11_SUBRESOURCE_DATA initialData; + initialData.pSysMem = data; + initialData.SysMemPitch = size; + initialData.SysMemSlicePitch = 0; + + result = device->CreateBuffer(&bufferDesc, &initialData, &mStagingBuffer); + } + else + { + result = device->CreateBuffer(&bufferDesc, NULL, &mStagingBuffer); + } - result = device->CreateBuffer(&bufferDesc, &initialData, &mStagingBuffer); if (FAILED(result)) { return gl::error(GL_OUT_OF_MEMORY); @@ -173,7 +181,7 @@ void BufferStorage11::setData(const void* data, unsigned int size, unsigned int mStagingBufferSize = size; } - else + else if (data) { D3D11_MAPPED_SUBRESOURCE mappedResource; result = context->Map(mStagingBuffer, 0, D3D11_MAP_WRITE, 0, &mappedResource); @@ -211,12 +219,20 @@ void BufferStorage11::setData(const void* data, unsigned int size, unsigned int mBufferSize = 0; } - D3D11_SUBRESOURCE_DATA initialData; - initialData.pSysMem = data; - initialData.SysMemPitch = size; - initialData.SysMemSlicePitch = 0; + if (data) + { + D3D11_SUBRESOURCE_DATA initialData; + initialData.pSysMem = data; + initialData.SysMemPitch = size; + initialData.SysMemSlicePitch = 0; + + result = device->CreateBuffer(&bufferDesc, &initialData, &mBuffer); + } + else + { + result = device->CreateBuffer(&bufferDesc, NULL, &mBuffer); + } - result = device->CreateBuffer(&bufferDesc, &initialData, &mBuffer); if (FAILED(result)) { return gl::error(GL_OUT_OF_MEMORY); diff --git a/src/libGLESv2/renderer/BufferStorage9.cpp b/src/libGLESv2/renderer/BufferStorage9.cpp index 7fc14fc0..e69e7a89 100644 --- a/src/libGLESv2/renderer/BufferStorage9.cpp +++ b/src/libGLESv2/renderer/BufferStorage9.cpp @@ -54,7 +54,10 @@ void BufferStorage9::setData(const void* data, unsigned int size, unsigned int o } mSize = std::max(mSize, offset + size); - memcpy(reinterpret_cast<char*>(mMemory) + offset, data, size); + if (data) + { + memcpy(reinterpret_cast<char*>(mMemory) + offset, data, size); + } } void BufferStorage9::clear() diff --git a/src/libGLESv2/renderer/RenderStateCache.cpp b/src/libGLESv2/renderer/RenderStateCache.cpp index f60a88f9..b3111af7 100644 --- a/src/libGLESv2/renderer/RenderStateCache.cpp +++ b/src/libGLESv2/renderer/RenderStateCache.cpp @@ -231,7 +231,7 @@ ID3D11RasterizerState *RenderStateCache::getRasterizerState(const gl::Rasterizer rasterDesc.SlopeScaledDepthBias = rasterState.polygonOffsetFactor; rasterDesc.DepthClipEnable = TRUE; rasterDesc.ScissorEnable = scissorEnabled ? TRUE : FALSE; - rasterDesc.MultisampleEnable = TRUE; + rasterDesc.MultisampleEnable = rasterState.multiSample; rasterDesc.AntialiasedLineEnable = FALSE; ID3D11RasterizerState *dx11RasterizerState = NULL; diff --git a/src/libGLESv2/renderer/Renderer11.cpp b/src/libGLESv2/renderer/Renderer11.cpp index e7fe03a5..72885dd5 100644 --- a/src/libGLESv2/renderer/Renderer11.cpp +++ b/src/libGLESv2/renderer/Renderer11.cpp @@ -844,7 +844,7 @@ bool Renderer11::applyPrimitiveType(GLenum mode, GLsizei count) case GL_TRIANGLES: primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST; break; case GL_TRIANGLE_STRIP: primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP; break; // emulate fans via rewriting index buffer - case GL_TRIANGLE_FAN: primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST; break; + case GL_TRIANGLE_FAN: primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST; break; default: return gl::error(GL_INVALID_ENUM, false); } @@ -1384,21 +1384,21 @@ void Renderer11::applyUniforms(gl::ProgramBinary *programBinary, gl::UniformArra float (*mapVS)[4] = NULL; float (*mapPS)[4] = NULL; - if (totalRegisterCountVS > 0 && vertexUniformsDirty) - { - D3D11_MAPPED_SUBRESOURCE map = {0}; - HRESULT result = mDeviceContext->Map(vertexConstantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &map); - ASSERT(SUCCEEDED(result)); - mapVS = (float(*)[4])map.pData; - } - - if (totalRegisterCountPS > 0 && pixelUniformsDirty) - { - D3D11_MAPPED_SUBRESOURCE map = {0}; - HRESULT result = mDeviceContext->Map(pixelConstantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &map); - ASSERT(SUCCEEDED(result)); - mapPS = (float(*)[4])map.pData; - } + if (totalRegisterCountVS > 0 && vertexUniformsDirty) + { + D3D11_MAPPED_SUBRESOURCE map = {0}; + HRESULT result = mDeviceContext->Map(vertexConstantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &map); + ASSERT(SUCCEEDED(result)); + mapVS = (float(*)[4])map.pData; + } + + if (totalRegisterCountPS > 0 && pixelUniformsDirty) + { + D3D11_MAPPED_SUBRESOURCE map = {0}; + HRESULT result = mDeviceContext->Map(pixelConstantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &map); + ASSERT(SUCCEEDED(result)); + mapPS = (float(*)[4])map.pData; + } for (gl::UniformArray::iterator uniform_iterator = uniformArray->begin(); uniform_iterator != uniformArray->end(); uniform_iterator++) { @@ -2116,12 +2116,12 @@ unsigned int Renderer11::getMaxCombinedTextureImageUnits() const unsigned int Renderer11::getReservedVertexUniformVectors() const { - return 0; // Driver uniforms are stored in a separate constant buffer + return 0; // Driver uniforms are stored in a separate constant buffer } unsigned int Renderer11::getReservedFragmentUniformVectors() const { - return 0; // Driver uniforms are stored in a separate constant buffer + return 0; // Driver uniforms are stored in a separate constant buffer } unsigned int Renderer11::getMaxVertexUniformVectors() const diff --git a/src/libGLESv2/renderer/ShaderExecutable.h b/src/libGLESv2/renderer/ShaderExecutable.h index 128d123f..293e3408 100644 --- a/src/libGLESv2/renderer/ShaderExecutable.h +++ b/src/libGLESv2/renderer/ShaderExecutable.h @@ -26,7 +26,7 @@ class ShaderExecutable virtual ~ShaderExecutable() { - delete mFunction; + delete[] mFunction; } void *getFunction() const diff --git a/src/preprocessor.target.darwin-arm.mk b/src/preprocessor.target.darwin-arm.mk index 45e9cb7b..127aa857 100644 --- a/src/preprocessor.target.darwin-arm.mk +++ b/src/preprocessor.target.darwin-arm.mk @@ -36,7 +36,7 @@ LOCAL_SRC_FILES := \ # Flags passed to both C and C++ files. -MY_CFLAGS := \ +MY_CFLAGS_Debug := \ -fstack-protector \ --param=ssp-buffer-size=4 \ -fno-exceptions \ @@ -71,9 +71,7 @@ MY_CFLAGS := \ -fdata-sections \ -ffunction-sections -MY_CFLAGS_C := - -MY_DEFS := \ +MY_DEFS_Debug := \ '-DANGLE_DX11' \ '-DANGLE_DISABLE_TRACE' \ '-DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1' \ @@ -98,18 +96,98 @@ MY_DEFS := \ '-DWTF_USE_DYNAMIC_ANNOTATIONS=1' \ '-D_DEBUG' -LOCAL_CFLAGS := $(MY_CFLAGS_C) $(MY_CFLAGS) $(MY_DEFS) # Include paths placed before CFLAGS/CPPFLAGS -LOCAL_C_INCLUDES := \ +LOCAL_C_INCLUDES_Debug := \ + $(PWD)/frameworks/wilhelm/include \ + $(PWD)/bionic \ + $(PWD)/external/stlport/stlport + + +# Flags passed to only C++ (and not C) files. +LOCAL_CPPFLAGS_Debug := \ + -fno-rtti \ + -fno-threadsafe-statics \ + -fvisibility-inlines-hidden \ + -Wno-deprecated \ + -Wno-abi \ + -Wno-error=c++0x-compat \ + -Wno-non-virtual-dtor \ + -Wno-sign-promo \ + -Wno-non-virtual-dtor + + +# Flags passed to both C and C++ files. +MY_CFLAGS_Release := \ + -fstack-protector \ + --param=ssp-buffer-size=4 \ + -fno-exceptions \ + -fno-strict-aliasing \ + -Wno-unused-parameter \ + -Wno-missing-field-initializers \ + -fvisibility=hidden \ + -pipe \ + -fPIC \ + -Wno-format \ + -fno-tree-sra \ + -fuse-ld=gold \ + -Wno-psabi \ + -ffunction-sections \ + -funwind-tables \ + -g \ + -fstack-protector \ + -fno-short-enums \ + -finline-limit=64 \ + -Wa,--noexecstack \ + -U_FORTIFY_SOURCE \ + -Wno-extra \ + -Wno-ignored-qualifiers \ + -Wno-type-limits \ + -Wno-address \ + -Wno-format-security \ + -Wno-return-type \ + -Wno-sequence-point \ + -Os \ + -fno-ident \ + -fdata-sections \ + -ffunction-sections \ + -fomit-frame-pointer + +MY_DEFS_Release := \ + '-DANGLE_DX11' \ + '-DANGLE_DISABLE_TRACE' \ + '-DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1' \ + '-DANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT("d3dcompiler_46.dll"), TEXT("d3dcompiler_43.dll") }' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DUSE_LINUX_BREAKPAD' \ + '-DNO_TCMALLOC' \ + '-DDISABLE_NACL' \ + '-DCHROMIUM_BUILD' \ + '-DUSE_LIBJPEG_TURBO=1' \ + '-DUSE_PROPRIETARY_CODECS' \ + '-DENABLE_GPU=1' \ + '-DUSE_OPENSSL=1' \ + '-DENABLE_EGLIMAGE=1' \ + '-DENABLE_LANGUAGE_DETECTION=1' \ + '-DANDROID' \ + '-D__GNU_SOURCE=1' \ + '-DUSE_STLPORT=1' \ + '-D_STLP_USE_PTR_SPECIALIZATIONS=1' \ + '-DCHROME_BUILD_ID=""' \ + '-DNDEBUG' \ + '-DNVALGRIND' \ + '-DDYNAMIC_ANNOTATIONS_ENABLED=0' + + +# Include paths placed before CFLAGS/CPPFLAGS +LOCAL_C_INCLUDES_Release := \ $(PWD)/frameworks/wilhelm/include \ $(PWD)/bionic \ $(PWD)/external/stlport/stlport -LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES) # Flags passed to only C++ (and not C) files. -LOCAL_CPPFLAGS := \ +LOCAL_CPPFLAGS_Release := \ -fno-rtti \ -fno-threadsafe-statics \ -fvisibility-inlines-hidden \ @@ -120,9 +198,13 @@ LOCAL_CPPFLAGS := \ -Wno-sign-promo \ -Wno-non-virtual-dtor + +LOCAL_CFLAGS := $(MY_CFLAGS_$(GYP_CONFIGURATION)) $(MY_DEFS_$(GYP_CONFIGURATION)) +LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES_$(GYP_CONFIGURATION)) +LOCAL_CPPFLAGS := $(LOCAL_CPPFLAGS_$(GYP_CONFIGURATION)) ### Rules for final target. -LOCAL_LDFLAGS := \ +LOCAL_LDFLAGS_Debug := \ -Wl,-z,now \ -Wl,-z,relro \ -Wl,-z,noexecstack \ @@ -139,6 +221,25 @@ LOCAL_LDFLAGS := \ -Wl,--as-needed +LOCAL_LDFLAGS_Release := \ + -Wl,-z,now \ + -Wl,-z,relro \ + -Wl,-z,noexecstack \ + -fPIC \ + -Wl,-z,relro \ + -Wl,-z,now \ + -fuse-ld=gold \ + -nostdlib \ + -Wl,--no-undefined \ + -Wl,--exclude-libs=ALL \ + -Wl,--icf=safe \ + -Wl,-O1 \ + -Wl,--as-needed \ + -Wl,--gc-sections + + +LOCAL_LDFLAGS := $(LOCAL_LDFLAGS_$(GYP_CONFIGURATION)) + LOCAL_STATIC_LIBRARIES := # Enable grouping to fix circular references diff --git a/src/preprocessor.target.darwin-mips.mk b/src/preprocessor.target.darwin-mips.mk index bdf2e9e6..6b7fcdd7 100644 --- a/src/preprocessor.target.darwin-mips.mk +++ b/src/preprocessor.target.darwin-mips.mk @@ -36,7 +36,7 @@ LOCAL_SRC_FILES := \ # Flags passed to both C and C++ files. -MY_CFLAGS := \ +MY_CFLAGS_Debug := \ -fstack-protector \ --param=ssp-buffer-size=4 \ \ @@ -71,9 +71,7 @@ MY_CFLAGS := \ -fdata-sections \ -ffunction-sections -MY_CFLAGS_C := - -MY_DEFS := \ +MY_DEFS_Debug := \ '-DANGLE_DX11' \ '-DANGLE_DISABLE_TRACE' \ '-DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1' \ @@ -97,18 +95,16 @@ MY_DEFS := \ '-DWTF_USE_DYNAMIC_ANNOTATIONS=1' \ '-D_DEBUG' -LOCAL_CFLAGS := $(MY_CFLAGS_C) $(MY_CFLAGS) $(MY_DEFS) # Include paths placed before CFLAGS/CPPFLAGS -LOCAL_C_INCLUDES := \ +LOCAL_C_INCLUDES_Debug := \ $(PWD)/frameworks/wilhelm/include \ $(PWD)/bionic \ $(PWD)/external/stlport/stlport -LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES) # Flags passed to only C++ (and not C) files. -LOCAL_CPPFLAGS := \ +LOCAL_CPPFLAGS_Debug := \ -fno-rtti \ -fno-threadsafe-statics \ -fvisibility-inlines-hidden \ @@ -119,9 +115,94 @@ LOCAL_CPPFLAGS := \ -Wno-sign-promo \ -Wno-non-virtual-dtor + +# Flags passed to both C and C++ files. +MY_CFLAGS_Release := \ + -fstack-protector \ + --param=ssp-buffer-size=4 \ + \ + -fno-exceptions \ + -fno-strict-aliasing \ + -Wno-unused-parameter \ + -Wno-missing-field-initializers \ + -fvisibility=hidden \ + -pipe \ + -fPIC \ + -Wno-format \ + -EL \ + -mhard-float \ + -ffunction-sections \ + -funwind-tables \ + -g \ + -fstack-protector \ + -fno-short-enums \ + -finline-limit=64 \ + -Wa,--noexecstack \ + -U_FORTIFY_SOURCE \ + -Wno-extra \ + -Wno-ignored-qualifiers \ + -Wno-type-limits \ + -Wno-address \ + -Wno-format-security \ + -Wno-return-type \ + -Wno-sequence-point \ + -Os \ + -fno-ident \ + -fdata-sections \ + -ffunction-sections \ + -fomit-frame-pointer + +MY_DEFS_Release := \ + '-DANGLE_DX11' \ + '-DANGLE_DISABLE_TRACE' \ + '-DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1' \ + '-DANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT("d3dcompiler_46.dll"), TEXT("d3dcompiler_43.dll") }' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DNO_TCMALLOC' \ + '-DDISABLE_NACL' \ + '-DCHROMIUM_BUILD' \ + '-DUSE_LIBJPEG_TURBO=1' \ + '-DUSE_PROPRIETARY_CODECS' \ + '-DENABLE_GPU=1' \ + '-DUSE_OPENSSL=1' \ + '-DENABLE_EGLIMAGE=1' \ + '-DENABLE_LANGUAGE_DETECTION=1' \ + '-DANDROID' \ + '-D__GNU_SOURCE=1' \ + '-DUSE_STLPORT=1' \ + '-D_STLP_USE_PTR_SPECIALIZATIONS=1' \ + '-DCHROME_BUILD_ID=""' \ + '-DNDEBUG' \ + '-DNVALGRIND' \ + '-DDYNAMIC_ANNOTATIONS_ENABLED=0' + + +# Include paths placed before CFLAGS/CPPFLAGS +LOCAL_C_INCLUDES_Release := \ + $(PWD)/frameworks/wilhelm/include \ + $(PWD)/bionic \ + $(PWD)/external/stlport/stlport + + +# Flags passed to only C++ (and not C) files. +LOCAL_CPPFLAGS_Release := \ + -fno-rtti \ + -fno-threadsafe-statics \ + -fvisibility-inlines-hidden \ + -Wno-deprecated \ + -Wno-uninitialized \ + -Wno-error=c++0x-compat \ + -Wno-non-virtual-dtor \ + -Wno-sign-promo \ + -Wno-non-virtual-dtor + + +LOCAL_CFLAGS := $(MY_CFLAGS_$(GYP_CONFIGURATION)) $(MY_DEFS_$(GYP_CONFIGURATION)) +LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES_$(GYP_CONFIGURATION)) +LOCAL_CPPFLAGS := $(LOCAL_CPPFLAGS_$(GYP_CONFIGURATION)) ### Rules for final target. -LOCAL_LDFLAGS := \ +LOCAL_LDFLAGS_Debug := \ -Wl,-z,now \ -Wl,-z,relro \ -Wl,-z,noexecstack \ @@ -136,6 +217,23 @@ LOCAL_LDFLAGS := \ -Wl,--as-needed +LOCAL_LDFLAGS_Release := \ + -Wl,-z,now \ + -Wl,-z,relro \ + -Wl,-z,noexecstack \ + -fPIC \ + -EL \ + -Wl,--no-keep-memory \ + -nostdlib \ + -Wl,--no-undefined \ + -Wl,--exclude-libs=ALL \ + -Wl,-O1 \ + -Wl,--as-needed \ + -Wl,--gc-sections + + +LOCAL_LDFLAGS := $(LOCAL_LDFLAGS_$(GYP_CONFIGURATION)) + LOCAL_STATIC_LIBRARIES := # Enable grouping to fix circular references diff --git a/src/preprocessor.target.darwin-x86.mk b/src/preprocessor.target.darwin-x86.mk index 97dea5e5..381b9296 100644 --- a/src/preprocessor.target.darwin-x86.mk +++ b/src/preprocessor.target.darwin-x86.mk @@ -36,7 +36,7 @@ LOCAL_SRC_FILES := \ # Flags passed to both C and C++ files. -MY_CFLAGS := \ +MY_CFLAGS_Debug := \ --param=ssp-buffer-size=4 \ -fno-exceptions \ -fno-strict-aliasing \ @@ -73,9 +73,7 @@ MY_CFLAGS := \ -fdata-sections \ -ffunction-sections -MY_CFLAGS_C := - -MY_DEFS := \ +MY_DEFS_Debug := \ '-DANGLE_DX11' \ '-DANGLE_DISABLE_TRACE' \ '-DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1' \ @@ -100,18 +98,101 @@ MY_DEFS := \ '-DWTF_USE_DYNAMIC_ANNOTATIONS=1' \ '-D_DEBUG' -LOCAL_CFLAGS := $(MY_CFLAGS_C) $(MY_CFLAGS) $(MY_DEFS) # Include paths placed before CFLAGS/CPPFLAGS -LOCAL_C_INCLUDES := \ +LOCAL_C_INCLUDES_Debug := \ + $(PWD)/frameworks/wilhelm/include \ + $(PWD)/bionic \ + $(PWD)/external/stlport/stlport + + +# Flags passed to only C++ (and not C) files. +LOCAL_CPPFLAGS_Debug := \ + -fno-rtti \ + -fno-threadsafe-statics \ + -fvisibility-inlines-hidden \ + -Wno-deprecated \ + -Wno-error=c++0x-compat \ + -Wno-non-virtual-dtor \ + -Wno-sign-promo \ + -Wno-non-virtual-dtor + + +# Flags passed to both C and C++ files. +MY_CFLAGS_Release := \ + --param=ssp-buffer-size=4 \ + -fno-exceptions \ + -fno-strict-aliasing \ + -Wno-unused-parameter \ + -Wno-missing-field-initializers \ + -fvisibility=hidden \ + -pipe \ + -fPIC \ + -Wno-format \ + -m32 \ + -mmmx \ + -march=pentium4 \ + -msse2 \ + -mfpmath=sse \ + -fuse-ld=gold \ + -ffunction-sections \ + -funwind-tables \ + -g \ + -fno-short-enums \ + -finline-limit=64 \ + -Wa,--noexecstack \ + -U_FORTIFY_SOURCE \ + -Wno-extra \ + -Wno-ignored-qualifiers \ + -Wno-type-limits \ + -Wno-address \ + -Wno-format-security \ + -Wno-return-type \ + -Wno-sequence-point \ + -fno-stack-protector \ + -Os \ + -fno-ident \ + -fdata-sections \ + -ffunction-sections \ + -fomit-frame-pointer \ + -fno-unwind-tables \ + -fno-asynchronous-unwind-tables + +MY_DEFS_Release := \ + '-DANGLE_DX11' \ + '-DANGLE_DISABLE_TRACE' \ + '-DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1' \ + '-DANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT("d3dcompiler_46.dll"), TEXT("d3dcompiler_43.dll") }' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DUSE_LINUX_BREAKPAD' \ + '-DNO_TCMALLOC' \ + '-DDISABLE_NACL' \ + '-DCHROMIUM_BUILD' \ + '-DUSE_LIBJPEG_TURBO=1' \ + '-DUSE_PROPRIETARY_CODECS' \ + '-DENABLE_GPU=1' \ + '-DUSE_OPENSSL=1' \ + '-DENABLE_EGLIMAGE=1' \ + '-DENABLE_LANGUAGE_DETECTION=1' \ + '-DANDROID' \ + '-D__GNU_SOURCE=1' \ + '-DUSE_STLPORT=1' \ + '-D_STLP_USE_PTR_SPECIALIZATIONS=1' \ + '-DCHROME_BUILD_ID=""' \ + '-DNDEBUG' \ + '-DNVALGRIND' \ + '-DDYNAMIC_ANNOTATIONS_ENABLED=0' + + +# Include paths placed before CFLAGS/CPPFLAGS +LOCAL_C_INCLUDES_Release := \ $(PWD)/frameworks/wilhelm/include \ $(PWD)/bionic \ $(PWD)/external/stlport/stlport -LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES) # Flags passed to only C++ (and not C) files. -LOCAL_CPPFLAGS := \ +LOCAL_CPPFLAGS_Release := \ -fno-rtti \ -fno-threadsafe-statics \ -fvisibility-inlines-hidden \ @@ -121,9 +202,13 @@ LOCAL_CPPFLAGS := \ -Wno-sign-promo \ -Wno-non-virtual-dtor + +LOCAL_CFLAGS := $(MY_CFLAGS_$(GYP_CONFIGURATION)) $(MY_DEFS_$(GYP_CONFIGURATION)) +LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES_$(GYP_CONFIGURATION)) +LOCAL_CPPFLAGS := $(LOCAL_CPPFLAGS_$(GYP_CONFIGURATION)) ### Rules for final target. -LOCAL_LDFLAGS := \ +LOCAL_LDFLAGS_Debug := \ -Wl,-z,now \ -Wl,-z,relro \ -Wl,-z,noexecstack \ @@ -138,6 +223,23 @@ LOCAL_LDFLAGS := \ -Wl,--as-needed +LOCAL_LDFLAGS_Release := \ + -Wl,-z,now \ + -Wl,-z,relro \ + -Wl,-z,noexecstack \ + -fPIC \ + -m32 \ + -fuse-ld=gold \ + -nostdlib \ + -Wl,--no-undefined \ + -Wl,--exclude-libs=ALL \ + -Wl,-O1 \ + -Wl,--as-needed \ + -Wl,--gc-sections + + +LOCAL_LDFLAGS := $(LOCAL_LDFLAGS_$(GYP_CONFIGURATION)) + LOCAL_STATIC_LIBRARIES := # Enable grouping to fix circular references diff --git a/src/preprocessor.target.linux-arm.mk b/src/preprocessor.target.linux-arm.mk index 45e9cb7b..127aa857 100644 --- a/src/preprocessor.target.linux-arm.mk +++ b/src/preprocessor.target.linux-arm.mk @@ -36,7 +36,7 @@ LOCAL_SRC_FILES := \ # Flags passed to both C and C++ files. -MY_CFLAGS := \ +MY_CFLAGS_Debug := \ -fstack-protector \ --param=ssp-buffer-size=4 \ -fno-exceptions \ @@ -71,9 +71,7 @@ MY_CFLAGS := \ -fdata-sections \ -ffunction-sections -MY_CFLAGS_C := - -MY_DEFS := \ +MY_DEFS_Debug := \ '-DANGLE_DX11' \ '-DANGLE_DISABLE_TRACE' \ '-DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1' \ @@ -98,18 +96,98 @@ MY_DEFS := \ '-DWTF_USE_DYNAMIC_ANNOTATIONS=1' \ '-D_DEBUG' -LOCAL_CFLAGS := $(MY_CFLAGS_C) $(MY_CFLAGS) $(MY_DEFS) # Include paths placed before CFLAGS/CPPFLAGS -LOCAL_C_INCLUDES := \ +LOCAL_C_INCLUDES_Debug := \ + $(PWD)/frameworks/wilhelm/include \ + $(PWD)/bionic \ + $(PWD)/external/stlport/stlport + + +# Flags passed to only C++ (and not C) files. +LOCAL_CPPFLAGS_Debug := \ + -fno-rtti \ + -fno-threadsafe-statics \ + -fvisibility-inlines-hidden \ + -Wno-deprecated \ + -Wno-abi \ + -Wno-error=c++0x-compat \ + -Wno-non-virtual-dtor \ + -Wno-sign-promo \ + -Wno-non-virtual-dtor + + +# Flags passed to both C and C++ files. +MY_CFLAGS_Release := \ + -fstack-protector \ + --param=ssp-buffer-size=4 \ + -fno-exceptions \ + -fno-strict-aliasing \ + -Wno-unused-parameter \ + -Wno-missing-field-initializers \ + -fvisibility=hidden \ + -pipe \ + -fPIC \ + -Wno-format \ + -fno-tree-sra \ + -fuse-ld=gold \ + -Wno-psabi \ + -ffunction-sections \ + -funwind-tables \ + -g \ + -fstack-protector \ + -fno-short-enums \ + -finline-limit=64 \ + -Wa,--noexecstack \ + -U_FORTIFY_SOURCE \ + -Wno-extra \ + -Wno-ignored-qualifiers \ + -Wno-type-limits \ + -Wno-address \ + -Wno-format-security \ + -Wno-return-type \ + -Wno-sequence-point \ + -Os \ + -fno-ident \ + -fdata-sections \ + -ffunction-sections \ + -fomit-frame-pointer + +MY_DEFS_Release := \ + '-DANGLE_DX11' \ + '-DANGLE_DISABLE_TRACE' \ + '-DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1' \ + '-DANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT("d3dcompiler_46.dll"), TEXT("d3dcompiler_43.dll") }' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DUSE_LINUX_BREAKPAD' \ + '-DNO_TCMALLOC' \ + '-DDISABLE_NACL' \ + '-DCHROMIUM_BUILD' \ + '-DUSE_LIBJPEG_TURBO=1' \ + '-DUSE_PROPRIETARY_CODECS' \ + '-DENABLE_GPU=1' \ + '-DUSE_OPENSSL=1' \ + '-DENABLE_EGLIMAGE=1' \ + '-DENABLE_LANGUAGE_DETECTION=1' \ + '-DANDROID' \ + '-D__GNU_SOURCE=1' \ + '-DUSE_STLPORT=1' \ + '-D_STLP_USE_PTR_SPECIALIZATIONS=1' \ + '-DCHROME_BUILD_ID=""' \ + '-DNDEBUG' \ + '-DNVALGRIND' \ + '-DDYNAMIC_ANNOTATIONS_ENABLED=0' + + +# Include paths placed before CFLAGS/CPPFLAGS +LOCAL_C_INCLUDES_Release := \ $(PWD)/frameworks/wilhelm/include \ $(PWD)/bionic \ $(PWD)/external/stlport/stlport -LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES) # Flags passed to only C++ (and not C) files. -LOCAL_CPPFLAGS := \ +LOCAL_CPPFLAGS_Release := \ -fno-rtti \ -fno-threadsafe-statics \ -fvisibility-inlines-hidden \ @@ -120,9 +198,13 @@ LOCAL_CPPFLAGS := \ -Wno-sign-promo \ -Wno-non-virtual-dtor + +LOCAL_CFLAGS := $(MY_CFLAGS_$(GYP_CONFIGURATION)) $(MY_DEFS_$(GYP_CONFIGURATION)) +LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES_$(GYP_CONFIGURATION)) +LOCAL_CPPFLAGS := $(LOCAL_CPPFLAGS_$(GYP_CONFIGURATION)) ### Rules for final target. -LOCAL_LDFLAGS := \ +LOCAL_LDFLAGS_Debug := \ -Wl,-z,now \ -Wl,-z,relro \ -Wl,-z,noexecstack \ @@ -139,6 +221,25 @@ LOCAL_LDFLAGS := \ -Wl,--as-needed +LOCAL_LDFLAGS_Release := \ + -Wl,-z,now \ + -Wl,-z,relro \ + -Wl,-z,noexecstack \ + -fPIC \ + -Wl,-z,relro \ + -Wl,-z,now \ + -fuse-ld=gold \ + -nostdlib \ + -Wl,--no-undefined \ + -Wl,--exclude-libs=ALL \ + -Wl,--icf=safe \ + -Wl,-O1 \ + -Wl,--as-needed \ + -Wl,--gc-sections + + +LOCAL_LDFLAGS := $(LOCAL_LDFLAGS_$(GYP_CONFIGURATION)) + LOCAL_STATIC_LIBRARIES := # Enable grouping to fix circular references diff --git a/src/preprocessor.target.linux-mips.mk b/src/preprocessor.target.linux-mips.mk index bdf2e9e6..6b7fcdd7 100644 --- a/src/preprocessor.target.linux-mips.mk +++ b/src/preprocessor.target.linux-mips.mk @@ -36,7 +36,7 @@ LOCAL_SRC_FILES := \ # Flags passed to both C and C++ files. -MY_CFLAGS := \ +MY_CFLAGS_Debug := \ -fstack-protector \ --param=ssp-buffer-size=4 \ \ @@ -71,9 +71,7 @@ MY_CFLAGS := \ -fdata-sections \ -ffunction-sections -MY_CFLAGS_C := - -MY_DEFS := \ +MY_DEFS_Debug := \ '-DANGLE_DX11' \ '-DANGLE_DISABLE_TRACE' \ '-DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1' \ @@ -97,18 +95,16 @@ MY_DEFS := \ '-DWTF_USE_DYNAMIC_ANNOTATIONS=1' \ '-D_DEBUG' -LOCAL_CFLAGS := $(MY_CFLAGS_C) $(MY_CFLAGS) $(MY_DEFS) # Include paths placed before CFLAGS/CPPFLAGS -LOCAL_C_INCLUDES := \ +LOCAL_C_INCLUDES_Debug := \ $(PWD)/frameworks/wilhelm/include \ $(PWD)/bionic \ $(PWD)/external/stlport/stlport -LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES) # Flags passed to only C++ (and not C) files. -LOCAL_CPPFLAGS := \ +LOCAL_CPPFLAGS_Debug := \ -fno-rtti \ -fno-threadsafe-statics \ -fvisibility-inlines-hidden \ @@ -119,9 +115,94 @@ LOCAL_CPPFLAGS := \ -Wno-sign-promo \ -Wno-non-virtual-dtor + +# Flags passed to both C and C++ files. +MY_CFLAGS_Release := \ + -fstack-protector \ + --param=ssp-buffer-size=4 \ + \ + -fno-exceptions \ + -fno-strict-aliasing \ + -Wno-unused-parameter \ + -Wno-missing-field-initializers \ + -fvisibility=hidden \ + -pipe \ + -fPIC \ + -Wno-format \ + -EL \ + -mhard-float \ + -ffunction-sections \ + -funwind-tables \ + -g \ + -fstack-protector \ + -fno-short-enums \ + -finline-limit=64 \ + -Wa,--noexecstack \ + -U_FORTIFY_SOURCE \ + -Wno-extra \ + -Wno-ignored-qualifiers \ + -Wno-type-limits \ + -Wno-address \ + -Wno-format-security \ + -Wno-return-type \ + -Wno-sequence-point \ + -Os \ + -fno-ident \ + -fdata-sections \ + -ffunction-sections \ + -fomit-frame-pointer + +MY_DEFS_Release := \ + '-DANGLE_DX11' \ + '-DANGLE_DISABLE_TRACE' \ + '-DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1' \ + '-DANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT("d3dcompiler_46.dll"), TEXT("d3dcompiler_43.dll") }' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DNO_TCMALLOC' \ + '-DDISABLE_NACL' \ + '-DCHROMIUM_BUILD' \ + '-DUSE_LIBJPEG_TURBO=1' \ + '-DUSE_PROPRIETARY_CODECS' \ + '-DENABLE_GPU=1' \ + '-DUSE_OPENSSL=1' \ + '-DENABLE_EGLIMAGE=1' \ + '-DENABLE_LANGUAGE_DETECTION=1' \ + '-DANDROID' \ + '-D__GNU_SOURCE=1' \ + '-DUSE_STLPORT=1' \ + '-D_STLP_USE_PTR_SPECIALIZATIONS=1' \ + '-DCHROME_BUILD_ID=""' \ + '-DNDEBUG' \ + '-DNVALGRIND' \ + '-DDYNAMIC_ANNOTATIONS_ENABLED=0' + + +# Include paths placed before CFLAGS/CPPFLAGS +LOCAL_C_INCLUDES_Release := \ + $(PWD)/frameworks/wilhelm/include \ + $(PWD)/bionic \ + $(PWD)/external/stlport/stlport + + +# Flags passed to only C++ (and not C) files. +LOCAL_CPPFLAGS_Release := \ + -fno-rtti \ + -fno-threadsafe-statics \ + -fvisibility-inlines-hidden \ + -Wno-deprecated \ + -Wno-uninitialized \ + -Wno-error=c++0x-compat \ + -Wno-non-virtual-dtor \ + -Wno-sign-promo \ + -Wno-non-virtual-dtor + + +LOCAL_CFLAGS := $(MY_CFLAGS_$(GYP_CONFIGURATION)) $(MY_DEFS_$(GYP_CONFIGURATION)) +LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES_$(GYP_CONFIGURATION)) +LOCAL_CPPFLAGS := $(LOCAL_CPPFLAGS_$(GYP_CONFIGURATION)) ### Rules for final target. -LOCAL_LDFLAGS := \ +LOCAL_LDFLAGS_Debug := \ -Wl,-z,now \ -Wl,-z,relro \ -Wl,-z,noexecstack \ @@ -136,6 +217,23 @@ LOCAL_LDFLAGS := \ -Wl,--as-needed +LOCAL_LDFLAGS_Release := \ + -Wl,-z,now \ + -Wl,-z,relro \ + -Wl,-z,noexecstack \ + -fPIC \ + -EL \ + -Wl,--no-keep-memory \ + -nostdlib \ + -Wl,--no-undefined \ + -Wl,--exclude-libs=ALL \ + -Wl,-O1 \ + -Wl,--as-needed \ + -Wl,--gc-sections + + +LOCAL_LDFLAGS := $(LOCAL_LDFLAGS_$(GYP_CONFIGURATION)) + LOCAL_STATIC_LIBRARIES := # Enable grouping to fix circular references diff --git a/src/preprocessor.target.linux-x86.mk b/src/preprocessor.target.linux-x86.mk index 97dea5e5..381b9296 100644 --- a/src/preprocessor.target.linux-x86.mk +++ b/src/preprocessor.target.linux-x86.mk @@ -36,7 +36,7 @@ LOCAL_SRC_FILES := \ # Flags passed to both C and C++ files. -MY_CFLAGS := \ +MY_CFLAGS_Debug := \ --param=ssp-buffer-size=4 \ -fno-exceptions \ -fno-strict-aliasing \ @@ -73,9 +73,7 @@ MY_CFLAGS := \ -fdata-sections \ -ffunction-sections -MY_CFLAGS_C := - -MY_DEFS := \ +MY_DEFS_Debug := \ '-DANGLE_DX11' \ '-DANGLE_DISABLE_TRACE' \ '-DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1' \ @@ -100,18 +98,101 @@ MY_DEFS := \ '-DWTF_USE_DYNAMIC_ANNOTATIONS=1' \ '-D_DEBUG' -LOCAL_CFLAGS := $(MY_CFLAGS_C) $(MY_CFLAGS) $(MY_DEFS) # Include paths placed before CFLAGS/CPPFLAGS -LOCAL_C_INCLUDES := \ +LOCAL_C_INCLUDES_Debug := \ + $(PWD)/frameworks/wilhelm/include \ + $(PWD)/bionic \ + $(PWD)/external/stlport/stlport + + +# Flags passed to only C++ (and not C) files. +LOCAL_CPPFLAGS_Debug := \ + -fno-rtti \ + -fno-threadsafe-statics \ + -fvisibility-inlines-hidden \ + -Wno-deprecated \ + -Wno-error=c++0x-compat \ + -Wno-non-virtual-dtor \ + -Wno-sign-promo \ + -Wno-non-virtual-dtor + + +# Flags passed to both C and C++ files. +MY_CFLAGS_Release := \ + --param=ssp-buffer-size=4 \ + -fno-exceptions \ + -fno-strict-aliasing \ + -Wno-unused-parameter \ + -Wno-missing-field-initializers \ + -fvisibility=hidden \ + -pipe \ + -fPIC \ + -Wno-format \ + -m32 \ + -mmmx \ + -march=pentium4 \ + -msse2 \ + -mfpmath=sse \ + -fuse-ld=gold \ + -ffunction-sections \ + -funwind-tables \ + -g \ + -fno-short-enums \ + -finline-limit=64 \ + -Wa,--noexecstack \ + -U_FORTIFY_SOURCE \ + -Wno-extra \ + -Wno-ignored-qualifiers \ + -Wno-type-limits \ + -Wno-address \ + -Wno-format-security \ + -Wno-return-type \ + -Wno-sequence-point \ + -fno-stack-protector \ + -Os \ + -fno-ident \ + -fdata-sections \ + -ffunction-sections \ + -fomit-frame-pointer \ + -fno-unwind-tables \ + -fno-asynchronous-unwind-tables + +MY_DEFS_Release := \ + '-DANGLE_DX11' \ + '-DANGLE_DISABLE_TRACE' \ + '-DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1' \ + '-DANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT("d3dcompiler_46.dll"), TEXT("d3dcompiler_43.dll") }' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DUSE_LINUX_BREAKPAD' \ + '-DNO_TCMALLOC' \ + '-DDISABLE_NACL' \ + '-DCHROMIUM_BUILD' \ + '-DUSE_LIBJPEG_TURBO=1' \ + '-DUSE_PROPRIETARY_CODECS' \ + '-DENABLE_GPU=1' \ + '-DUSE_OPENSSL=1' \ + '-DENABLE_EGLIMAGE=1' \ + '-DENABLE_LANGUAGE_DETECTION=1' \ + '-DANDROID' \ + '-D__GNU_SOURCE=1' \ + '-DUSE_STLPORT=1' \ + '-D_STLP_USE_PTR_SPECIALIZATIONS=1' \ + '-DCHROME_BUILD_ID=""' \ + '-DNDEBUG' \ + '-DNVALGRIND' \ + '-DDYNAMIC_ANNOTATIONS_ENABLED=0' + + +# Include paths placed before CFLAGS/CPPFLAGS +LOCAL_C_INCLUDES_Release := \ $(PWD)/frameworks/wilhelm/include \ $(PWD)/bionic \ $(PWD)/external/stlport/stlport -LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES) # Flags passed to only C++ (and not C) files. -LOCAL_CPPFLAGS := \ +LOCAL_CPPFLAGS_Release := \ -fno-rtti \ -fno-threadsafe-statics \ -fvisibility-inlines-hidden \ @@ -121,9 +202,13 @@ LOCAL_CPPFLAGS := \ -Wno-sign-promo \ -Wno-non-virtual-dtor + +LOCAL_CFLAGS := $(MY_CFLAGS_$(GYP_CONFIGURATION)) $(MY_DEFS_$(GYP_CONFIGURATION)) +LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES_$(GYP_CONFIGURATION)) +LOCAL_CPPFLAGS := $(LOCAL_CPPFLAGS_$(GYP_CONFIGURATION)) ### Rules for final target. -LOCAL_LDFLAGS := \ +LOCAL_LDFLAGS_Debug := \ -Wl,-z,now \ -Wl,-z,relro \ -Wl,-z,noexecstack \ @@ -138,6 +223,23 @@ LOCAL_LDFLAGS := \ -Wl,--as-needed +LOCAL_LDFLAGS_Release := \ + -Wl,-z,now \ + -Wl,-z,relro \ + -Wl,-z,noexecstack \ + -fPIC \ + -m32 \ + -fuse-ld=gold \ + -nostdlib \ + -Wl,--no-undefined \ + -Wl,--exclude-libs=ALL \ + -Wl,-O1 \ + -Wl,--as-needed \ + -Wl,--gc-sections + + +LOCAL_LDFLAGS := $(LOCAL_LDFLAGS_$(GYP_CONFIGURATION)) + LOCAL_STATIC_LIBRARIES := # Enable grouping to fix circular references diff --git a/src/translator_common.target.darwin-arm.mk b/src/translator_common.target.darwin-arm.mk index 9a811ebe..d9a16af6 100644 --- a/src/translator_common.target.darwin-arm.mk +++ b/src/translator_common.target.darwin-arm.mk @@ -61,7 +61,7 @@ LOCAL_SRC_FILES := \ # Flags passed to both C and C++ files. -MY_CFLAGS := \ +MY_CFLAGS_Debug := \ -fstack-protector \ --param=ssp-buffer-size=4 \ -fno-exceptions \ @@ -96,9 +96,7 @@ MY_CFLAGS := \ -fdata-sections \ -ffunction-sections -MY_CFLAGS_C := - -MY_DEFS := \ +MY_DEFS_Debug := \ '-DANGLE_DX11' \ '-DANGLE_DISABLE_TRACE' \ '-DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1' \ @@ -124,20 +122,18 @@ MY_DEFS := \ '-DWTF_USE_DYNAMIC_ANNOTATIONS=1' \ '-D_DEBUG' -LOCAL_CFLAGS := $(MY_CFLAGS_C) $(MY_CFLAGS) $(MY_DEFS) # Include paths placed before CFLAGS/CPPFLAGS -LOCAL_C_INCLUDES := \ +LOCAL_C_INCLUDES_Debug := \ $(LOCAL_PATH)/third_party/angle_dx11/src \ $(LOCAL_PATH)/third_party/angle_dx11/include \ $(PWD)/frameworks/wilhelm/include \ $(PWD)/bionic \ $(PWD)/external/stlport/stlport -LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES) # Flags passed to only C++ (and not C) files. -LOCAL_CPPFLAGS := \ +LOCAL_CPPFLAGS_Debug := \ -fno-rtti \ -fno-threadsafe-statics \ -fvisibility-inlines-hidden \ @@ -148,9 +144,98 @@ LOCAL_CPPFLAGS := \ -Wno-sign-promo \ -Wno-non-virtual-dtor + +# Flags passed to both C and C++ files. +MY_CFLAGS_Release := \ + -fstack-protector \ + --param=ssp-buffer-size=4 \ + -fno-exceptions \ + -fno-strict-aliasing \ + -Wno-unused-parameter \ + -Wno-missing-field-initializers \ + -fvisibility=hidden \ + -pipe \ + -fPIC \ + -Wno-format \ + -fno-tree-sra \ + -fuse-ld=gold \ + -Wno-psabi \ + -ffunction-sections \ + -funwind-tables \ + -g \ + -fstack-protector \ + -fno-short-enums \ + -finline-limit=64 \ + -Wa,--noexecstack \ + -U_FORTIFY_SOURCE \ + -Wno-extra \ + -Wno-ignored-qualifiers \ + -Wno-type-limits \ + -Wno-address \ + -Wno-format-security \ + -Wno-return-type \ + -Wno-sequence-point \ + -Os \ + -fno-ident \ + -fdata-sections \ + -ffunction-sections \ + -fomit-frame-pointer + +MY_DEFS_Release := \ + '-DANGLE_DX11' \ + '-DANGLE_DISABLE_TRACE' \ + '-DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1' \ + '-DANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT("d3dcompiler_46.dll"), TEXT("d3dcompiler_43.dll") }' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DUSE_LINUX_BREAKPAD' \ + '-DNO_TCMALLOC' \ + '-DDISABLE_NACL' \ + '-DCHROMIUM_BUILD' \ + '-DUSE_LIBJPEG_TURBO=1' \ + '-DUSE_PROPRIETARY_CODECS' \ + '-DENABLE_GPU=1' \ + '-DUSE_OPENSSL=1' \ + '-DENABLE_EGLIMAGE=1' \ + '-DENABLE_LANGUAGE_DETECTION=1' \ + '-DCOMPILER_IMPLEMENTATION' \ + '-DANDROID' \ + '-D__GNU_SOURCE=1' \ + '-DUSE_STLPORT=1' \ + '-D_STLP_USE_PTR_SPECIALIZATIONS=1' \ + '-DCHROME_BUILD_ID=""' \ + '-DNDEBUG' \ + '-DNVALGRIND' \ + '-DDYNAMIC_ANNOTATIONS_ENABLED=0' + + +# Include paths placed before CFLAGS/CPPFLAGS +LOCAL_C_INCLUDES_Release := \ + $(LOCAL_PATH)/third_party/angle_dx11/src \ + $(LOCAL_PATH)/third_party/angle_dx11/include \ + $(PWD)/frameworks/wilhelm/include \ + $(PWD)/bionic \ + $(PWD)/external/stlport/stlport + + +# Flags passed to only C++ (and not C) files. +LOCAL_CPPFLAGS_Release := \ + -fno-rtti \ + -fno-threadsafe-statics \ + -fvisibility-inlines-hidden \ + -Wno-deprecated \ + -Wno-abi \ + -Wno-error=c++0x-compat \ + -Wno-non-virtual-dtor \ + -Wno-sign-promo \ + -Wno-non-virtual-dtor + + +LOCAL_CFLAGS := $(MY_CFLAGS_$(GYP_CONFIGURATION)) $(MY_DEFS_$(GYP_CONFIGURATION)) +LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES_$(GYP_CONFIGURATION)) +LOCAL_CPPFLAGS := $(LOCAL_CPPFLAGS_$(GYP_CONFIGURATION)) ### Rules for final target. -LOCAL_LDFLAGS := \ +LOCAL_LDFLAGS_Debug := \ -Wl,-z,now \ -Wl,-z,relro \ -Wl,-z,noexecstack \ @@ -167,6 +252,25 @@ LOCAL_LDFLAGS := \ -Wl,--as-needed +LOCAL_LDFLAGS_Release := \ + -Wl,-z,now \ + -Wl,-z,relro \ + -Wl,-z,noexecstack \ + -fPIC \ + -Wl,-z,relro \ + -Wl,-z,now \ + -fuse-ld=gold \ + -nostdlib \ + -Wl,--no-undefined \ + -Wl,--exclude-libs=ALL \ + -Wl,--icf=safe \ + -Wl,-O1 \ + -Wl,--as-needed \ + -Wl,--gc-sections + + +LOCAL_LDFLAGS := $(LOCAL_LDFLAGS_$(GYP_CONFIGURATION)) + LOCAL_STATIC_LIBRARIES := # Enable grouping to fix circular references diff --git a/src/translator_common.target.darwin-mips.mk b/src/translator_common.target.darwin-mips.mk index d1ea20f6..19445433 100644 --- a/src/translator_common.target.darwin-mips.mk +++ b/src/translator_common.target.darwin-mips.mk @@ -61,7 +61,7 @@ LOCAL_SRC_FILES := \ # Flags passed to both C and C++ files. -MY_CFLAGS := \ +MY_CFLAGS_Debug := \ -fstack-protector \ --param=ssp-buffer-size=4 \ \ @@ -96,9 +96,7 @@ MY_CFLAGS := \ -fdata-sections \ -ffunction-sections -MY_CFLAGS_C := - -MY_DEFS := \ +MY_DEFS_Debug := \ '-DANGLE_DX11' \ '-DANGLE_DISABLE_TRACE' \ '-DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1' \ @@ -123,20 +121,102 @@ MY_DEFS := \ '-DWTF_USE_DYNAMIC_ANNOTATIONS=1' \ '-D_DEBUG' -LOCAL_CFLAGS := $(MY_CFLAGS_C) $(MY_CFLAGS) $(MY_DEFS) # Include paths placed before CFLAGS/CPPFLAGS -LOCAL_C_INCLUDES := \ +LOCAL_C_INCLUDES_Debug := \ + $(LOCAL_PATH)/third_party/angle_dx11/src \ + $(LOCAL_PATH)/third_party/angle_dx11/include \ + $(PWD)/frameworks/wilhelm/include \ + $(PWD)/bionic \ + $(PWD)/external/stlport/stlport + + +# Flags passed to only C++ (and not C) files. +LOCAL_CPPFLAGS_Debug := \ + -fno-rtti \ + -fno-threadsafe-statics \ + -fvisibility-inlines-hidden \ + -Wno-deprecated \ + -Wno-uninitialized \ + -Wno-error=c++0x-compat \ + -Wno-non-virtual-dtor \ + -Wno-sign-promo \ + -Wno-non-virtual-dtor + + +# Flags passed to both C and C++ files. +MY_CFLAGS_Release := \ + -fstack-protector \ + --param=ssp-buffer-size=4 \ + \ + -fno-exceptions \ + -fno-strict-aliasing \ + -Wno-unused-parameter \ + -Wno-missing-field-initializers \ + -fvisibility=hidden \ + -pipe \ + -fPIC \ + -Wno-format \ + -EL \ + -mhard-float \ + -ffunction-sections \ + -funwind-tables \ + -g \ + -fstack-protector \ + -fno-short-enums \ + -finline-limit=64 \ + -Wa,--noexecstack \ + -U_FORTIFY_SOURCE \ + -Wno-extra \ + -Wno-ignored-qualifiers \ + -Wno-type-limits \ + -Wno-address \ + -Wno-format-security \ + -Wno-return-type \ + -Wno-sequence-point \ + -Os \ + -fno-ident \ + -fdata-sections \ + -ffunction-sections \ + -fomit-frame-pointer + +MY_DEFS_Release := \ + '-DANGLE_DX11' \ + '-DANGLE_DISABLE_TRACE' \ + '-DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1' \ + '-DANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT("d3dcompiler_46.dll"), TEXT("d3dcompiler_43.dll") }' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DNO_TCMALLOC' \ + '-DDISABLE_NACL' \ + '-DCHROMIUM_BUILD' \ + '-DUSE_LIBJPEG_TURBO=1' \ + '-DUSE_PROPRIETARY_CODECS' \ + '-DENABLE_GPU=1' \ + '-DUSE_OPENSSL=1' \ + '-DENABLE_EGLIMAGE=1' \ + '-DENABLE_LANGUAGE_DETECTION=1' \ + '-DCOMPILER_IMPLEMENTATION' \ + '-DANDROID' \ + '-D__GNU_SOURCE=1' \ + '-DUSE_STLPORT=1' \ + '-D_STLP_USE_PTR_SPECIALIZATIONS=1' \ + '-DCHROME_BUILD_ID=""' \ + '-DNDEBUG' \ + '-DNVALGRIND' \ + '-DDYNAMIC_ANNOTATIONS_ENABLED=0' + + +# Include paths placed before CFLAGS/CPPFLAGS +LOCAL_C_INCLUDES_Release := \ $(LOCAL_PATH)/third_party/angle_dx11/src \ $(LOCAL_PATH)/third_party/angle_dx11/include \ $(PWD)/frameworks/wilhelm/include \ $(PWD)/bionic \ $(PWD)/external/stlport/stlport -LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES) # Flags passed to only C++ (and not C) files. -LOCAL_CPPFLAGS := \ +LOCAL_CPPFLAGS_Release := \ -fno-rtti \ -fno-threadsafe-statics \ -fvisibility-inlines-hidden \ @@ -147,9 +227,13 @@ LOCAL_CPPFLAGS := \ -Wno-sign-promo \ -Wno-non-virtual-dtor + +LOCAL_CFLAGS := $(MY_CFLAGS_$(GYP_CONFIGURATION)) $(MY_DEFS_$(GYP_CONFIGURATION)) +LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES_$(GYP_CONFIGURATION)) +LOCAL_CPPFLAGS := $(LOCAL_CPPFLAGS_$(GYP_CONFIGURATION)) ### Rules for final target. -LOCAL_LDFLAGS := \ +LOCAL_LDFLAGS_Debug := \ -Wl,-z,now \ -Wl,-z,relro \ -Wl,-z,noexecstack \ @@ -164,6 +248,23 @@ LOCAL_LDFLAGS := \ -Wl,--as-needed +LOCAL_LDFLAGS_Release := \ + -Wl,-z,now \ + -Wl,-z,relro \ + -Wl,-z,noexecstack \ + -fPIC \ + -EL \ + -Wl,--no-keep-memory \ + -nostdlib \ + -Wl,--no-undefined \ + -Wl,--exclude-libs=ALL \ + -Wl,-O1 \ + -Wl,--as-needed \ + -Wl,--gc-sections + + +LOCAL_LDFLAGS := $(LOCAL_LDFLAGS_$(GYP_CONFIGURATION)) + LOCAL_STATIC_LIBRARIES := # Enable grouping to fix circular references diff --git a/src/translator_common.target.darwin-x86.mk b/src/translator_common.target.darwin-x86.mk index d8587940..65fe19c8 100644 --- a/src/translator_common.target.darwin-x86.mk +++ b/src/translator_common.target.darwin-x86.mk @@ -61,7 +61,7 @@ LOCAL_SRC_FILES := \ # Flags passed to both C and C++ files. -MY_CFLAGS := \ +MY_CFLAGS_Debug := \ --param=ssp-buffer-size=4 \ -fno-exceptions \ -fno-strict-aliasing \ @@ -98,9 +98,7 @@ MY_CFLAGS := \ -fdata-sections \ -ffunction-sections -MY_CFLAGS_C := - -MY_DEFS := \ +MY_DEFS_Debug := \ '-DANGLE_DX11' \ '-DANGLE_DISABLE_TRACE' \ '-DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1' \ @@ -126,20 +124,18 @@ MY_DEFS := \ '-DWTF_USE_DYNAMIC_ANNOTATIONS=1' \ '-D_DEBUG' -LOCAL_CFLAGS := $(MY_CFLAGS_C) $(MY_CFLAGS) $(MY_DEFS) # Include paths placed before CFLAGS/CPPFLAGS -LOCAL_C_INCLUDES := \ +LOCAL_C_INCLUDES_Debug := \ $(LOCAL_PATH)/third_party/angle_dx11/src \ $(LOCAL_PATH)/third_party/angle_dx11/include \ $(PWD)/frameworks/wilhelm/include \ $(PWD)/bionic \ $(PWD)/external/stlport/stlport -LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES) # Flags passed to only C++ (and not C) files. -LOCAL_CPPFLAGS := \ +LOCAL_CPPFLAGS_Debug := \ -fno-rtti \ -fno-threadsafe-statics \ -fvisibility-inlines-hidden \ @@ -149,9 +145,101 @@ LOCAL_CPPFLAGS := \ -Wno-sign-promo \ -Wno-non-virtual-dtor + +# Flags passed to both C and C++ files. +MY_CFLAGS_Release := \ + --param=ssp-buffer-size=4 \ + -fno-exceptions \ + -fno-strict-aliasing \ + -Wno-unused-parameter \ + -Wno-missing-field-initializers \ + -fvisibility=hidden \ + -pipe \ + -fPIC \ + -Wno-format \ + -m32 \ + -mmmx \ + -march=pentium4 \ + -msse2 \ + -mfpmath=sse \ + -fuse-ld=gold \ + -ffunction-sections \ + -funwind-tables \ + -g \ + -fno-short-enums \ + -finline-limit=64 \ + -Wa,--noexecstack \ + -U_FORTIFY_SOURCE \ + -Wno-extra \ + -Wno-ignored-qualifiers \ + -Wno-type-limits \ + -Wno-address \ + -Wno-format-security \ + -Wno-return-type \ + -Wno-sequence-point \ + -fno-stack-protector \ + -Os \ + -fno-ident \ + -fdata-sections \ + -ffunction-sections \ + -fomit-frame-pointer \ + -fno-unwind-tables \ + -fno-asynchronous-unwind-tables + +MY_DEFS_Release := \ + '-DANGLE_DX11' \ + '-DANGLE_DISABLE_TRACE' \ + '-DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1' \ + '-DANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT("d3dcompiler_46.dll"), TEXT("d3dcompiler_43.dll") }' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DUSE_LINUX_BREAKPAD' \ + '-DNO_TCMALLOC' \ + '-DDISABLE_NACL' \ + '-DCHROMIUM_BUILD' \ + '-DUSE_LIBJPEG_TURBO=1' \ + '-DUSE_PROPRIETARY_CODECS' \ + '-DENABLE_GPU=1' \ + '-DUSE_OPENSSL=1' \ + '-DENABLE_EGLIMAGE=1' \ + '-DENABLE_LANGUAGE_DETECTION=1' \ + '-DCOMPILER_IMPLEMENTATION' \ + '-DANDROID' \ + '-D__GNU_SOURCE=1' \ + '-DUSE_STLPORT=1' \ + '-D_STLP_USE_PTR_SPECIALIZATIONS=1' \ + '-DCHROME_BUILD_ID=""' \ + '-DNDEBUG' \ + '-DNVALGRIND' \ + '-DDYNAMIC_ANNOTATIONS_ENABLED=0' + + +# Include paths placed before CFLAGS/CPPFLAGS +LOCAL_C_INCLUDES_Release := \ + $(LOCAL_PATH)/third_party/angle_dx11/src \ + $(LOCAL_PATH)/third_party/angle_dx11/include \ + $(PWD)/frameworks/wilhelm/include \ + $(PWD)/bionic \ + $(PWD)/external/stlport/stlport + + +# Flags passed to only C++ (and not C) files. +LOCAL_CPPFLAGS_Release := \ + -fno-rtti \ + -fno-threadsafe-statics \ + -fvisibility-inlines-hidden \ + -Wno-deprecated \ + -Wno-error=c++0x-compat \ + -Wno-non-virtual-dtor \ + -Wno-sign-promo \ + -Wno-non-virtual-dtor + + +LOCAL_CFLAGS := $(MY_CFLAGS_$(GYP_CONFIGURATION)) $(MY_DEFS_$(GYP_CONFIGURATION)) +LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES_$(GYP_CONFIGURATION)) +LOCAL_CPPFLAGS := $(LOCAL_CPPFLAGS_$(GYP_CONFIGURATION)) ### Rules for final target. -LOCAL_LDFLAGS := \ +LOCAL_LDFLAGS_Debug := \ -Wl,-z,now \ -Wl,-z,relro \ -Wl,-z,noexecstack \ @@ -166,6 +254,23 @@ LOCAL_LDFLAGS := \ -Wl,--as-needed +LOCAL_LDFLAGS_Release := \ + -Wl,-z,now \ + -Wl,-z,relro \ + -Wl,-z,noexecstack \ + -fPIC \ + -m32 \ + -fuse-ld=gold \ + -nostdlib \ + -Wl,--no-undefined \ + -Wl,--exclude-libs=ALL \ + -Wl,-O1 \ + -Wl,--as-needed \ + -Wl,--gc-sections + + +LOCAL_LDFLAGS := $(LOCAL_LDFLAGS_$(GYP_CONFIGURATION)) + LOCAL_STATIC_LIBRARIES := # Enable grouping to fix circular references diff --git a/src/translator_common.target.linux-arm.mk b/src/translator_common.target.linux-arm.mk index 9a811ebe..d9a16af6 100644 --- a/src/translator_common.target.linux-arm.mk +++ b/src/translator_common.target.linux-arm.mk @@ -61,7 +61,7 @@ LOCAL_SRC_FILES := \ # Flags passed to both C and C++ files. -MY_CFLAGS := \ +MY_CFLAGS_Debug := \ -fstack-protector \ --param=ssp-buffer-size=4 \ -fno-exceptions \ @@ -96,9 +96,7 @@ MY_CFLAGS := \ -fdata-sections \ -ffunction-sections -MY_CFLAGS_C := - -MY_DEFS := \ +MY_DEFS_Debug := \ '-DANGLE_DX11' \ '-DANGLE_DISABLE_TRACE' \ '-DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1' \ @@ -124,20 +122,18 @@ MY_DEFS := \ '-DWTF_USE_DYNAMIC_ANNOTATIONS=1' \ '-D_DEBUG' -LOCAL_CFLAGS := $(MY_CFLAGS_C) $(MY_CFLAGS) $(MY_DEFS) # Include paths placed before CFLAGS/CPPFLAGS -LOCAL_C_INCLUDES := \ +LOCAL_C_INCLUDES_Debug := \ $(LOCAL_PATH)/third_party/angle_dx11/src \ $(LOCAL_PATH)/third_party/angle_dx11/include \ $(PWD)/frameworks/wilhelm/include \ $(PWD)/bionic \ $(PWD)/external/stlport/stlport -LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES) # Flags passed to only C++ (and not C) files. -LOCAL_CPPFLAGS := \ +LOCAL_CPPFLAGS_Debug := \ -fno-rtti \ -fno-threadsafe-statics \ -fvisibility-inlines-hidden \ @@ -148,9 +144,98 @@ LOCAL_CPPFLAGS := \ -Wno-sign-promo \ -Wno-non-virtual-dtor + +# Flags passed to both C and C++ files. +MY_CFLAGS_Release := \ + -fstack-protector \ + --param=ssp-buffer-size=4 \ + -fno-exceptions \ + -fno-strict-aliasing \ + -Wno-unused-parameter \ + -Wno-missing-field-initializers \ + -fvisibility=hidden \ + -pipe \ + -fPIC \ + -Wno-format \ + -fno-tree-sra \ + -fuse-ld=gold \ + -Wno-psabi \ + -ffunction-sections \ + -funwind-tables \ + -g \ + -fstack-protector \ + -fno-short-enums \ + -finline-limit=64 \ + -Wa,--noexecstack \ + -U_FORTIFY_SOURCE \ + -Wno-extra \ + -Wno-ignored-qualifiers \ + -Wno-type-limits \ + -Wno-address \ + -Wno-format-security \ + -Wno-return-type \ + -Wno-sequence-point \ + -Os \ + -fno-ident \ + -fdata-sections \ + -ffunction-sections \ + -fomit-frame-pointer + +MY_DEFS_Release := \ + '-DANGLE_DX11' \ + '-DANGLE_DISABLE_TRACE' \ + '-DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1' \ + '-DANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT("d3dcompiler_46.dll"), TEXT("d3dcompiler_43.dll") }' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DUSE_LINUX_BREAKPAD' \ + '-DNO_TCMALLOC' \ + '-DDISABLE_NACL' \ + '-DCHROMIUM_BUILD' \ + '-DUSE_LIBJPEG_TURBO=1' \ + '-DUSE_PROPRIETARY_CODECS' \ + '-DENABLE_GPU=1' \ + '-DUSE_OPENSSL=1' \ + '-DENABLE_EGLIMAGE=1' \ + '-DENABLE_LANGUAGE_DETECTION=1' \ + '-DCOMPILER_IMPLEMENTATION' \ + '-DANDROID' \ + '-D__GNU_SOURCE=1' \ + '-DUSE_STLPORT=1' \ + '-D_STLP_USE_PTR_SPECIALIZATIONS=1' \ + '-DCHROME_BUILD_ID=""' \ + '-DNDEBUG' \ + '-DNVALGRIND' \ + '-DDYNAMIC_ANNOTATIONS_ENABLED=0' + + +# Include paths placed before CFLAGS/CPPFLAGS +LOCAL_C_INCLUDES_Release := \ + $(LOCAL_PATH)/third_party/angle_dx11/src \ + $(LOCAL_PATH)/third_party/angle_dx11/include \ + $(PWD)/frameworks/wilhelm/include \ + $(PWD)/bionic \ + $(PWD)/external/stlport/stlport + + +# Flags passed to only C++ (and not C) files. +LOCAL_CPPFLAGS_Release := \ + -fno-rtti \ + -fno-threadsafe-statics \ + -fvisibility-inlines-hidden \ + -Wno-deprecated \ + -Wno-abi \ + -Wno-error=c++0x-compat \ + -Wno-non-virtual-dtor \ + -Wno-sign-promo \ + -Wno-non-virtual-dtor + + +LOCAL_CFLAGS := $(MY_CFLAGS_$(GYP_CONFIGURATION)) $(MY_DEFS_$(GYP_CONFIGURATION)) +LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES_$(GYP_CONFIGURATION)) +LOCAL_CPPFLAGS := $(LOCAL_CPPFLAGS_$(GYP_CONFIGURATION)) ### Rules for final target. -LOCAL_LDFLAGS := \ +LOCAL_LDFLAGS_Debug := \ -Wl,-z,now \ -Wl,-z,relro \ -Wl,-z,noexecstack \ @@ -167,6 +252,25 @@ LOCAL_LDFLAGS := \ -Wl,--as-needed +LOCAL_LDFLAGS_Release := \ + -Wl,-z,now \ + -Wl,-z,relro \ + -Wl,-z,noexecstack \ + -fPIC \ + -Wl,-z,relro \ + -Wl,-z,now \ + -fuse-ld=gold \ + -nostdlib \ + -Wl,--no-undefined \ + -Wl,--exclude-libs=ALL \ + -Wl,--icf=safe \ + -Wl,-O1 \ + -Wl,--as-needed \ + -Wl,--gc-sections + + +LOCAL_LDFLAGS := $(LOCAL_LDFLAGS_$(GYP_CONFIGURATION)) + LOCAL_STATIC_LIBRARIES := # Enable grouping to fix circular references diff --git a/src/translator_common.target.linux-mips.mk b/src/translator_common.target.linux-mips.mk index d1ea20f6..19445433 100644 --- a/src/translator_common.target.linux-mips.mk +++ b/src/translator_common.target.linux-mips.mk @@ -61,7 +61,7 @@ LOCAL_SRC_FILES := \ # Flags passed to both C and C++ files. -MY_CFLAGS := \ +MY_CFLAGS_Debug := \ -fstack-protector \ --param=ssp-buffer-size=4 \ \ @@ -96,9 +96,7 @@ MY_CFLAGS := \ -fdata-sections \ -ffunction-sections -MY_CFLAGS_C := - -MY_DEFS := \ +MY_DEFS_Debug := \ '-DANGLE_DX11' \ '-DANGLE_DISABLE_TRACE' \ '-DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1' \ @@ -123,20 +121,102 @@ MY_DEFS := \ '-DWTF_USE_DYNAMIC_ANNOTATIONS=1' \ '-D_DEBUG' -LOCAL_CFLAGS := $(MY_CFLAGS_C) $(MY_CFLAGS) $(MY_DEFS) # Include paths placed before CFLAGS/CPPFLAGS -LOCAL_C_INCLUDES := \ +LOCAL_C_INCLUDES_Debug := \ + $(LOCAL_PATH)/third_party/angle_dx11/src \ + $(LOCAL_PATH)/third_party/angle_dx11/include \ + $(PWD)/frameworks/wilhelm/include \ + $(PWD)/bionic \ + $(PWD)/external/stlport/stlport + + +# Flags passed to only C++ (and not C) files. +LOCAL_CPPFLAGS_Debug := \ + -fno-rtti \ + -fno-threadsafe-statics \ + -fvisibility-inlines-hidden \ + -Wno-deprecated \ + -Wno-uninitialized \ + -Wno-error=c++0x-compat \ + -Wno-non-virtual-dtor \ + -Wno-sign-promo \ + -Wno-non-virtual-dtor + + +# Flags passed to both C and C++ files. +MY_CFLAGS_Release := \ + -fstack-protector \ + --param=ssp-buffer-size=4 \ + \ + -fno-exceptions \ + -fno-strict-aliasing \ + -Wno-unused-parameter \ + -Wno-missing-field-initializers \ + -fvisibility=hidden \ + -pipe \ + -fPIC \ + -Wno-format \ + -EL \ + -mhard-float \ + -ffunction-sections \ + -funwind-tables \ + -g \ + -fstack-protector \ + -fno-short-enums \ + -finline-limit=64 \ + -Wa,--noexecstack \ + -U_FORTIFY_SOURCE \ + -Wno-extra \ + -Wno-ignored-qualifiers \ + -Wno-type-limits \ + -Wno-address \ + -Wno-format-security \ + -Wno-return-type \ + -Wno-sequence-point \ + -Os \ + -fno-ident \ + -fdata-sections \ + -ffunction-sections \ + -fomit-frame-pointer + +MY_DEFS_Release := \ + '-DANGLE_DX11' \ + '-DANGLE_DISABLE_TRACE' \ + '-DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1' \ + '-DANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT("d3dcompiler_46.dll"), TEXT("d3dcompiler_43.dll") }' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DNO_TCMALLOC' \ + '-DDISABLE_NACL' \ + '-DCHROMIUM_BUILD' \ + '-DUSE_LIBJPEG_TURBO=1' \ + '-DUSE_PROPRIETARY_CODECS' \ + '-DENABLE_GPU=1' \ + '-DUSE_OPENSSL=1' \ + '-DENABLE_EGLIMAGE=1' \ + '-DENABLE_LANGUAGE_DETECTION=1' \ + '-DCOMPILER_IMPLEMENTATION' \ + '-DANDROID' \ + '-D__GNU_SOURCE=1' \ + '-DUSE_STLPORT=1' \ + '-D_STLP_USE_PTR_SPECIALIZATIONS=1' \ + '-DCHROME_BUILD_ID=""' \ + '-DNDEBUG' \ + '-DNVALGRIND' \ + '-DDYNAMIC_ANNOTATIONS_ENABLED=0' + + +# Include paths placed before CFLAGS/CPPFLAGS +LOCAL_C_INCLUDES_Release := \ $(LOCAL_PATH)/third_party/angle_dx11/src \ $(LOCAL_PATH)/third_party/angle_dx11/include \ $(PWD)/frameworks/wilhelm/include \ $(PWD)/bionic \ $(PWD)/external/stlport/stlport -LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES) # Flags passed to only C++ (and not C) files. -LOCAL_CPPFLAGS := \ +LOCAL_CPPFLAGS_Release := \ -fno-rtti \ -fno-threadsafe-statics \ -fvisibility-inlines-hidden \ @@ -147,9 +227,13 @@ LOCAL_CPPFLAGS := \ -Wno-sign-promo \ -Wno-non-virtual-dtor + +LOCAL_CFLAGS := $(MY_CFLAGS_$(GYP_CONFIGURATION)) $(MY_DEFS_$(GYP_CONFIGURATION)) +LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES_$(GYP_CONFIGURATION)) +LOCAL_CPPFLAGS := $(LOCAL_CPPFLAGS_$(GYP_CONFIGURATION)) ### Rules for final target. -LOCAL_LDFLAGS := \ +LOCAL_LDFLAGS_Debug := \ -Wl,-z,now \ -Wl,-z,relro \ -Wl,-z,noexecstack \ @@ -164,6 +248,23 @@ LOCAL_LDFLAGS := \ -Wl,--as-needed +LOCAL_LDFLAGS_Release := \ + -Wl,-z,now \ + -Wl,-z,relro \ + -Wl,-z,noexecstack \ + -fPIC \ + -EL \ + -Wl,--no-keep-memory \ + -nostdlib \ + -Wl,--no-undefined \ + -Wl,--exclude-libs=ALL \ + -Wl,-O1 \ + -Wl,--as-needed \ + -Wl,--gc-sections + + +LOCAL_LDFLAGS := $(LOCAL_LDFLAGS_$(GYP_CONFIGURATION)) + LOCAL_STATIC_LIBRARIES := # Enable grouping to fix circular references diff --git a/src/translator_common.target.linux-x86.mk b/src/translator_common.target.linux-x86.mk index d8587940..65fe19c8 100644 --- a/src/translator_common.target.linux-x86.mk +++ b/src/translator_common.target.linux-x86.mk @@ -61,7 +61,7 @@ LOCAL_SRC_FILES := \ # Flags passed to both C and C++ files. -MY_CFLAGS := \ +MY_CFLAGS_Debug := \ --param=ssp-buffer-size=4 \ -fno-exceptions \ -fno-strict-aliasing \ @@ -98,9 +98,7 @@ MY_CFLAGS := \ -fdata-sections \ -ffunction-sections -MY_CFLAGS_C := - -MY_DEFS := \ +MY_DEFS_Debug := \ '-DANGLE_DX11' \ '-DANGLE_DISABLE_TRACE' \ '-DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1' \ @@ -126,20 +124,18 @@ MY_DEFS := \ '-DWTF_USE_DYNAMIC_ANNOTATIONS=1' \ '-D_DEBUG' -LOCAL_CFLAGS := $(MY_CFLAGS_C) $(MY_CFLAGS) $(MY_DEFS) # Include paths placed before CFLAGS/CPPFLAGS -LOCAL_C_INCLUDES := \ +LOCAL_C_INCLUDES_Debug := \ $(LOCAL_PATH)/third_party/angle_dx11/src \ $(LOCAL_PATH)/third_party/angle_dx11/include \ $(PWD)/frameworks/wilhelm/include \ $(PWD)/bionic \ $(PWD)/external/stlport/stlport -LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES) # Flags passed to only C++ (and not C) files. -LOCAL_CPPFLAGS := \ +LOCAL_CPPFLAGS_Debug := \ -fno-rtti \ -fno-threadsafe-statics \ -fvisibility-inlines-hidden \ @@ -149,9 +145,101 @@ LOCAL_CPPFLAGS := \ -Wno-sign-promo \ -Wno-non-virtual-dtor + +# Flags passed to both C and C++ files. +MY_CFLAGS_Release := \ + --param=ssp-buffer-size=4 \ + -fno-exceptions \ + -fno-strict-aliasing \ + -Wno-unused-parameter \ + -Wno-missing-field-initializers \ + -fvisibility=hidden \ + -pipe \ + -fPIC \ + -Wno-format \ + -m32 \ + -mmmx \ + -march=pentium4 \ + -msse2 \ + -mfpmath=sse \ + -fuse-ld=gold \ + -ffunction-sections \ + -funwind-tables \ + -g \ + -fno-short-enums \ + -finline-limit=64 \ + -Wa,--noexecstack \ + -U_FORTIFY_SOURCE \ + -Wno-extra \ + -Wno-ignored-qualifiers \ + -Wno-type-limits \ + -Wno-address \ + -Wno-format-security \ + -Wno-return-type \ + -Wno-sequence-point \ + -fno-stack-protector \ + -Os \ + -fno-ident \ + -fdata-sections \ + -ffunction-sections \ + -fomit-frame-pointer \ + -fno-unwind-tables \ + -fno-asynchronous-unwind-tables + +MY_DEFS_Release := \ + '-DANGLE_DX11' \ + '-DANGLE_DISABLE_TRACE' \ + '-DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1' \ + '-DANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT("d3dcompiler_46.dll"), TEXT("d3dcompiler_43.dll") }' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DUSE_LINUX_BREAKPAD' \ + '-DNO_TCMALLOC' \ + '-DDISABLE_NACL' \ + '-DCHROMIUM_BUILD' \ + '-DUSE_LIBJPEG_TURBO=1' \ + '-DUSE_PROPRIETARY_CODECS' \ + '-DENABLE_GPU=1' \ + '-DUSE_OPENSSL=1' \ + '-DENABLE_EGLIMAGE=1' \ + '-DENABLE_LANGUAGE_DETECTION=1' \ + '-DCOMPILER_IMPLEMENTATION' \ + '-DANDROID' \ + '-D__GNU_SOURCE=1' \ + '-DUSE_STLPORT=1' \ + '-D_STLP_USE_PTR_SPECIALIZATIONS=1' \ + '-DCHROME_BUILD_ID=""' \ + '-DNDEBUG' \ + '-DNVALGRIND' \ + '-DDYNAMIC_ANNOTATIONS_ENABLED=0' + + +# Include paths placed before CFLAGS/CPPFLAGS +LOCAL_C_INCLUDES_Release := \ + $(LOCAL_PATH)/third_party/angle_dx11/src \ + $(LOCAL_PATH)/third_party/angle_dx11/include \ + $(PWD)/frameworks/wilhelm/include \ + $(PWD)/bionic \ + $(PWD)/external/stlport/stlport + + +# Flags passed to only C++ (and not C) files. +LOCAL_CPPFLAGS_Release := \ + -fno-rtti \ + -fno-threadsafe-statics \ + -fvisibility-inlines-hidden \ + -Wno-deprecated \ + -Wno-error=c++0x-compat \ + -Wno-non-virtual-dtor \ + -Wno-sign-promo \ + -Wno-non-virtual-dtor + + +LOCAL_CFLAGS := $(MY_CFLAGS_$(GYP_CONFIGURATION)) $(MY_DEFS_$(GYP_CONFIGURATION)) +LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES_$(GYP_CONFIGURATION)) +LOCAL_CPPFLAGS := $(LOCAL_CPPFLAGS_$(GYP_CONFIGURATION)) ### Rules for final target. -LOCAL_LDFLAGS := \ +LOCAL_LDFLAGS_Debug := \ -Wl,-z,now \ -Wl,-z,relro \ -Wl,-z,noexecstack \ @@ -166,6 +254,23 @@ LOCAL_LDFLAGS := \ -Wl,--as-needed +LOCAL_LDFLAGS_Release := \ + -Wl,-z,now \ + -Wl,-z,relro \ + -Wl,-z,noexecstack \ + -fPIC \ + -m32 \ + -fuse-ld=gold \ + -nostdlib \ + -Wl,--no-undefined \ + -Wl,--exclude-libs=ALL \ + -Wl,-O1 \ + -Wl,--as-needed \ + -Wl,--gc-sections + + +LOCAL_LDFLAGS := $(LOCAL_LDFLAGS_$(GYP_CONFIGURATION)) + LOCAL_STATIC_LIBRARIES := # Enable grouping to fix circular references diff --git a/src/translator_glsl.target.darwin-arm.mk b/src/translator_glsl.target.darwin-arm.mk index b759e3bc..b8b08042 100644 --- a/src/translator_glsl.target.darwin-arm.mk +++ b/src/translator_glsl.target.darwin-arm.mk @@ -33,7 +33,7 @@ LOCAL_SRC_FILES := \ # Flags passed to both C and C++ files. -MY_CFLAGS := \ +MY_CFLAGS_Debug := \ -fstack-protector \ --param=ssp-buffer-size=4 \ -fno-exceptions \ @@ -68,9 +68,7 @@ MY_CFLAGS := \ -fdata-sections \ -ffunction-sections -MY_CFLAGS_C := - -MY_DEFS := \ +MY_DEFS_Debug := \ '-DANGLE_DX11' \ '-DANGLE_DISABLE_TRACE' \ '-DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1' \ @@ -96,20 +94,18 @@ MY_DEFS := \ '-DWTF_USE_DYNAMIC_ANNOTATIONS=1' \ '-D_DEBUG' -LOCAL_CFLAGS := $(MY_CFLAGS_C) $(MY_CFLAGS) $(MY_DEFS) # Include paths placed before CFLAGS/CPPFLAGS -LOCAL_C_INCLUDES := \ +LOCAL_C_INCLUDES_Debug := \ $(LOCAL_PATH)/third_party/angle_dx11/src \ $(LOCAL_PATH)/third_party/angle_dx11/include \ $(PWD)/frameworks/wilhelm/include \ $(PWD)/bionic \ $(PWD)/external/stlport/stlport -LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES) # Flags passed to only C++ (and not C) files. -LOCAL_CPPFLAGS := \ +LOCAL_CPPFLAGS_Debug := \ -fno-rtti \ -fno-threadsafe-statics \ -fvisibility-inlines-hidden \ @@ -120,9 +116,98 @@ LOCAL_CPPFLAGS := \ -Wno-sign-promo \ -Wno-non-virtual-dtor + +# Flags passed to both C and C++ files. +MY_CFLAGS_Release := \ + -fstack-protector \ + --param=ssp-buffer-size=4 \ + -fno-exceptions \ + -fno-strict-aliasing \ + -Wno-unused-parameter \ + -Wno-missing-field-initializers \ + -fvisibility=hidden \ + -pipe \ + -fPIC \ + -Wno-format \ + -fno-tree-sra \ + -fuse-ld=gold \ + -Wno-psabi \ + -ffunction-sections \ + -funwind-tables \ + -g \ + -fstack-protector \ + -fno-short-enums \ + -finline-limit=64 \ + -Wa,--noexecstack \ + -U_FORTIFY_SOURCE \ + -Wno-extra \ + -Wno-ignored-qualifiers \ + -Wno-type-limits \ + -Wno-address \ + -Wno-format-security \ + -Wno-return-type \ + -Wno-sequence-point \ + -Os \ + -fno-ident \ + -fdata-sections \ + -ffunction-sections \ + -fomit-frame-pointer + +MY_DEFS_Release := \ + '-DANGLE_DX11' \ + '-DANGLE_DISABLE_TRACE' \ + '-DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1' \ + '-DANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT("d3dcompiler_46.dll"), TEXT("d3dcompiler_43.dll") }' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DUSE_LINUX_BREAKPAD' \ + '-DNO_TCMALLOC' \ + '-DDISABLE_NACL' \ + '-DCHROMIUM_BUILD' \ + '-DUSE_LIBJPEG_TURBO=1' \ + '-DUSE_PROPRIETARY_CODECS' \ + '-DENABLE_GPU=1' \ + '-DUSE_OPENSSL=1' \ + '-DENABLE_EGLIMAGE=1' \ + '-DENABLE_LANGUAGE_DETECTION=1' \ + '-DCOMPILER_IMPLEMENTATION' \ + '-DANDROID' \ + '-D__GNU_SOURCE=1' \ + '-DUSE_STLPORT=1' \ + '-D_STLP_USE_PTR_SPECIALIZATIONS=1' \ + '-DCHROME_BUILD_ID=""' \ + '-DNDEBUG' \ + '-DNVALGRIND' \ + '-DDYNAMIC_ANNOTATIONS_ENABLED=0' + + +# Include paths placed before CFLAGS/CPPFLAGS +LOCAL_C_INCLUDES_Release := \ + $(LOCAL_PATH)/third_party/angle_dx11/src \ + $(LOCAL_PATH)/third_party/angle_dx11/include \ + $(PWD)/frameworks/wilhelm/include \ + $(PWD)/bionic \ + $(PWD)/external/stlport/stlport + + +# Flags passed to only C++ (and not C) files. +LOCAL_CPPFLAGS_Release := \ + -fno-rtti \ + -fno-threadsafe-statics \ + -fvisibility-inlines-hidden \ + -Wno-deprecated \ + -Wno-abi \ + -Wno-error=c++0x-compat \ + -Wno-non-virtual-dtor \ + -Wno-sign-promo \ + -Wno-non-virtual-dtor + + +LOCAL_CFLAGS := $(MY_CFLAGS_$(GYP_CONFIGURATION)) $(MY_DEFS_$(GYP_CONFIGURATION)) +LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES_$(GYP_CONFIGURATION)) +LOCAL_CPPFLAGS := $(LOCAL_CPPFLAGS_$(GYP_CONFIGURATION)) ### Rules for final target. -LOCAL_LDFLAGS := \ +LOCAL_LDFLAGS_Debug := \ -Wl,-z,now \ -Wl,-z,relro \ -Wl,-z,noexecstack \ @@ -139,6 +224,25 @@ LOCAL_LDFLAGS := \ -Wl,--as-needed +LOCAL_LDFLAGS_Release := \ + -Wl,-z,now \ + -Wl,-z,relro \ + -Wl,-z,noexecstack \ + -fPIC \ + -Wl,-z,relro \ + -Wl,-z,now \ + -fuse-ld=gold \ + -nostdlib \ + -Wl,--no-undefined \ + -Wl,--exclude-libs=ALL \ + -Wl,--icf=safe \ + -Wl,-O1 \ + -Wl,--as-needed \ + -Wl,--gc-sections + + +LOCAL_LDFLAGS := $(LOCAL_LDFLAGS_$(GYP_CONFIGURATION)) + LOCAL_STATIC_LIBRARIES := # Enable grouping to fix circular references diff --git a/src/translator_glsl.target.darwin-mips.mk b/src/translator_glsl.target.darwin-mips.mk index 1d68b45c..3c3797d6 100644 --- a/src/translator_glsl.target.darwin-mips.mk +++ b/src/translator_glsl.target.darwin-mips.mk @@ -33,7 +33,7 @@ LOCAL_SRC_FILES := \ # Flags passed to both C and C++ files. -MY_CFLAGS := \ +MY_CFLAGS_Debug := \ -fstack-protector \ --param=ssp-buffer-size=4 \ \ @@ -68,9 +68,7 @@ MY_CFLAGS := \ -fdata-sections \ -ffunction-sections -MY_CFLAGS_C := - -MY_DEFS := \ +MY_DEFS_Debug := \ '-DANGLE_DX11' \ '-DANGLE_DISABLE_TRACE' \ '-DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1' \ @@ -95,20 +93,102 @@ MY_DEFS := \ '-DWTF_USE_DYNAMIC_ANNOTATIONS=1' \ '-D_DEBUG' -LOCAL_CFLAGS := $(MY_CFLAGS_C) $(MY_CFLAGS) $(MY_DEFS) # Include paths placed before CFLAGS/CPPFLAGS -LOCAL_C_INCLUDES := \ +LOCAL_C_INCLUDES_Debug := \ + $(LOCAL_PATH)/third_party/angle_dx11/src \ + $(LOCAL_PATH)/third_party/angle_dx11/include \ + $(PWD)/frameworks/wilhelm/include \ + $(PWD)/bionic \ + $(PWD)/external/stlport/stlport + + +# Flags passed to only C++ (and not C) files. +LOCAL_CPPFLAGS_Debug := \ + -fno-rtti \ + -fno-threadsafe-statics \ + -fvisibility-inlines-hidden \ + -Wno-deprecated \ + -Wno-uninitialized \ + -Wno-error=c++0x-compat \ + -Wno-non-virtual-dtor \ + -Wno-sign-promo \ + -Wno-non-virtual-dtor + + +# Flags passed to both C and C++ files. +MY_CFLAGS_Release := \ + -fstack-protector \ + --param=ssp-buffer-size=4 \ + \ + -fno-exceptions \ + -fno-strict-aliasing \ + -Wno-unused-parameter \ + -Wno-missing-field-initializers \ + -fvisibility=hidden \ + -pipe \ + -fPIC \ + -Wno-format \ + -EL \ + -mhard-float \ + -ffunction-sections \ + -funwind-tables \ + -g \ + -fstack-protector \ + -fno-short-enums \ + -finline-limit=64 \ + -Wa,--noexecstack \ + -U_FORTIFY_SOURCE \ + -Wno-extra \ + -Wno-ignored-qualifiers \ + -Wno-type-limits \ + -Wno-address \ + -Wno-format-security \ + -Wno-return-type \ + -Wno-sequence-point \ + -Os \ + -fno-ident \ + -fdata-sections \ + -ffunction-sections \ + -fomit-frame-pointer + +MY_DEFS_Release := \ + '-DANGLE_DX11' \ + '-DANGLE_DISABLE_TRACE' \ + '-DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1' \ + '-DANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT("d3dcompiler_46.dll"), TEXT("d3dcompiler_43.dll") }' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DNO_TCMALLOC' \ + '-DDISABLE_NACL' \ + '-DCHROMIUM_BUILD' \ + '-DUSE_LIBJPEG_TURBO=1' \ + '-DUSE_PROPRIETARY_CODECS' \ + '-DENABLE_GPU=1' \ + '-DUSE_OPENSSL=1' \ + '-DENABLE_EGLIMAGE=1' \ + '-DENABLE_LANGUAGE_DETECTION=1' \ + '-DCOMPILER_IMPLEMENTATION' \ + '-DANDROID' \ + '-D__GNU_SOURCE=1' \ + '-DUSE_STLPORT=1' \ + '-D_STLP_USE_PTR_SPECIALIZATIONS=1' \ + '-DCHROME_BUILD_ID=""' \ + '-DNDEBUG' \ + '-DNVALGRIND' \ + '-DDYNAMIC_ANNOTATIONS_ENABLED=0' + + +# Include paths placed before CFLAGS/CPPFLAGS +LOCAL_C_INCLUDES_Release := \ $(LOCAL_PATH)/third_party/angle_dx11/src \ $(LOCAL_PATH)/third_party/angle_dx11/include \ $(PWD)/frameworks/wilhelm/include \ $(PWD)/bionic \ $(PWD)/external/stlport/stlport -LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES) # Flags passed to only C++ (and not C) files. -LOCAL_CPPFLAGS := \ +LOCAL_CPPFLAGS_Release := \ -fno-rtti \ -fno-threadsafe-statics \ -fvisibility-inlines-hidden \ @@ -119,9 +199,13 @@ LOCAL_CPPFLAGS := \ -Wno-sign-promo \ -Wno-non-virtual-dtor + +LOCAL_CFLAGS := $(MY_CFLAGS_$(GYP_CONFIGURATION)) $(MY_DEFS_$(GYP_CONFIGURATION)) +LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES_$(GYP_CONFIGURATION)) +LOCAL_CPPFLAGS := $(LOCAL_CPPFLAGS_$(GYP_CONFIGURATION)) ### Rules for final target. -LOCAL_LDFLAGS := \ +LOCAL_LDFLAGS_Debug := \ -Wl,-z,now \ -Wl,-z,relro \ -Wl,-z,noexecstack \ @@ -136,6 +220,23 @@ LOCAL_LDFLAGS := \ -Wl,--as-needed +LOCAL_LDFLAGS_Release := \ + -Wl,-z,now \ + -Wl,-z,relro \ + -Wl,-z,noexecstack \ + -fPIC \ + -EL \ + -Wl,--no-keep-memory \ + -nostdlib \ + -Wl,--no-undefined \ + -Wl,--exclude-libs=ALL \ + -Wl,-O1 \ + -Wl,--as-needed \ + -Wl,--gc-sections + + +LOCAL_LDFLAGS := $(LOCAL_LDFLAGS_$(GYP_CONFIGURATION)) + LOCAL_STATIC_LIBRARIES := # Enable grouping to fix circular references diff --git a/src/translator_glsl.target.darwin-x86.mk b/src/translator_glsl.target.darwin-x86.mk index 587bc641..c24b2d65 100644 --- a/src/translator_glsl.target.darwin-x86.mk +++ b/src/translator_glsl.target.darwin-x86.mk @@ -33,7 +33,7 @@ LOCAL_SRC_FILES := \ # Flags passed to both C and C++ files. -MY_CFLAGS := \ +MY_CFLAGS_Debug := \ --param=ssp-buffer-size=4 \ -fno-exceptions \ -fno-strict-aliasing \ @@ -70,9 +70,7 @@ MY_CFLAGS := \ -fdata-sections \ -ffunction-sections -MY_CFLAGS_C := - -MY_DEFS := \ +MY_DEFS_Debug := \ '-DANGLE_DX11' \ '-DANGLE_DISABLE_TRACE' \ '-DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1' \ @@ -98,20 +96,18 @@ MY_DEFS := \ '-DWTF_USE_DYNAMIC_ANNOTATIONS=1' \ '-D_DEBUG' -LOCAL_CFLAGS := $(MY_CFLAGS_C) $(MY_CFLAGS) $(MY_DEFS) # Include paths placed before CFLAGS/CPPFLAGS -LOCAL_C_INCLUDES := \ +LOCAL_C_INCLUDES_Debug := \ $(LOCAL_PATH)/third_party/angle_dx11/src \ $(LOCAL_PATH)/third_party/angle_dx11/include \ $(PWD)/frameworks/wilhelm/include \ $(PWD)/bionic \ $(PWD)/external/stlport/stlport -LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES) # Flags passed to only C++ (and not C) files. -LOCAL_CPPFLAGS := \ +LOCAL_CPPFLAGS_Debug := \ -fno-rtti \ -fno-threadsafe-statics \ -fvisibility-inlines-hidden \ @@ -121,9 +117,101 @@ LOCAL_CPPFLAGS := \ -Wno-sign-promo \ -Wno-non-virtual-dtor + +# Flags passed to both C and C++ files. +MY_CFLAGS_Release := \ + --param=ssp-buffer-size=4 \ + -fno-exceptions \ + -fno-strict-aliasing \ + -Wno-unused-parameter \ + -Wno-missing-field-initializers \ + -fvisibility=hidden \ + -pipe \ + -fPIC \ + -Wno-format \ + -m32 \ + -mmmx \ + -march=pentium4 \ + -msse2 \ + -mfpmath=sse \ + -fuse-ld=gold \ + -ffunction-sections \ + -funwind-tables \ + -g \ + -fno-short-enums \ + -finline-limit=64 \ + -Wa,--noexecstack \ + -U_FORTIFY_SOURCE \ + -Wno-extra \ + -Wno-ignored-qualifiers \ + -Wno-type-limits \ + -Wno-address \ + -Wno-format-security \ + -Wno-return-type \ + -Wno-sequence-point \ + -fno-stack-protector \ + -Os \ + -fno-ident \ + -fdata-sections \ + -ffunction-sections \ + -fomit-frame-pointer \ + -fno-unwind-tables \ + -fno-asynchronous-unwind-tables + +MY_DEFS_Release := \ + '-DANGLE_DX11' \ + '-DANGLE_DISABLE_TRACE' \ + '-DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1' \ + '-DANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT("d3dcompiler_46.dll"), TEXT("d3dcompiler_43.dll") }' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DUSE_LINUX_BREAKPAD' \ + '-DNO_TCMALLOC' \ + '-DDISABLE_NACL' \ + '-DCHROMIUM_BUILD' \ + '-DUSE_LIBJPEG_TURBO=1' \ + '-DUSE_PROPRIETARY_CODECS' \ + '-DENABLE_GPU=1' \ + '-DUSE_OPENSSL=1' \ + '-DENABLE_EGLIMAGE=1' \ + '-DENABLE_LANGUAGE_DETECTION=1' \ + '-DCOMPILER_IMPLEMENTATION' \ + '-DANDROID' \ + '-D__GNU_SOURCE=1' \ + '-DUSE_STLPORT=1' \ + '-D_STLP_USE_PTR_SPECIALIZATIONS=1' \ + '-DCHROME_BUILD_ID=""' \ + '-DNDEBUG' \ + '-DNVALGRIND' \ + '-DDYNAMIC_ANNOTATIONS_ENABLED=0' + + +# Include paths placed before CFLAGS/CPPFLAGS +LOCAL_C_INCLUDES_Release := \ + $(LOCAL_PATH)/third_party/angle_dx11/src \ + $(LOCAL_PATH)/third_party/angle_dx11/include \ + $(PWD)/frameworks/wilhelm/include \ + $(PWD)/bionic \ + $(PWD)/external/stlport/stlport + + +# Flags passed to only C++ (and not C) files. +LOCAL_CPPFLAGS_Release := \ + -fno-rtti \ + -fno-threadsafe-statics \ + -fvisibility-inlines-hidden \ + -Wno-deprecated \ + -Wno-error=c++0x-compat \ + -Wno-non-virtual-dtor \ + -Wno-sign-promo \ + -Wno-non-virtual-dtor + + +LOCAL_CFLAGS := $(MY_CFLAGS_$(GYP_CONFIGURATION)) $(MY_DEFS_$(GYP_CONFIGURATION)) +LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES_$(GYP_CONFIGURATION)) +LOCAL_CPPFLAGS := $(LOCAL_CPPFLAGS_$(GYP_CONFIGURATION)) ### Rules for final target. -LOCAL_LDFLAGS := \ +LOCAL_LDFLAGS_Debug := \ -Wl,-z,now \ -Wl,-z,relro \ -Wl,-z,noexecstack \ @@ -138,6 +226,23 @@ LOCAL_LDFLAGS := \ -Wl,--as-needed +LOCAL_LDFLAGS_Release := \ + -Wl,-z,now \ + -Wl,-z,relro \ + -Wl,-z,noexecstack \ + -fPIC \ + -m32 \ + -fuse-ld=gold \ + -nostdlib \ + -Wl,--no-undefined \ + -Wl,--exclude-libs=ALL \ + -Wl,-O1 \ + -Wl,--as-needed \ + -Wl,--gc-sections + + +LOCAL_LDFLAGS := $(LOCAL_LDFLAGS_$(GYP_CONFIGURATION)) + LOCAL_STATIC_LIBRARIES := # Enable grouping to fix circular references diff --git a/src/translator_glsl.target.linux-arm.mk b/src/translator_glsl.target.linux-arm.mk index b759e3bc..b8b08042 100644 --- a/src/translator_glsl.target.linux-arm.mk +++ b/src/translator_glsl.target.linux-arm.mk @@ -33,7 +33,7 @@ LOCAL_SRC_FILES := \ # Flags passed to both C and C++ files. -MY_CFLAGS := \ +MY_CFLAGS_Debug := \ -fstack-protector \ --param=ssp-buffer-size=4 \ -fno-exceptions \ @@ -68,9 +68,7 @@ MY_CFLAGS := \ -fdata-sections \ -ffunction-sections -MY_CFLAGS_C := - -MY_DEFS := \ +MY_DEFS_Debug := \ '-DANGLE_DX11' \ '-DANGLE_DISABLE_TRACE' \ '-DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1' \ @@ -96,20 +94,18 @@ MY_DEFS := \ '-DWTF_USE_DYNAMIC_ANNOTATIONS=1' \ '-D_DEBUG' -LOCAL_CFLAGS := $(MY_CFLAGS_C) $(MY_CFLAGS) $(MY_DEFS) # Include paths placed before CFLAGS/CPPFLAGS -LOCAL_C_INCLUDES := \ +LOCAL_C_INCLUDES_Debug := \ $(LOCAL_PATH)/third_party/angle_dx11/src \ $(LOCAL_PATH)/third_party/angle_dx11/include \ $(PWD)/frameworks/wilhelm/include \ $(PWD)/bionic \ $(PWD)/external/stlport/stlport -LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES) # Flags passed to only C++ (and not C) files. -LOCAL_CPPFLAGS := \ +LOCAL_CPPFLAGS_Debug := \ -fno-rtti \ -fno-threadsafe-statics \ -fvisibility-inlines-hidden \ @@ -120,9 +116,98 @@ LOCAL_CPPFLAGS := \ -Wno-sign-promo \ -Wno-non-virtual-dtor + +# Flags passed to both C and C++ files. +MY_CFLAGS_Release := \ + -fstack-protector \ + --param=ssp-buffer-size=4 \ + -fno-exceptions \ + -fno-strict-aliasing \ + -Wno-unused-parameter \ + -Wno-missing-field-initializers \ + -fvisibility=hidden \ + -pipe \ + -fPIC \ + -Wno-format \ + -fno-tree-sra \ + -fuse-ld=gold \ + -Wno-psabi \ + -ffunction-sections \ + -funwind-tables \ + -g \ + -fstack-protector \ + -fno-short-enums \ + -finline-limit=64 \ + -Wa,--noexecstack \ + -U_FORTIFY_SOURCE \ + -Wno-extra \ + -Wno-ignored-qualifiers \ + -Wno-type-limits \ + -Wno-address \ + -Wno-format-security \ + -Wno-return-type \ + -Wno-sequence-point \ + -Os \ + -fno-ident \ + -fdata-sections \ + -ffunction-sections \ + -fomit-frame-pointer + +MY_DEFS_Release := \ + '-DANGLE_DX11' \ + '-DANGLE_DISABLE_TRACE' \ + '-DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1' \ + '-DANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT("d3dcompiler_46.dll"), TEXT("d3dcompiler_43.dll") }' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DUSE_LINUX_BREAKPAD' \ + '-DNO_TCMALLOC' \ + '-DDISABLE_NACL' \ + '-DCHROMIUM_BUILD' \ + '-DUSE_LIBJPEG_TURBO=1' \ + '-DUSE_PROPRIETARY_CODECS' \ + '-DENABLE_GPU=1' \ + '-DUSE_OPENSSL=1' \ + '-DENABLE_EGLIMAGE=1' \ + '-DENABLE_LANGUAGE_DETECTION=1' \ + '-DCOMPILER_IMPLEMENTATION' \ + '-DANDROID' \ + '-D__GNU_SOURCE=1' \ + '-DUSE_STLPORT=1' \ + '-D_STLP_USE_PTR_SPECIALIZATIONS=1' \ + '-DCHROME_BUILD_ID=""' \ + '-DNDEBUG' \ + '-DNVALGRIND' \ + '-DDYNAMIC_ANNOTATIONS_ENABLED=0' + + +# Include paths placed before CFLAGS/CPPFLAGS +LOCAL_C_INCLUDES_Release := \ + $(LOCAL_PATH)/third_party/angle_dx11/src \ + $(LOCAL_PATH)/third_party/angle_dx11/include \ + $(PWD)/frameworks/wilhelm/include \ + $(PWD)/bionic \ + $(PWD)/external/stlport/stlport + + +# Flags passed to only C++ (and not C) files. +LOCAL_CPPFLAGS_Release := \ + -fno-rtti \ + -fno-threadsafe-statics \ + -fvisibility-inlines-hidden \ + -Wno-deprecated \ + -Wno-abi \ + -Wno-error=c++0x-compat \ + -Wno-non-virtual-dtor \ + -Wno-sign-promo \ + -Wno-non-virtual-dtor + + +LOCAL_CFLAGS := $(MY_CFLAGS_$(GYP_CONFIGURATION)) $(MY_DEFS_$(GYP_CONFIGURATION)) +LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES_$(GYP_CONFIGURATION)) +LOCAL_CPPFLAGS := $(LOCAL_CPPFLAGS_$(GYP_CONFIGURATION)) ### Rules for final target. -LOCAL_LDFLAGS := \ +LOCAL_LDFLAGS_Debug := \ -Wl,-z,now \ -Wl,-z,relro \ -Wl,-z,noexecstack \ @@ -139,6 +224,25 @@ LOCAL_LDFLAGS := \ -Wl,--as-needed +LOCAL_LDFLAGS_Release := \ + -Wl,-z,now \ + -Wl,-z,relro \ + -Wl,-z,noexecstack \ + -fPIC \ + -Wl,-z,relro \ + -Wl,-z,now \ + -fuse-ld=gold \ + -nostdlib \ + -Wl,--no-undefined \ + -Wl,--exclude-libs=ALL \ + -Wl,--icf=safe \ + -Wl,-O1 \ + -Wl,--as-needed \ + -Wl,--gc-sections + + +LOCAL_LDFLAGS := $(LOCAL_LDFLAGS_$(GYP_CONFIGURATION)) + LOCAL_STATIC_LIBRARIES := # Enable grouping to fix circular references diff --git a/src/translator_glsl.target.linux-mips.mk b/src/translator_glsl.target.linux-mips.mk index 1d68b45c..3c3797d6 100644 --- a/src/translator_glsl.target.linux-mips.mk +++ b/src/translator_glsl.target.linux-mips.mk @@ -33,7 +33,7 @@ LOCAL_SRC_FILES := \ # Flags passed to both C and C++ files. -MY_CFLAGS := \ +MY_CFLAGS_Debug := \ -fstack-protector \ --param=ssp-buffer-size=4 \ \ @@ -68,9 +68,7 @@ MY_CFLAGS := \ -fdata-sections \ -ffunction-sections -MY_CFLAGS_C := - -MY_DEFS := \ +MY_DEFS_Debug := \ '-DANGLE_DX11' \ '-DANGLE_DISABLE_TRACE' \ '-DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1' \ @@ -95,20 +93,102 @@ MY_DEFS := \ '-DWTF_USE_DYNAMIC_ANNOTATIONS=1' \ '-D_DEBUG' -LOCAL_CFLAGS := $(MY_CFLAGS_C) $(MY_CFLAGS) $(MY_DEFS) # Include paths placed before CFLAGS/CPPFLAGS -LOCAL_C_INCLUDES := \ +LOCAL_C_INCLUDES_Debug := \ + $(LOCAL_PATH)/third_party/angle_dx11/src \ + $(LOCAL_PATH)/third_party/angle_dx11/include \ + $(PWD)/frameworks/wilhelm/include \ + $(PWD)/bionic \ + $(PWD)/external/stlport/stlport + + +# Flags passed to only C++ (and not C) files. +LOCAL_CPPFLAGS_Debug := \ + -fno-rtti \ + -fno-threadsafe-statics \ + -fvisibility-inlines-hidden \ + -Wno-deprecated \ + -Wno-uninitialized \ + -Wno-error=c++0x-compat \ + -Wno-non-virtual-dtor \ + -Wno-sign-promo \ + -Wno-non-virtual-dtor + + +# Flags passed to both C and C++ files. +MY_CFLAGS_Release := \ + -fstack-protector \ + --param=ssp-buffer-size=4 \ + \ + -fno-exceptions \ + -fno-strict-aliasing \ + -Wno-unused-parameter \ + -Wno-missing-field-initializers \ + -fvisibility=hidden \ + -pipe \ + -fPIC \ + -Wno-format \ + -EL \ + -mhard-float \ + -ffunction-sections \ + -funwind-tables \ + -g \ + -fstack-protector \ + -fno-short-enums \ + -finline-limit=64 \ + -Wa,--noexecstack \ + -U_FORTIFY_SOURCE \ + -Wno-extra \ + -Wno-ignored-qualifiers \ + -Wno-type-limits \ + -Wno-address \ + -Wno-format-security \ + -Wno-return-type \ + -Wno-sequence-point \ + -Os \ + -fno-ident \ + -fdata-sections \ + -ffunction-sections \ + -fomit-frame-pointer + +MY_DEFS_Release := \ + '-DANGLE_DX11' \ + '-DANGLE_DISABLE_TRACE' \ + '-DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1' \ + '-DANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT("d3dcompiler_46.dll"), TEXT("d3dcompiler_43.dll") }' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DNO_TCMALLOC' \ + '-DDISABLE_NACL' \ + '-DCHROMIUM_BUILD' \ + '-DUSE_LIBJPEG_TURBO=1' \ + '-DUSE_PROPRIETARY_CODECS' \ + '-DENABLE_GPU=1' \ + '-DUSE_OPENSSL=1' \ + '-DENABLE_EGLIMAGE=1' \ + '-DENABLE_LANGUAGE_DETECTION=1' \ + '-DCOMPILER_IMPLEMENTATION' \ + '-DANDROID' \ + '-D__GNU_SOURCE=1' \ + '-DUSE_STLPORT=1' \ + '-D_STLP_USE_PTR_SPECIALIZATIONS=1' \ + '-DCHROME_BUILD_ID=""' \ + '-DNDEBUG' \ + '-DNVALGRIND' \ + '-DDYNAMIC_ANNOTATIONS_ENABLED=0' + + +# Include paths placed before CFLAGS/CPPFLAGS +LOCAL_C_INCLUDES_Release := \ $(LOCAL_PATH)/third_party/angle_dx11/src \ $(LOCAL_PATH)/third_party/angle_dx11/include \ $(PWD)/frameworks/wilhelm/include \ $(PWD)/bionic \ $(PWD)/external/stlport/stlport -LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES) # Flags passed to only C++ (and not C) files. -LOCAL_CPPFLAGS := \ +LOCAL_CPPFLAGS_Release := \ -fno-rtti \ -fno-threadsafe-statics \ -fvisibility-inlines-hidden \ @@ -119,9 +199,13 @@ LOCAL_CPPFLAGS := \ -Wno-sign-promo \ -Wno-non-virtual-dtor + +LOCAL_CFLAGS := $(MY_CFLAGS_$(GYP_CONFIGURATION)) $(MY_DEFS_$(GYP_CONFIGURATION)) +LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES_$(GYP_CONFIGURATION)) +LOCAL_CPPFLAGS := $(LOCAL_CPPFLAGS_$(GYP_CONFIGURATION)) ### Rules for final target. -LOCAL_LDFLAGS := \ +LOCAL_LDFLAGS_Debug := \ -Wl,-z,now \ -Wl,-z,relro \ -Wl,-z,noexecstack \ @@ -136,6 +220,23 @@ LOCAL_LDFLAGS := \ -Wl,--as-needed +LOCAL_LDFLAGS_Release := \ + -Wl,-z,now \ + -Wl,-z,relro \ + -Wl,-z,noexecstack \ + -fPIC \ + -EL \ + -Wl,--no-keep-memory \ + -nostdlib \ + -Wl,--no-undefined \ + -Wl,--exclude-libs=ALL \ + -Wl,-O1 \ + -Wl,--as-needed \ + -Wl,--gc-sections + + +LOCAL_LDFLAGS := $(LOCAL_LDFLAGS_$(GYP_CONFIGURATION)) + LOCAL_STATIC_LIBRARIES := # Enable grouping to fix circular references diff --git a/src/translator_glsl.target.linux-x86.mk b/src/translator_glsl.target.linux-x86.mk index 587bc641..c24b2d65 100644 --- a/src/translator_glsl.target.linux-x86.mk +++ b/src/translator_glsl.target.linux-x86.mk @@ -33,7 +33,7 @@ LOCAL_SRC_FILES := \ # Flags passed to both C and C++ files. -MY_CFLAGS := \ +MY_CFLAGS_Debug := \ --param=ssp-buffer-size=4 \ -fno-exceptions \ -fno-strict-aliasing \ @@ -70,9 +70,7 @@ MY_CFLAGS := \ -fdata-sections \ -ffunction-sections -MY_CFLAGS_C := - -MY_DEFS := \ +MY_DEFS_Debug := \ '-DANGLE_DX11' \ '-DANGLE_DISABLE_TRACE' \ '-DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1' \ @@ -98,20 +96,18 @@ MY_DEFS := \ '-DWTF_USE_DYNAMIC_ANNOTATIONS=1' \ '-D_DEBUG' -LOCAL_CFLAGS := $(MY_CFLAGS_C) $(MY_CFLAGS) $(MY_DEFS) # Include paths placed before CFLAGS/CPPFLAGS -LOCAL_C_INCLUDES := \ +LOCAL_C_INCLUDES_Debug := \ $(LOCAL_PATH)/third_party/angle_dx11/src \ $(LOCAL_PATH)/third_party/angle_dx11/include \ $(PWD)/frameworks/wilhelm/include \ $(PWD)/bionic \ $(PWD)/external/stlport/stlport -LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES) # Flags passed to only C++ (and not C) files. -LOCAL_CPPFLAGS := \ +LOCAL_CPPFLAGS_Debug := \ -fno-rtti \ -fno-threadsafe-statics \ -fvisibility-inlines-hidden \ @@ -121,9 +117,101 @@ LOCAL_CPPFLAGS := \ -Wno-sign-promo \ -Wno-non-virtual-dtor + +# Flags passed to both C and C++ files. +MY_CFLAGS_Release := \ + --param=ssp-buffer-size=4 \ + -fno-exceptions \ + -fno-strict-aliasing \ + -Wno-unused-parameter \ + -Wno-missing-field-initializers \ + -fvisibility=hidden \ + -pipe \ + -fPIC \ + -Wno-format \ + -m32 \ + -mmmx \ + -march=pentium4 \ + -msse2 \ + -mfpmath=sse \ + -fuse-ld=gold \ + -ffunction-sections \ + -funwind-tables \ + -g \ + -fno-short-enums \ + -finline-limit=64 \ + -Wa,--noexecstack \ + -U_FORTIFY_SOURCE \ + -Wno-extra \ + -Wno-ignored-qualifiers \ + -Wno-type-limits \ + -Wno-address \ + -Wno-format-security \ + -Wno-return-type \ + -Wno-sequence-point \ + -fno-stack-protector \ + -Os \ + -fno-ident \ + -fdata-sections \ + -ffunction-sections \ + -fomit-frame-pointer \ + -fno-unwind-tables \ + -fno-asynchronous-unwind-tables + +MY_DEFS_Release := \ + '-DANGLE_DX11' \ + '-DANGLE_DISABLE_TRACE' \ + '-DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1' \ + '-DANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT("d3dcompiler_46.dll"), TEXT("d3dcompiler_43.dll") }' \ + '-D_FILE_OFFSET_BITS=64' \ + '-DUSE_LINUX_BREAKPAD' \ + '-DNO_TCMALLOC' \ + '-DDISABLE_NACL' \ + '-DCHROMIUM_BUILD' \ + '-DUSE_LIBJPEG_TURBO=1' \ + '-DUSE_PROPRIETARY_CODECS' \ + '-DENABLE_GPU=1' \ + '-DUSE_OPENSSL=1' \ + '-DENABLE_EGLIMAGE=1' \ + '-DENABLE_LANGUAGE_DETECTION=1' \ + '-DCOMPILER_IMPLEMENTATION' \ + '-DANDROID' \ + '-D__GNU_SOURCE=1' \ + '-DUSE_STLPORT=1' \ + '-D_STLP_USE_PTR_SPECIALIZATIONS=1' \ + '-DCHROME_BUILD_ID=""' \ + '-DNDEBUG' \ + '-DNVALGRIND' \ + '-DDYNAMIC_ANNOTATIONS_ENABLED=0' + + +# Include paths placed before CFLAGS/CPPFLAGS +LOCAL_C_INCLUDES_Release := \ + $(LOCAL_PATH)/third_party/angle_dx11/src \ + $(LOCAL_PATH)/third_party/angle_dx11/include \ + $(PWD)/frameworks/wilhelm/include \ + $(PWD)/bionic \ + $(PWD)/external/stlport/stlport + + +# Flags passed to only C++ (and not C) files. +LOCAL_CPPFLAGS_Release := \ + -fno-rtti \ + -fno-threadsafe-statics \ + -fvisibility-inlines-hidden \ + -Wno-deprecated \ + -Wno-error=c++0x-compat \ + -Wno-non-virtual-dtor \ + -Wno-sign-promo \ + -Wno-non-virtual-dtor + + +LOCAL_CFLAGS := $(MY_CFLAGS_$(GYP_CONFIGURATION)) $(MY_DEFS_$(GYP_CONFIGURATION)) +LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES_$(GYP_CONFIGURATION)) +LOCAL_CPPFLAGS := $(LOCAL_CPPFLAGS_$(GYP_CONFIGURATION)) ### Rules for final target. -LOCAL_LDFLAGS := \ +LOCAL_LDFLAGS_Debug := \ -Wl,-z,now \ -Wl,-z,relro \ -Wl,-z,noexecstack \ @@ -138,6 +226,23 @@ LOCAL_LDFLAGS := \ -Wl,--as-needed +LOCAL_LDFLAGS_Release := \ + -Wl,-z,now \ + -Wl,-z,relro \ + -Wl,-z,noexecstack \ + -fPIC \ + -m32 \ + -fuse-ld=gold \ + -nostdlib \ + -Wl,--no-undefined \ + -Wl,--exclude-libs=ALL \ + -Wl,-O1 \ + -Wl,--as-needed \ + -Wl,--gc-sections + + +LOCAL_LDFLAGS := $(LOCAL_LDFLAGS_$(GYP_CONFIGURATION)) + LOCAL_STATIC_LIBRARIES := # Enable grouping to fix circular references |