Prevent accidental misuse of ANGLE_ENABLED

... by removing it altogether.  This macro was only available when
features.h was included.  If that header was not included, the
preprocessor would automatically consider it 0, which has the opposite
effect from what was desired.

Bug: angleproject:8256
Change-Id: Ia141573c0c8b44eef1388f4c3ec73ef770cd2854
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4685226
Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Geoff Lang <geofflang@chromium.org>
This commit is contained in:
Shahbaz Youssefi
2023-07-13 15:02:58 -04:00
committed by Angle LUCI CQ
parent 75254b989a
commit 927410a8c1
6 changed files with 15 additions and 18 deletions

View File

@@ -54,7 +54,7 @@ LinkMismatchError LinkValidateUniforms(const sh::ShaderVariable &uniform1,
const sh::ShaderVariable &uniform2,
std::string *mismatchedStructFieldName)
{
#if ANGLE_PROGRAM_LINK_VALIDATE_UNIFORM_PRECISION == ANGLE_ENABLED
#if ANGLE_PROGRAM_LINK_VALIDATE_UNIFORM_PRECISION
const bool validatePrecisionFeature = true;
#else
const bool validatePrecisionFeature = false;

View File

@@ -9,9 +9,6 @@
#include "common/platform.h"
#define ANGLE_DISABLED 0
#define ANGLE_ENABLED 1
// Feature defaults
// Direct3D9EX
@@ -19,22 +16,22 @@
// 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
# define ANGLE_D3D9EX 1
#endif
// Vsync
// ENABLED allows Vsync to be configured at runtime
// DISABLED disallows Vsync
#if !defined(ANGLE_VSYNC)
# define ANGLE_VSYNC ANGLE_ENABLED
# define ANGLE_VSYNC 1
#endif
// Append HLSL assembly to shader debug info. Defaults to enabled in Debug and off in Release.
#if !defined(ANGLE_APPEND_ASSEMBLY_TO_SHADER_DEBUG_INFO)
# if !defined(NDEBUG)
# define ANGLE_APPEND_ASSEMBLY_TO_SHADER_DEBUG_INFO ANGLE_ENABLED
# define ANGLE_APPEND_ASSEMBLY_TO_SHADER_DEBUG_INFO 1
# else
# define ANGLE_APPEND_ASSEMBLY_TO_SHADER_DEBUG_INFO ANGLE_DISABLED
# define ANGLE_APPEND_ASSEMBLY_TO_SHADER_DEBUG_INFO 0
# endif // !defined(NDEBUG)
#endif // !defined(ANGLE_APPEND_ASSEMBLY_TO_SHADER_DEBUG_INFO)
@@ -44,7 +41,7 @@
// ENABLED validate that precision for uniforms match between vertex and fragment shaders
// DISABLED allow precision for uniforms to differ between vertex and fragment shaders
#if !defined(ANGLE_PROGRAM_LINK_VALIDATE_UNIFORM_PRECISION)
# define ANGLE_PROGRAM_LINK_VALIDATE_UNIFORM_PRECISION ANGLE_ENABLED
# define ANGLE_PROGRAM_LINK_VALIDATE_UNIFORM_PRECISION 1
#endif
#endif // LIBANGLE_FEATURES_H_

View File

@@ -19,7 +19,7 @@
namespace
{
#if ANGLE_APPEND_ASSEMBLY_TO_SHADER_DEBUG_INFO == ANGLE_ENABLED
#if ANGLE_APPEND_ASSEMBLY_TO_SHADER_DEBUG_INFO
# ifdef CREATE_COMPILER_FLAG_INFO
# undef CREATE_COMPILER_FLAG_INFO
# endif
@@ -82,7 +82,7 @@ bool IsCompilerFlagSet(UINT mask, UINT flag)
return isFlagSet;
}
}
#endif // ANGLE_APPEND_ASSEMBLY_TO_SHADER_DEBUG_INFO == ANGLE_ENABLED
#endif // ANGLE_APPEND_ASSEMBLY_TO_SHADER_DEBUG_INFO
enum D3DCompilerLoadLibraryResult
{
@@ -290,7 +290,7 @@ angle::Result HLSLCompiler::compileToBinary(d3d::Context *context,
(*outDebugInfo) +=
"// COMPILER INPUT HLSL BEGIN\n\n" + hlsl + "\n// COMPILER INPUT HLSL END\n";
#if ANGLE_APPEND_ASSEMBLY_TO_SHADER_DEBUG_INFO == ANGLE_ENABLED
#if ANGLE_APPEND_ASSEMBLY_TO_SHADER_DEBUG_INFO
(*outDebugInfo) += "\n\n// ASSEMBLY BEGIN\n\n";
(*outDebugInfo) += "// Compiler configuration: " + configs[i].name + "\n// Flags:\n";
for (size_t fIx = 0; fIx < ArraySize(CompilerFlagInfos); ++fIx)
@@ -318,7 +318,7 @@ angle::Result HLSLCompiler::compileToBinary(d3d::Context *context,
std::string disassembly;
ANGLE_TRY(disassembleBinary(context, binary, &disassembly));
(*outDebugInfo) += "\n" + disassembly + "\n// ASSEMBLY END\n";
#endif // ANGLE_APPEND_ASSEMBLY_TO_SHADER_DEBUG_INFO == ANGLE_ENABLED
#endif // ANGLE_APPEND_ASSEMBLY_TO_SHADER_DEBUG_INFO
return angle::Result::Continue;
}

View File

@@ -286,7 +286,7 @@ EGLint SwapChain11::resetOffscreenColorBuffer(DisplayD3D *displayD3D,
{
IDXGIResource *offscreenTextureResource = nullptr;
HRESULT hr = mOffscreenTexture.get()->QueryInterface(
__uuidof(IDXGIResource), (void **)&offscreenTextureResource);
__uuidof(IDXGIResource), (void **)&offscreenTextureResource);
// Fall back to no share handle on failure
if (FAILED(hr))
@@ -907,7 +907,7 @@ EGLint SwapChain11::present(DisplayD3D *displayD3D, EGLint x, EGLint y, EGLint w
}
UINT swapInterval = mSwapInterval;
#if ANGLE_VSYNC == ANGLE_DISABLED
#if !ANGLE_VSYNC
swapInterval = 0;
#endif

View File

@@ -217,7 +217,7 @@ egl::Error Renderer9::initialize()
// 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.
if (ANGLE_D3D9EX == ANGLE_ENABLED && Direct3DCreate9ExPtr &&
if (static_cast<bool>(ANGLE_D3D9EX) && Direct3DCreate9ExPtr &&
SUCCEEDED(Direct3DCreate9ExPtr(D3D_SDK_VERSION, &mD3d9Ex)))
{
ANGLE_TRACE_EVENT0("gpu.angle", "D3d9Ex_QueryInterface");
@@ -2359,7 +2359,7 @@ bool Renderer9::isRemovedDeviceResettable() const
{
bool success = false;
#if ANGLE_D3D9EX == ANGLE_ENABLED
#if ANGLE_D3D9EX
IDirect3D9Ex *d3d9Ex = nullptr;
typedef HRESULT(WINAPI * Direct3DCreate9ExFunc)(UINT, IDirect3D9Ex **);
Direct3DCreate9ExFunc Direct3DCreate9ExPtr =

View File

@@ -62,7 +62,7 @@ void SwapChain9::release()
static DWORD convertInterval(EGLint interval)
{
#if ANGLE_VSYNC == ANGLE_DISABLED
#if !ANGLE_VSYNC
return D3DPRESENT_INTERVAL_IMMEDIATE;
#else
switch (interval)