.edtiorconfig driven reformat of source (#271)

This commit is contained in:
Chuck Walbourn
2022-04-04 15:03:02 -07:00
committed by GitHub
parent 091835fa86
commit b1001d15b3
48 changed files with 5645 additions and 5531 deletions

View File

@@ -43,7 +43,7 @@ using namespace DirectX;
// Macros
//--------------------------------------------------------------------------------------
#ifndef MAKEFOURCC
#define MAKEFOURCC(ch0, ch1, ch2, ch3) \
#define MAKEFOURCC(ch0, ch1, ch2, ch3) \
((uint32_t)(uint8_t)(ch0) | ((uint32_t)(uint8_t)(ch1) << 8) | \
((uint32_t)(uint8_t)(ch2) << 16) | ((uint32_t)(uint8_t)(ch3) << 24 ))
#endif /* defined(MAKEFOURCC) */
@@ -136,7 +136,7 @@ namespace
inline HANDLE safe_handle(HANDLE h) noexcept { return (h == INVALID_HANDLE_VALUE) ? nullptr : h; }
template<UINT TNameLength>
inline void SetDebugObjectName(_In_ ID3D11DeviceChild* resource, _In_ const char (&name)[TNameLength]) noexcept
inline void SetDebugObjectName(_In_ ID3D11DeviceChild* resource, _In_ const char(&name)[TNameLength]) noexcept
{
#if defined(_DEBUG) || defined(PROFILE)
resource->SetPrivateData(WKPDID_D3DDebugObjectName, TNameLength - 1, name);
@@ -229,13 +229,13 @@ namespace
*bitSize = 0;
// open the file
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8)
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8)
ScopedHandle hFile(safe_handle(CreateFile2(fileName,
GENERIC_READ,
FILE_SHARE_READ,
OPEN_EXISTING,
nullptr)));
#else
#else
ScopedHandle hFile(safe_handle(CreateFileW(fileName,
GENERIC_READ,
FILE_SHARE_READ,
@@ -243,7 +243,7 @@ namespace
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
nullptr)));
#endif
#endif
if (!hFile)
{
@@ -611,13 +611,13 @@ namespace
numBytes = rowBytes * height;
}
#if defined(_M_IX86) || defined(_M_ARM) || defined(_M_HYBRID_X86_ARM64)
#if defined(_M_IX86) || defined(_M_ARM) || defined(_M_HYBRID_X86_ARM64)
static_assert(sizeof(size_t) == 4, "Not a 32-bit platform!");
if (numBytes > UINT32_MAX || rowBytes > UINT32_MAX || numRows > UINT32_MAX)
return HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW);
#else
#else
static_assert(sizeof(size_t) == 8, "Not a 64-bit platform!");
#endif
#endif
if (outNumBytes)
{
@@ -637,7 +637,7 @@ namespace
//--------------------------------------------------------------------------------------
#define ISBITMASK( r,g,b,a ) ( ddpf.RBitMask == r && ddpf.GBitMask == g && ddpf.BBitMask == b && ddpf.ABitMask == a )
#define ISBITMASK( r,g,b,a ) ( ddpf.RBitMask == r && ddpf.GBitMask == g && ddpf.BBitMask == b && ddpf.ABitMask == a )
DXGI_FORMAT GetDXGIFormat(const DDS_PIXELFORMAT& ddpf) noexcept
{
@@ -904,10 +904,10 @@ namespace
return DXGI_FORMAT_UNKNOWN;
}
#undef ISBITMASK
#undef ISBITMASK
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
DXGI_FORMAT MakeSRGB(_In_ DXGI_FORMAT format) noexcept
{
switch (format)
@@ -1070,202 +1070,202 @@ namespace
switch (resDim)
{
case D3D11_RESOURCE_DIMENSION_TEXTURE1D:
{
D3D11_TEXTURE1D_DESC desc;
desc.Width = static_cast<UINT>(width);
desc.MipLevels = static_cast<UINT>(mipCount);
desc.ArraySize = static_cast<UINT>(arraySize);
desc.Format = format;
desc.Usage = usage;
desc.BindFlags = bindFlags;
desc.CPUAccessFlags = cpuAccessFlags;
desc.MiscFlags = miscFlags & ~static_cast<unsigned int>(D3D11_RESOURCE_MISC_TEXTURECUBE);
ID3D11Texture1D* tex = nullptr;
hr = d3dDevice->CreateTexture1D(&desc,
initData,
&tex
);
if (SUCCEEDED(hr) && tex)
{
if (textureView)
{
D3D11_SHADER_RESOURCE_VIEW_DESC SRVDesc = {};
SRVDesc.Format = format;
if (arraySize > 1)
{
SRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE1DARRAY;
SRVDesc.Texture1DArray.MipLevels = (!mipCount) ? UINT(-1) : desc.MipLevels;
SRVDesc.Texture1DArray.ArraySize = static_cast<UINT>(arraySize);
}
else
{
SRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE1D;
SRVDesc.Texture1D.MipLevels = (!mipCount) ? UINT(-1) : desc.MipLevels;
}
hr = d3dDevice->CreateShaderResourceView(tex,
&SRVDesc,
textureView
);
if (FAILED(hr))
{
tex->Release();
return hr;
}
}
if (texture)
{
*texture = tex;
}
else
{
SetDebugObjectName(tex, "DDSTextureLoader");
tex->Release();
}
}
}
break;
case D3D11_RESOURCE_DIMENSION_TEXTURE2D:
{
D3D11_TEXTURE2D_DESC desc;
desc.Width = static_cast<UINT>(width);
desc.Height = static_cast<UINT>(height);
desc.MipLevels = static_cast<UINT>(mipCount);
desc.ArraySize = static_cast<UINT>(arraySize);
desc.Format = format;
desc.SampleDesc.Count = 1;
desc.SampleDesc.Quality = 0;
desc.Usage = usage;
desc.BindFlags = bindFlags;
desc.CPUAccessFlags = cpuAccessFlags;
if (isCubeMap)
{
desc.MiscFlags = miscFlags | D3D11_RESOURCE_MISC_TEXTURECUBE;
}
else
{
D3D11_TEXTURE1D_DESC desc;
desc.Width = static_cast<UINT>(width);
desc.MipLevels = static_cast<UINT>(mipCount);
desc.ArraySize = static_cast<UINT>(arraySize);
desc.Format = format;
desc.Usage = usage;
desc.BindFlags = bindFlags;
desc.CPUAccessFlags = cpuAccessFlags;
desc.MiscFlags = miscFlags & ~static_cast<unsigned int>(D3D11_RESOURCE_MISC_TEXTURECUBE);
}
ID3D11Texture2D* tex = nullptr;
hr = d3dDevice->CreateTexture2D(&desc,
initData,
&tex
);
if (SUCCEEDED(hr) && tex)
{
if (textureView)
ID3D11Texture1D* tex = nullptr;
hr = d3dDevice->CreateTexture1D(&desc,
initData,
&tex
);
if (SUCCEEDED(hr) && tex)
{
D3D11_SHADER_RESOURCE_VIEW_DESC SRVDesc = {};
SRVDesc.Format = format;
if (isCubeMap)
if (textureView)
{
if (arraySize > 6)
{
SRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURECUBEARRAY;
SRVDesc.TextureCubeArray.MipLevels = (!mipCount) ? UINT(-1) : desc.MipLevels;
D3D11_SHADER_RESOURCE_VIEW_DESC SRVDesc = {};
SRVDesc.Format = format;
// Earlier we set arraySize to (NumCubes * 6)
SRVDesc.TextureCubeArray.NumCubes = static_cast<UINT>(arraySize / 6);
if (arraySize > 1)
{
SRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE1DARRAY;
SRVDesc.Texture1DArray.MipLevels = (!mipCount) ? UINT(-1) : desc.MipLevels;
SRVDesc.Texture1DArray.ArraySize = static_cast<UINT>(arraySize);
}
else
{
SRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURECUBE;
SRVDesc.TextureCube.MipLevels = (!mipCount) ? UINT(-1) : desc.MipLevels;
SRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE1D;
SRVDesc.Texture1D.MipLevels = (!mipCount) ? UINT(-1) : desc.MipLevels;
}
hr = d3dDevice->CreateShaderResourceView(tex,
&SRVDesc,
textureView
);
if (FAILED(hr))
{
tex->Release();
return hr;
}
}
else if (arraySize > 1)
if (texture)
{
SRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DARRAY;
SRVDesc.Texture2DArray.MipLevels = (!mipCount) ? UINT(-1) : desc.MipLevels;
SRVDesc.Texture2DArray.ArraySize = static_cast<UINT>(arraySize);
*texture = tex;
}
else
{
SRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
SRVDesc.Texture2D.MipLevels = (!mipCount) ? UINT(-1) : desc.MipLevels;
}
hr = d3dDevice->CreateShaderResourceView(tex,
&SRVDesc,
textureView
);
if (FAILED(hr))
{
SetDebugObjectName(tex, "DDSTextureLoader");
tex->Release();
return hr;
}
}
}
break;
if (texture)
case D3D11_RESOURCE_DIMENSION_TEXTURE2D:
{
D3D11_TEXTURE2D_DESC desc;
desc.Width = static_cast<UINT>(width);
desc.Height = static_cast<UINT>(height);
desc.MipLevels = static_cast<UINT>(mipCount);
desc.ArraySize = static_cast<UINT>(arraySize);
desc.Format = format;
desc.SampleDesc.Count = 1;
desc.SampleDesc.Quality = 0;
desc.Usage = usage;
desc.BindFlags = bindFlags;
desc.CPUAccessFlags = cpuAccessFlags;
if (isCubeMap)
{
*texture = tex;
desc.MiscFlags = miscFlags | D3D11_RESOURCE_MISC_TEXTURECUBE;
}
else
{
SetDebugObjectName(tex, "DDSTextureLoader");
tex->Release();
desc.MiscFlags = miscFlags & ~static_cast<unsigned int>(D3D11_RESOURCE_MISC_TEXTURECUBE);
}
ID3D11Texture2D* tex = nullptr;
hr = d3dDevice->CreateTexture2D(&desc,
initData,
&tex
);
if (SUCCEEDED(hr) && tex)
{
if (textureView)
{
D3D11_SHADER_RESOURCE_VIEW_DESC SRVDesc = {};
SRVDesc.Format = format;
if (isCubeMap)
{
if (arraySize > 6)
{
SRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURECUBEARRAY;
SRVDesc.TextureCubeArray.MipLevels = (!mipCount) ? UINT(-1) : desc.MipLevels;
// Earlier we set arraySize to (NumCubes * 6)
SRVDesc.TextureCubeArray.NumCubes = static_cast<UINT>(arraySize / 6);
}
else
{
SRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURECUBE;
SRVDesc.TextureCube.MipLevels = (!mipCount) ? UINT(-1) : desc.MipLevels;
}
}
else if (arraySize > 1)
{
SRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DARRAY;
SRVDesc.Texture2DArray.MipLevels = (!mipCount) ? UINT(-1) : desc.MipLevels;
SRVDesc.Texture2DArray.ArraySize = static_cast<UINT>(arraySize);
}
else
{
SRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
SRVDesc.Texture2D.MipLevels = (!mipCount) ? UINT(-1) : desc.MipLevels;
}
hr = d3dDevice->CreateShaderResourceView(tex,
&SRVDesc,
textureView
);
if (FAILED(hr))
{
tex->Release();
return hr;
}
}
if (texture)
{
*texture = tex;
}
else
{
SetDebugObjectName(tex, "DDSTextureLoader");
tex->Release();
}
}
}
}
break;
break;
case D3D11_RESOURCE_DIMENSION_TEXTURE3D:
{
D3D11_TEXTURE3D_DESC desc;
desc.Width = static_cast<UINT>(width);
desc.Height = static_cast<UINT>(height);
desc.Depth = static_cast<UINT>(depth);
desc.MipLevels = static_cast<UINT>(mipCount);
desc.Format = format;
desc.Usage = usage;
desc.BindFlags = bindFlags;
desc.CPUAccessFlags = cpuAccessFlags;
desc.MiscFlags = miscFlags & ~static_cast<unsigned int>(D3D11_RESOURCE_MISC_TEXTURECUBE);
ID3D11Texture3D* tex = nullptr;
hr = d3dDevice->CreateTexture3D(&desc,
initData,
&tex
);
if (SUCCEEDED(hr) && tex)
{
if (textureView)
D3D11_TEXTURE3D_DESC desc;
desc.Width = static_cast<UINT>(width);
desc.Height = static_cast<UINT>(height);
desc.Depth = static_cast<UINT>(depth);
desc.MipLevels = static_cast<UINT>(mipCount);
desc.Format = format;
desc.Usage = usage;
desc.BindFlags = bindFlags;
desc.CPUAccessFlags = cpuAccessFlags;
desc.MiscFlags = miscFlags & ~static_cast<unsigned int>(D3D11_RESOURCE_MISC_TEXTURECUBE);
ID3D11Texture3D* tex = nullptr;
hr = d3dDevice->CreateTexture3D(&desc,
initData,
&tex
);
if (SUCCEEDED(hr) && tex)
{
D3D11_SHADER_RESOURCE_VIEW_DESC SRVDesc = {};
SRVDesc.Format = format;
SRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE3D;
SRVDesc.Texture3D.MipLevels = (!mipCount) ? UINT(-1) : desc.MipLevels;
hr = d3dDevice->CreateShaderResourceView(tex,
&SRVDesc,
textureView
);
if (FAILED(hr))
if (textureView)
{
D3D11_SHADER_RESOURCE_VIEW_DESC SRVDesc = {};
SRVDesc.Format = format;
SRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE3D;
SRVDesc.Texture3D.MipLevels = (!mipCount) ? UINT(-1) : desc.MipLevels;
hr = d3dDevice->CreateShaderResourceView(tex,
&SRVDesc,
textureView
);
if (FAILED(hr))
{
tex->Release();
return hr;
}
}
if (texture)
{
*texture = tex;
}
else
{
SetDebugObjectName(tex, "DDSTextureLoader");
tex->Release();
return hr;
}
}
if (texture)
{
*texture = tex;
}
else
{
SetDebugObjectName(tex, "DDSTextureLoader");
tex->Release();
}
}
}
break;
break;
}
return hr;
@@ -1434,8 +1434,8 @@ namespace
}
}
else if ((arraySize > D3D11_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION) ||
(width > D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION) ||
(height > D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION))
(width > D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION) ||
(height > D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION))
{
return HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED);
}
@@ -1682,7 +1682,7 @@ namespace
_In_opt_ ID3D11Resource** texture,
_In_opt_ ID3D11ShaderResourceView** textureView) noexcept
{
#if !defined(NO_D3D11_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) )
#if !defined(NO_D3D11_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) )
if (texture || textureView)
{
CHAR strFileA[MAX_PATH];
@@ -1724,11 +1724,11 @@ namespace
}
}
}
#else
#else
UNREFERENCED_PARAMETER(fileName);
UNREFERENCED_PARAMETER(texture);
UNREFERENCED_PARAMETER(textureView);
#endif
#endif
}
} // anonymous namespace

View File

@@ -30,11 +30,11 @@ namespace DirectX
#define DDS_ALPHA_MODE_DEFINED
enum DDS_ALPHA_MODE : uint32_t
{
DDS_ALPHA_MODE_UNKNOWN = 0,
DDS_ALPHA_MODE_STRAIGHT = 1,
DDS_ALPHA_MODE_UNKNOWN = 0,
DDS_ALPHA_MODE_STRAIGHT = 1,
DDS_ALPHA_MODE_PREMULTIPLIED = 2,
DDS_ALPHA_MODE_OPAQUE = 3,
DDS_ALPHA_MODE_CUSTOM = 4,
DDS_ALPHA_MODE_OPAQUE = 3,
DDS_ALPHA_MODE_CUSTOM = 4,
};
#endif

View File

@@ -59,7 +59,7 @@ using namespace DirectX;
// Macros
//--------------------------------------------------------------------------------------
#ifndef MAKEFOURCC
#define MAKEFOURCC(ch0, ch1, ch2, ch3) \
#define MAKEFOURCC(ch0, ch1, ch2, ch3) \
((uint32_t)(uint8_t)(ch0) | ((uint32_t)(uint8_t)(ch1) << 8) | \
((uint32_t)(uint8_t)(ch2) << 16) | ((uint32_t)(uint8_t)(ch3) << 24 ))
#endif /* defined(MAKEFOURCC) */
@@ -168,12 +168,12 @@ namespace
template<UINT TNameLength>
inline void SetDebugObjectName(_In_ ID3D12DeviceChild* resource, _In_z_ const wchar_t(&name)[TNameLength]) noexcept
{
#if !defined(NO_D3D12_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) )
resource->SetName(name);
#else
UNREFERENCED_PARAMETER(resource);
UNREFERENCED_PARAMETER(name);
#endif
#if !defined(NO_D3D12_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) )
resource->SetName(name);
#else
UNREFERENCED_PARAMETER(resource);
UNREFERENCED_PARAMETER(name);
#endif
}
inline uint32_t CountMips(uint32_t width, uint32_t height) noexcept
@@ -274,8 +274,8 @@ namespace
*bitSize = 0;
#ifdef WIN32
// open the file
#ifdef WIN32
// open the file
ScopedHandle hFile(safe_handle(CreateFile2(fileName,
GENERIC_READ,
FILE_SHARE_READ,
@@ -334,7 +334,7 @@ namespace
size_t len = fileInfo.EndOfFile.LowPart;
#else // !WIN32
#else // !WIN32
std::ifstream inFile(std::filesystem::path(fileName), std::ios::in | std::ios::binary | std::ios::ate);
if (!inFile)
return E_FAIL;
@@ -358,17 +358,17 @@ namespace
return E_FAIL;
}
inFile.read(reinterpret_cast<char*>(ddsData.get()), fileLen);
if (!inFile)
{
ddsData.reset();
return E_FAIL;
}
inFile.read(reinterpret_cast<char*>(ddsData.get()), fileLen);
if (!inFile)
{
ddsData.reset();
return E_FAIL;
}
inFile.close();
inFile.close();
size_t len = fileLen;
#endif
size_t len = fileLen;
#endif
// DDS files always start with the same magic number ("DDS ")
auto const dwMagicNumber = *reinterpret_cast<const uint32_t*>(ddsData.get());
@@ -690,13 +690,13 @@ namespace
numBytes = rowBytes * height;
}
#if defined(_M_IX86) || defined(_M_ARM) || defined(_M_HYBRID_X86_ARM64)
#if defined(_M_IX86) || defined(_M_ARM) || defined(_M_HYBRID_X86_ARM64)
static_assert(sizeof(size_t) == 4, "Not a 32-bit platform!");
if (numBytes > UINT32_MAX || rowBytes > UINT32_MAX || numRows > UINT32_MAX)
return HRESULT_E_ARITHMETIC_OVERFLOW;
#else
#else
static_assert(sizeof(size_t) == 8, "Not a 64-bit platform!");
#endif
#endif
if (outNumBytes)
{
@@ -716,7 +716,7 @@ namespace
//--------------------------------------------------------------------------------------
#define ISBITMASK( r,g,b,a ) ( ddpf.RBitMask == r && ddpf.GBitMask == g && ddpf.BBitMask == b && ddpf.ABitMask == a )
#define ISBITMASK( r,g,b,a ) ( ddpf.RBitMask == r && ddpf.GBitMask == g && ddpf.BBitMask == b && ddpf.ABitMask == a )
DXGI_FORMAT GetDXGIFormat(const DDS_PIXELFORMAT& ddpf) noexcept
{
@@ -983,10 +983,10 @@ namespace
return DXGI_FORMAT_UNKNOWN;
}
#undef ISBITMASK
#undef ISBITMASK
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
DXGI_FORMAT MakeSRGB(_In_ DXGI_FORMAT format) noexcept
{
switch (format)
@@ -1405,8 +1405,8 @@ namespace
}
}
else if ((arraySize > D3D12_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION) ||
(width > D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION) ||
(height > D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION))
(width > D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION) ||
(height > D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION))
{
return HRESULT_E_NOT_SUPPORTED;
}
@@ -1443,7 +1443,7 @@ namespace
// Create the texture
size_t numberOfResources = (resDim == D3D12_RESOURCE_DIMENSION_TEXTURE3D)
? 1 : arraySize;
? 1 : arraySize;
numberOfResources *= mipCount;
numberOfResources *= numberOfPlanes;
@@ -1503,15 +1503,15 @@ namespace
}
//--------------------------------------------------------------------------------------
DDS_ALPHA_MODE GetAlphaMode( _In_ const DDS_HEADER* header ) noexcept
DDS_ALPHA_MODE GetAlphaMode(_In_ const DDS_HEADER* header) noexcept
{
if ( header->ddspf.flags & DDS_FOURCC )
if (header->ddspf.flags & DDS_FOURCC)
{
if ( MAKEFOURCC( 'D', 'X', '1', '0' ) == header->ddspf.fourCC )
if (MAKEFOURCC('D', 'X', '1', '0') == header->ddspf.fourCC)
{
auto d3d10ext = reinterpret_cast<const DDS_HEADER_DXT10*>(reinterpret_cast<const uint8_t*>(header) + sizeof(DDS_HEADER));
auto const mode = static_cast<DDS_ALPHA_MODE>( d3d10ext->miscFlags2 & DDS_MISC_FLAGS2_ALPHA_MODE_MASK );
switch( mode )
auto const mode = static_cast<DDS_ALPHA_MODE>(d3d10ext->miscFlags2 & DDS_MISC_FLAGS2_ALPHA_MODE_MASK);
switch (mode)
{
case DDS_ALPHA_MODE_STRAIGHT:
case DDS_ALPHA_MODE_PREMULTIPLIED:
@@ -1524,8 +1524,8 @@ namespace
break;
}
}
else if ( ( MAKEFOURCC( 'D', 'X', 'T', '2' ) == header->ddspf.fourCC )
|| ( MAKEFOURCC( 'D', 'X', 'T', '4' ) == header->ddspf.fourCC ) )
else if ((MAKEFOURCC('D', 'X', 'T', '2') == header->ddspf.fourCC)
|| (MAKEFOURCC('D', 'X', 'T', '4') == header->ddspf.fourCC))
{
return DDS_ALPHA_MODE_PREMULTIPLIED;
}
@@ -1539,7 +1539,7 @@ namespace
_In_z_ const wchar_t* fileName,
_In_ ID3D12Resource** texture) noexcept
{
#if !defined(NO_D3D12_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) )
#if !defined(NO_D3D12_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) )
if (texture && *texture)
{
const wchar_t* pstrName = wcsrchr(fileName, '\\');
@@ -1554,10 +1554,10 @@ namespace
(*texture)->SetName(pstrName);
}
#else
#else
UNREFERENCED_PARAMETER(fileName);
UNREFERENCED_PARAMETER(texture);
#endif
#endif
}
} // anonymous namespace

View File

@@ -37,11 +37,11 @@ namespace DirectX
#define DDS_ALPHA_MODE_DEFINED
enum DDS_ALPHA_MODE : uint32_t
{
DDS_ALPHA_MODE_UNKNOWN = 0,
DDS_ALPHA_MODE_STRAIGHT = 1,
DDS_ALPHA_MODE_UNKNOWN = 0,
DDS_ALPHA_MODE_STRAIGHT = 1,
DDS_ALPHA_MODE_PREMULTIPLIED = 2,
DDS_ALPHA_MODE_OPAQUE = 3,
DDS_ALPHA_MODE_CUSTOM = 4,
DDS_ALPHA_MODE_OPAQUE = 3,
DDS_ALPHA_MODE_CUSTOM = 4,
};
#endif
@@ -51,9 +51,9 @@ namespace DirectX
enum DDS_LOADER_FLAGS : uint32_t
{
DDS_LOADER_DEFAULT = 0,
DDS_LOADER_FORCE_SRGB = 0x1,
DDS_LOADER_MIP_RESERVE = 0x8,
DDS_LOADER_DEFAULT = 0,
DDS_LOADER_FORCE_SRGB = 0x1,
DDS_LOADER_MIP_RESERVE = 0x8,
};
#ifdef __clang__

View File

@@ -47,7 +47,7 @@ using Microsoft::WRL::ComPtr;
// Macros
//--------------------------------------------------------------------------------------
#ifndef MAKEFOURCC
#define MAKEFOURCC(ch0, ch1, ch2, ch3) \
#define MAKEFOURCC(ch0, ch1, ch2, ch3) \
((uint32_t)(uint8_t)(ch0) | ((uint32_t)(uint8_t)(ch1) << 8) | \
((uint32_t)(uint8_t)(ch2) << 16) | ((uint32_t)(uint8_t)(ch3) << 24 ))
#endif /* defined(MAKEFOURCC) */
@@ -199,13 +199,13 @@ namespace
*bitSize = 0;
// open the file
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8)
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8)
ScopedHandle hFile(safe_handle(CreateFile2(fileName,
GENERIC_READ,
FILE_SHARE_READ,
OPEN_EXISTING,
nullptr)));
#else
#else
ScopedHandle hFile(safe_handle(CreateFileW(fileName,
GENERIC_READ,
FILE_SHARE_READ,
@@ -213,7 +213,7 @@ namespace
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
nullptr)));
#endif
#endif
if (!hFile)
{
@@ -338,9 +338,9 @@ namespace
case D3DFMT_INDEX32:
case D3DFMT_G16R16F:
case D3DFMT_R32F:
#if !defined(D3D_DISABLE_9EX)
#if !defined(D3D_DISABLE_9EX)
case D3DFMT_D32_LOCKABLE:
#endif
#endif
return 32;
case D3DFMT_R8G8B8:
@@ -383,9 +383,9 @@ namespace
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directshow/htm/directxvideoaccelerationdxvavideosubtypes.asp
case MAKEFOURCC('A', 'I', '4', '4'):
case MAKEFOURCC('I', 'A', '4', '4'):
#if !defined(D3D_DISABLE_9EX)
#if !defined(D3D_DISABLE_9EX)
case D3DFMT_S8_LOCKABLE:
#endif
#endif
return 8;
case D3DFMT_DXT1:
@@ -394,10 +394,10 @@ namespace
case MAKEFOURCC('Y', 'V', '1', '2'):
return 12;
#if !defined(D3D_DISABLE_9EX)
#if !defined(D3D_DISABLE_9EX)
case D3DFMT_A1:
return 1;
#endif
#endif
default:
return 0;
@@ -483,13 +483,13 @@ namespace
numBytes = rowBytes * height;
}
#if defined(_M_IX86) || defined(_M_ARM) || defined(_M_HYBRID_X86_ARM64)
#if defined(_M_IX86) || defined(_M_ARM) || defined(_M_HYBRID_X86_ARM64)
static_assert(sizeof(size_t) == 4, "Not a 32-bit platform!");
if (numBytes > UINT32_MAX || rowBytes > UINT32_MAX || numRows > UINT32_MAX)
return HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW);
#else
#else
static_assert(sizeof(size_t) == 8, "Not a 64-bit platform!");
#endif
#endif
if (outNumBytes)
{
@@ -509,7 +509,7 @@ namespace
//--------------------------------------------------------------------------------------
#define ISBITMASK( r,g,b,a ) ( ddpf.RBitMask == r && ddpf.GBitMask == g && ddpf.BBitMask == b && ddpf.ABitMask == a )
#define ISBITMASK( r,g,b,a ) ( ddpf.RBitMask == r && ddpf.GBitMask == g && ddpf.BBitMask == b && ddpf.ABitMask == a )
D3DFORMAT GetD3D9Format(const DDS_PIXELFORMAT& ddpf) noexcept
{
@@ -766,10 +766,10 @@ namespace
return D3DFMT_UNKNOWN;
}
#undef ISBITMASK
#undef ISBITMASK
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
HRESULT CreateTextureFromDDS(
_In_ LPDIRECT3DDEVICE9 device,
_In_ const DDS_HEADER* header,