Commit 091540d3 by Brandon Jones

Changed feature macros to reduce accidental enabling/disabling

Change-Id: Ieb1a0c55f412f2a1bb858522b2dfaa7a60aa7ddb Reviewed-on: https://chromium-review.googlesource.com/226304Reviewed-by: 's avatarBrandon Jones <bajones@chromium.org> Tested-by: 's avatarBrandon Jones <bajones@chromium.org>
parent db9b40b0
...@@ -249,6 +249,7 @@ ...@@ -249,6 +249,7 @@
<ClInclude Include="..\..\src\common\blocklayout.h"/> <ClInclude Include="..\..\src\common\blocklayout.h"/>
<ClInclude Include="..\..\src\common\debug.h"/> <ClInclude Include="..\..\src\common\debug.h"/>
<ClInclude Include="..\..\src\common\event_tracer.h"/> <ClInclude Include="..\..\src\common\event_tracer.h"/>
<ClInclude Include="..\..\src\common\features.h"/>
<ClInclude Include="..\..\src\common\mathutil.h"/> <ClInclude Include="..\..\src\common\mathutil.h"/>
<ClInclude Include="..\..\src\common\platform.h"/> <ClInclude Include="..\..\src\common\platform.h"/>
<ClInclude Include="..\..\src\common\NativeWindow.h"/> <ClInclude Include="..\..\src\common\NativeWindow.h"/>
......
...@@ -193,6 +193,12 @@ ...@@ -193,6 +193,12 @@
<Filter Include="src"> <Filter Include="src">
<UniqueIdentifier>{8CDEE807-BC53-E450-C8B8-4DEBB66742D4}</UniqueIdentifier> <UniqueIdentifier>{8CDEE807-BC53-E450-C8B8-4DEBB66742D4}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="src\common">
<UniqueIdentifier>{2F5FD094-EF52-77F7-7AA8-4327A01BF747}</UniqueIdentifier>
</Filter>
<Filter Include="src">
<UniqueIdentifier>{8CDEE807-BC53-E450-C8B8-4DEBB66742D4}</UniqueIdentifier>
</Filter>
<Filter Include="src\libGLESv2"> <Filter Include="src\libGLESv2">
<UniqueIdentifier>{A62A9415-2E9D-A6D2-631D-1F25A5CD626F}</UniqueIdentifier> <UniqueIdentifier>{A62A9415-2E9D-A6D2-631D-1F25A5CD626F}</UniqueIdentifier>
</Filter> </Filter>
...@@ -3564,6 +3570,9 @@ ...@@ -3564,6 +3570,9 @@
<ClInclude Include="..\..\src\common\event_tracer.h"> <ClInclude Include="..\..\src\common\event_tracer.h">
<Filter>src\common</Filter> <Filter>src\common</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\common\features.h">
<Filter>src\common</Filter>
</ClInclude>
<ClCompile Include="..\..\src\common\mathutil.cpp"> <ClCompile Include="..\..\src\common\mathutil.cpp">
<Filter>src\common</Filter> <Filter>src\common</Filter>
</ClCompile> </ClCompile>
......
...@@ -362,6 +362,7 @@ ...@@ -362,6 +362,7 @@
<ClInclude Include="..\..\..\..\src\common\blocklayout.h"/> <ClInclude Include="..\..\..\..\src\common\blocklayout.h"/>
<ClInclude Include="..\..\..\..\src\common\debug.h"/> <ClInclude Include="..\..\..\..\src\common\debug.h"/>
<ClInclude Include="..\..\..\..\src\common\event_tracer.h"/> <ClInclude Include="..\..\..\..\src\common\event_tracer.h"/>
<ClInclude Include="..\..\..\..\src\common\features.h"/>
<ClInclude Include="..\..\..\..\src\common\mathutil.h"/> <ClInclude Include="..\..\..\..\src\common\mathutil.h"/>
<ClInclude Include="..\..\..\..\src\common\platform.h"/> <ClInclude Include="..\..\..\..\src\common\platform.h"/>
<ClInclude Include="..\..\..\..\src\common\NativeWindow.h"/> <ClInclude Include="..\..\..\..\src\common\NativeWindow.h"/>
......
...@@ -193,6 +193,12 @@ ...@@ -193,6 +193,12 @@
<Filter Include="src"> <Filter Include="src">
<UniqueIdentifier>{8CDEE807-BC53-E450-C8B8-4DEBB66742D4}</UniqueIdentifier> <UniqueIdentifier>{8CDEE807-BC53-E450-C8B8-4DEBB66742D4}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="src\common">
<UniqueIdentifier>{2F5FD094-EF52-77F7-7AA8-4327A01BF747}</UniqueIdentifier>
</Filter>
<Filter Include="src">
<UniqueIdentifier>{8CDEE807-BC53-E450-C8B8-4DEBB66742D4}</UniqueIdentifier>
</Filter>
<Filter Include="src\libGLESv2"> <Filter Include="src\libGLESv2">
<UniqueIdentifier>{A62A9415-2E9D-A6D2-631D-1F25A5CD626F}</UniqueIdentifier> <UniqueIdentifier>{A62A9415-2E9D-A6D2-631D-1F25A5CD626F}</UniqueIdentifier>
</Filter> </Filter>
...@@ -3021,6 +3027,9 @@ ...@@ -3021,6 +3027,9 @@
<ClInclude Include="..\..\..\..\src\common\event_tracer.h"> <ClInclude Include="..\..\..\..\src\common\event_tracer.h">
<Filter>src\common</Filter> <Filter>src\common</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\..\..\src\common\features.h">
<Filter>src\common</Filter>
</ClInclude>
<ClCompile Include="..\..\..\..\src\common\mathutil.cpp"> <ClCompile Include="..\..\..\..\src\common\mathutil.cpp">
<Filter>src\common</Filter> <Filter>src\common</Filter>
</ClCompile> </ClCompile>
......
//
// Copyright (c) 2014 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.
//
#define ANGLE_DISABLED 0
#define ANGLE_ENABLED 1
// Feature defaults
// Direct3D9EX
// The "Debug This Pixel..." feature in PIX often fails when using the
// D3D9Ex interfaces. In order to get debug pixel to work on a Vista/Win 7
// machine, define "ANGLE_D3D9EX=0" in your project file.
#if !defined(ANGLE_D3D9EX)
#define ANGLE_D3D9EX ANGLE_ENABLED
#endif
// Vsync
// ENABLED allows Vsync to be configured at runtime
// DISABLED disallows Vsync
#if !defined(ANGLE_VSYNC)
#define ANGLE_VSYNC ANGLE_ENABLED
#endif
// Program binary loading
#if !defined(ANGLE_PROGRAM_BINARY_LOAD)
#define ANGLE_PROGRAM_BINARY_LOAD ANGLE_ENABLED
#endif
// Shader debug info
#if !defined(ANGLE_SHADER_DEBUG_INFO)
#define ANGLE_SHADER_DEBUG_INFO ANGLE_DISABLED
#endif
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
'common/debug.h', 'common/debug.h',
'common/event_tracer.cpp', 'common/event_tracer.cpp',
'common/event_tracer.h', 'common/event_tracer.h',
'common/features.h',
'common/mathutil.cpp', 'common/mathutil.cpp',
'common/mathutil.h', 'common/mathutil.h',
'common/platform.h', 'common/platform.h',
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "libGLESv2/Context.h" #include "libGLESv2/Context.h"
#include "libGLESv2/Buffer.h" #include "libGLESv2/Buffer.h"
#include "common/blocklayout.h" #include "common/blocklayout.h"
#include "common/features.h"
namespace gl namespace gl
{ {
...@@ -362,7 +363,7 @@ bool ProgramBinary::linkVaryings(InfoLog &infoLog, Shader *fragmentShader, Shade ...@@ -362,7 +363,7 @@ bool ProgramBinary::linkVaryings(InfoLog &infoLog, Shader *fragmentShader, Shade
LinkResult ProgramBinary::load(InfoLog &infoLog, GLenum binaryFormat, const void *binary, GLsizei length) LinkResult ProgramBinary::load(InfoLog &infoLog, GLenum binaryFormat, const void *binary, GLsizei length)
{ {
#ifdef ANGLE_DISABLE_PROGRAM_BINARY_LOAD #if ANGLE_PROGRAM_BINARY_LOAD == ANGLE_ENABLED
return LinkResult(false, Error(GL_NO_ERROR)); return LinkResult(false, Error(GL_NO_ERROR));
#else #else
ASSERT(binaryFormat == mProgram->getBinaryFormat()); ASSERT(binaryFormat == mProgram->getBinaryFormat());
...@@ -419,7 +420,7 @@ LinkResult ProgramBinary::load(InfoLog &infoLog, GLenum binaryFormat, const void ...@@ -419,7 +420,7 @@ LinkResult ProgramBinary::load(InfoLog &infoLog, GLenum binaryFormat, const void
} }
return LinkResult(true, Error(GL_NO_ERROR)); return LinkResult(true, Error(GL_NO_ERROR));
#endif // #ifdef ANGLE_DISABLE_PROGRAM_BINARY_LOAD #endif // #if ANGLE_PROGRAM_BINARY_LOAD == ANGLE_ENABLED
} }
Error ProgramBinary::save(GLenum *binaryFormat, void *binary, GLsizei bufSize, GLsizei *length) Error ProgramBinary::save(GLenum *binaryFormat, void *binary, GLsizei bufSize, GLsizei *length)
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "libGLESv2/Program.h" #include "libGLESv2/Program.h"
#include "libGLESv2/main.h" #include "libGLESv2/main.h"
#include "common/features.h"
#include "common/utilities.h" #include "common/utilities.h"
#include "third_party/trace_event/trace_event.h" #include "third_party/trace_event/trace_event.h"
...@@ -225,7 +226,7 @@ gl::Error HLSLCompiler::compileToBinary(gl::InfoLog &infoLog, const std::string ...@@ -225,7 +226,7 @@ gl::Error HLSLCompiler::compileToBinary(gl::InfoLog &infoLog, const std::string
{ {
*outCompiledBlob = binary; *outCompiledBlob = binary;
#ifdef ANGLE_GENERATE_SHADER_DEBUG_INFO #if ANGLE_SHADER_DEBUG_INFO == ANGLE_ENABLED
(*outDebugInfo) += "// COMPILER INPUT HLSL BEGIN\n\n" + hlsl + "\n// COMPILER INPUT HLSL END\n"; (*outDebugInfo) += "// COMPILER INPUT HLSL BEGIN\n\n" + hlsl + "\n// COMPILER INPUT HLSL END\n";
(*outDebugInfo) += "\n\n// ASSEMBLY BEGIN\n\n"; (*outDebugInfo) += "\n\n// ASSEMBLY BEGIN\n\n";
(*outDebugInfo) += "// Compiler configuration: " + configs[i].name + "\n// Flags:\n"; (*outDebugInfo) += "// Compiler configuration: " + configs[i].name + "\n// Flags:\n";
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "libGLESv2/renderer/d3d/ProgramD3D.h" #include "libGLESv2/renderer/d3d/ProgramD3D.h"
#include "common/features.h"
#include "common/utilities.h" #include "common/utilities.h"
#include "libGLESv2/Framebuffer.h" #include "libGLESv2/Framebuffer.h"
#include "libGLESv2/FramebufferAttachment.h" #include "libGLESv2/FramebufferAttachment.h"
...@@ -954,7 +955,7 @@ gl::LinkResult ProgramD3D::compileProgramExecutables(gl::InfoLog &infoLog, gl::S ...@@ -954,7 +955,7 @@ gl::LinkResult ProgramD3D::compileProgramExecutables(gl::InfoLog &infoLog, gl::S
} }
} }
#ifdef ANGLE_GENERATE_SHADER_DEBUG_INFO #if ANGLE_SHADER_DEBUG_INFO == ANGLE_ENABLED
if (usesGeometryShader() && mGeometryExecutable) if (usesGeometryShader() && mGeometryExecutable)
{ {
// Geometry shaders are currently only used internally, so there is no corresponding shader object at the interface level // Geometry shaders are currently only used internally, so there is no corresponding shader object at the interface level
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "libGLESv2/Shader.h" #include "libGLESv2/Shader.h"
#include "libGLESv2/main.h" #include "libGLESv2/main.h"
#include "common/features.h"
#include "common/utilities.h" #include "common/utilities.h"
// Definitions local to the translation unit // Definitions local to the translation unit
...@@ -451,7 +452,7 @@ bool ShaderD3D::compile(const std::string &source) ...@@ -451,7 +452,7 @@ bool ShaderD3D::compile(const std::string &source)
} }
} }
#ifdef ANGLE_GENERATE_SHADER_DEBUG_INFO #if ANGLE_SHADER_DEBUG_INFO == ANGLE_ENABLED
mDebugInfo += std::string("// ") + GetShaderTypeString(mType) + " SHADER BEGIN\n"; mDebugInfo += std::string("// ") + GetShaderTypeString(mType) + " SHADER BEGIN\n";
mDebugInfo += "\n// GLSL BEGIN\n\n" + source + "\n\n// GLSL END\n\n\n"; mDebugInfo += "\n// GLSL BEGIN\n\n" + source + "\n\n// GLSL END\n\n\n";
mDebugInfo += "// INITIAL HLSL BEGIN\n\n" + getTranslatedSource() + "\n// INITIAL HLSL END\n\n\n"; mDebugInfo += "// INITIAL HLSL BEGIN\n\n" + getTranslatedSource() + "\n// INITIAL HLSL END\n\n\n";
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthrough2d11vs.h" #include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthrough2d11vs.h"
#include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2d11ps.h" #include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2d11ps.h"
#include "common/features.h"
#include "common/NativeWindow.h" #include "common/NativeWindow.h"
namespace rx namespace rx
...@@ -578,7 +579,7 @@ EGLint SwapChain11::swapRect(EGLint x, EGLint y, EGLint width, EGLint height) ...@@ -578,7 +579,7 @@ EGLint SwapChain11::swapRect(EGLint x, EGLint y, EGLint width, EGLint height)
// Draw // Draw
deviceContext->Draw(4, 0); deviceContext->Draw(4, 0);
#ifdef ANGLE_FORCE_VSYNC_OFF #if ANGLE_VSYNC == ANGLE_DISABLED
result = mSwapChain->Present(0, 0); result = mSwapChain->Present(0, 0);
#else #else
result = mSwapChain->Present(mSwapInterval, 0); result = mSwapChain->Present(mSwapInterval, 0);
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include "libEGL/Display.h" #include "libEGL/Display.h"
#include "common/features.h"
#include "common/utilities.h" #include "common/utilities.h"
#include "third_party/trace_event/trace_event.h" #include "third_party/trace_event/trace_event.h"
...@@ -48,14 +49,6 @@ ...@@ -48,14 +49,6 @@
// Can also be enabled by defining FORCE_REF_RAST in the project's predefined macros // Can also be enabled by defining FORCE_REF_RAST in the project's predefined macros
#define REF_RAST 0 #define REF_RAST 0
// The "Debug This Pixel..." feature in PIX often fails when using the
// D3D9Ex interfaces. In order to get debug pixel to work on a Vista/Win 7
// machine, define "ANGLE_ENABLE_D3D9EX=0" in your project file.
#if !defined(ANGLE_ENABLE_D3D9EX)
// Enables use of the IDirect3D9Ex interface, when available
#define ANGLE_ENABLE_D3D9EX 1
#endif // !defined(ANGLE_ENABLE_D3D9EX)
#if !defined(ANGLE_COMPILE_OPTIMIZATION_LEVEL) #if !defined(ANGLE_COMPILE_OPTIMIZATION_LEVEL)
#define ANGLE_COMPILE_OPTIMIZATION_LEVEL D3DCOMPILE_OPTIMIZATION_LEVEL3 #define ANGLE_COMPILE_OPTIMIZATION_LEVEL D3DCOMPILE_OPTIMIZATION_LEVEL3
#endif #endif
...@@ -207,7 +200,7 @@ EGLint Renderer9::initialize() ...@@ -207,7 +200,7 @@ EGLint Renderer9::initialize()
// Use Direct3D9Ex if available. Among other things, this version is less // Use Direct3D9Ex if available. Among other things, this version is less
// inclined to report a lost context, for example when the user switches // inclined to report a lost context, for example when the user switches
// desktop. Direct3D9Ex is available in Windows Vista and later if suitable drivers are available. // desktop. Direct3D9Ex is available in Windows Vista and later if suitable drivers are available.
if (ANGLE_ENABLE_D3D9EX && Direct3DCreate9ExPtr && SUCCEEDED(Direct3DCreate9ExPtr(D3D_SDK_VERSION, &mD3d9Ex))) if (ANGLE_D3D9EX == ANGLE_ENABLED && Direct3DCreate9ExPtr && SUCCEEDED(Direct3DCreate9ExPtr(D3D_SDK_VERSION, &mD3d9Ex)))
{ {
TRACE_EVENT0("gpu", "D3d9Ex_QueryInterface"); TRACE_EVENT0("gpu", "D3d9Ex_QueryInterface");
ASSERT(mD3d9Ex); ASSERT(mD3d9Ex);
...@@ -2288,7 +2281,7 @@ bool Renderer9::isRemovedDeviceResettable() const ...@@ -2288,7 +2281,7 @@ bool Renderer9::isRemovedDeviceResettable() const
{ {
bool success = false; bool success = false;
#ifdef ANGLE_ENABLE_D3D9EX #if ANGLE_D3D9EX == ANGLE_ENABLED
IDirect3D9Ex *d3d9Ex = NULL; IDirect3D9Ex *d3d9Ex = NULL;
typedef HRESULT (WINAPI *Direct3DCreate9ExFunc)(UINT, IDirect3D9Ex**); typedef HRESULT (WINAPI *Direct3DCreate9ExFunc)(UINT, IDirect3D9Ex**);
Direct3DCreate9ExFunc Direct3DCreate9ExPtr = reinterpret_cast<Direct3DCreate9ExFunc>(GetProcAddress(mD3d9Module, "Direct3DCreate9Ex")); Direct3DCreate9ExFunc Direct3DCreate9ExPtr = reinterpret_cast<Direct3DCreate9ExFunc>(GetProcAddress(mD3d9Module, "Direct3DCreate9Ex"));
......
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
#include "libGLESv2/renderer/d3d/d3d9/formatutils9.h" #include "libGLESv2/renderer/d3d/d3d9/formatutils9.h"
#include "libGLESv2/renderer/d3d/d3d9/Renderer9.h" #include "libGLESv2/renderer/d3d/d3d9/Renderer9.h"
#include "common/features.h"
namespace rx namespace rx
{ {
...@@ -50,7 +52,7 @@ void SwapChain9::release() ...@@ -50,7 +52,7 @@ void SwapChain9::release()
static DWORD convertInterval(EGLint interval) static DWORD convertInterval(EGLint interval)
{ {
#ifdef ANGLE_FORCE_VSYNC_OFF #if ANGLE_VSYNC == ANGLE_DISABLED
return D3DPRESENT_INTERVAL_IMMEDIATE; return D3DPRESENT_INTERVAL_IMMEDIATE;
#else #else
switch(interval) switch(interval)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment