mirror of
https://github.com/microsoft/DirectXTex
synced 2024-11-21 12:00:06 +00:00
Convert WICTextureLoader, DDSTextureLoader12 to strongly typed flags
This commit is contained in:
parent
d694249071
commit
3c9e187d96
@ -1192,7 +1192,7 @@ namespace
|
||||
size_t arraySize,
|
||||
DXGI_FORMAT format,
|
||||
D3D12_RESOURCE_FLAGS resFlags,
|
||||
unsigned int loadFlags,
|
||||
DDS_LOADER_FLAGS loadFlags,
|
||||
_Outptr_ ID3D12Resource** texture) noexcept
|
||||
{
|
||||
if (!d3dDevice)
|
||||
@ -1243,7 +1243,7 @@ namespace
|
||||
size_t bitSize,
|
||||
size_t maxsize,
|
||||
D3D12_RESOURCE_FLAGS resFlags,
|
||||
unsigned int loadFlags,
|
||||
DDS_LOADER_FLAGS loadFlags,
|
||||
_Outptr_ ID3D12Resource** texture,
|
||||
std::vector<D3D12_SUBRESOURCE_DATA>& subresources,
|
||||
_Out_opt_ bool* outIsCubeMap) noexcept(false)
|
||||
@ -1585,7 +1585,7 @@ HRESULT DirectX::LoadDDSTextureFromMemoryEx(
|
||||
size_t ddsDataSize,
|
||||
size_t maxsize,
|
||||
D3D12_RESOURCE_FLAGS resFlags,
|
||||
unsigned int loadFlags,
|
||||
DDS_LOADER_FLAGS loadFlags,
|
||||
ID3D12Resource** texture,
|
||||
std::vector<D3D12_SUBRESOURCE_DATA>& subresources,
|
||||
DDS_ALPHA_MODE* alphaMode,
|
||||
@ -1675,7 +1675,7 @@ HRESULT DirectX::LoadDDSTextureFromFileEx(
|
||||
const wchar_t* fileName,
|
||||
size_t maxsize,
|
||||
D3D12_RESOURCE_FLAGS resFlags,
|
||||
unsigned int loadFlags,
|
||||
DDS_LOADER_FLAGS loadFlags,
|
||||
ID3D12Resource** texture,
|
||||
std::unique_ptr<uint8_t[]>& ddsData,
|
||||
std::vector<D3D12_SUBRESOURCE_DATA>& subresources,
|
||||
|
@ -42,15 +42,31 @@ namespace DirectX
|
||||
DDS_ALPHA_MODE_OPAQUE = 3,
|
||||
DDS_ALPHA_MODE_CUSTOM = 4,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
enum DDS_LOADER_FLAGS
|
||||
#ifndef DDS_LOADER_FLAGS_DEFINED
|
||||
#define DDS_LOADER_FLAGS_DEFINED
|
||||
|
||||
enum DDS_LOADER_FLAGS : uint32_t
|
||||
{
|
||||
DDS_LOADER_DEFAULT = 0,
|
||||
DDS_LOADER_FORCE_SRGB = 0x1,
|
||||
DDS_LOADER_MIP_RESERVE = 0x8,
|
||||
};
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-dynamic-exception-spec"
|
||||
#endif
|
||||
|
||||
DEFINE_ENUM_FLAG_OPERATORS(DDS_LOADER_FLAGS);
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Standard version
|
||||
HRESULT __cdecl LoadDDSTextureFromMemory(
|
||||
_In_ ID3D12Device* d3dDevice,
|
||||
@ -79,7 +95,7 @@ namespace DirectX
|
||||
size_t ddsDataSize,
|
||||
size_t maxsize,
|
||||
D3D12_RESOURCE_FLAGS resFlags,
|
||||
unsigned int loadFlags,
|
||||
DDS_LOADER_FLAGS loadFlags,
|
||||
_Outptr_ ID3D12Resource** texture,
|
||||
std::vector<D3D12_SUBRESOURCE_DATA>& subresources,
|
||||
_Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr,
|
||||
@ -90,7 +106,7 @@ namespace DirectX
|
||||
_In_z_ const wchar_t* szFileName,
|
||||
size_t maxsize,
|
||||
D3D12_RESOURCE_FLAGS resFlags,
|
||||
unsigned int loadFlags,
|
||||
DDS_LOADER_FLAGS loadFlags,
|
||||
_Outptr_ ID3D12Resource** texture,
|
||||
std::unique_ptr<uint8_t[]>& ddsData,
|
||||
std::vector<D3D12_SUBRESOURCE_DATA>& subresources,
|
||||
|
@ -105,14 +105,13 @@ namespace
|
||||
//-------------------------------------------------------------------------------------
|
||||
// WIC Pixel Format nearest conversion table
|
||||
//-------------------------------------------------------------------------------------
|
||||
|
||||
struct WICConvert
|
||||
{
|
||||
const GUID& source;
|
||||
const GUID& target;
|
||||
const GUID& source;
|
||||
const GUID& target;
|
||||
};
|
||||
|
||||
constexpr WICConvert g_WICConvert[] =
|
||||
constexpr WICConvert g_WICConvert [] =
|
||||
{
|
||||
// Note target GUID in this conversion table must be one of those directly supported formats (above).
|
||||
|
||||
@ -174,7 +173,7 @@ namespace
|
||||
|
||||
bool g_WIC2 = false;
|
||||
|
||||
BOOL WINAPI InitializeWICFactory(PINIT_ONCE, PVOID, PVOID* ifactory) noexcept
|
||||
BOOL WINAPI InitializeWICFactory(PINIT_ONCE, PVOID, PVOID *ifactory) noexcept
|
||||
{
|
||||
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) || defined(_WIN7_PLATFORM_UPDATE)
|
||||
HRESULT hr = CoCreateInstance(
|
||||
@ -362,7 +361,7 @@ namespace
|
||||
_In_ unsigned int bindFlags,
|
||||
_In_ unsigned int cpuAccessFlags,
|
||||
_In_ unsigned int miscFlags,
|
||||
_In_ unsigned int loadFlags,
|
||||
_In_ WIC_LOADER_FLAGS loadFlags,
|
||||
_Outptr_opt_ ID3D11Resource** texture,
|
||||
_Outptr_opt_ ID3D11ShaderResourceView** textureView) noexcept
|
||||
{
|
||||
@ -865,7 +864,7 @@ HRESULT DirectX::CreateWICTextureFromMemoryEx(
|
||||
unsigned int bindFlags,
|
||||
unsigned int cpuAccessFlags,
|
||||
unsigned int miscFlags,
|
||||
unsigned int loadFlags,
|
||||
WIC_LOADER_FLAGS loadFlags,
|
||||
ID3D11Resource** texture,
|
||||
ID3D11ShaderResourceView** textureView) noexcept
|
||||
{
|
||||
@ -888,7 +887,7 @@ HRESULT DirectX::CreateWICTextureFromMemoryEx(
|
||||
unsigned int bindFlags,
|
||||
unsigned int cpuAccessFlags,
|
||||
unsigned int miscFlags,
|
||||
unsigned int loadFlags,
|
||||
WIC_LOADER_FLAGS loadFlags,
|
||||
ID3D11Resource** texture,
|
||||
ID3D11ShaderResourceView** textureView) noexcept
|
||||
{
|
||||
@ -1006,7 +1005,7 @@ HRESULT DirectX::CreateWICTextureFromFileEx(
|
||||
unsigned int bindFlags,
|
||||
unsigned int cpuAccessFlags,
|
||||
unsigned int miscFlags,
|
||||
unsigned int loadFlags,
|
||||
WIC_LOADER_FLAGS loadFlags,
|
||||
ID3D11Resource** texture,
|
||||
ID3D11ShaderResourceView** textureView) noexcept
|
||||
{
|
||||
@ -1028,7 +1027,7 @@ HRESULT DirectX::CreateWICTextureFromFileEx(
|
||||
unsigned int bindFlags,
|
||||
unsigned int cpuAccessFlags,
|
||||
unsigned int miscFlags,
|
||||
unsigned int loadFlags,
|
||||
WIC_LOADER_FLAGS loadFlags,
|
||||
ID3D11Resource** texture,
|
||||
ID3D11ShaderResourceView** textureView) noexcept
|
||||
{
|
||||
|
@ -42,6 +42,17 @@ namespace DirectX
|
||||
WIC_LOADER_MAKE_SQUARE = 0x40,
|
||||
WIC_LOADER_FORCE_RGBA32 = 0x80,
|
||||
};
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-dynamic-exception-spec"
|
||||
#endif
|
||||
|
||||
DEFINE_ENUM_FLAG_OPERATORS(WIC_LOADER_FLAGS);
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Standard version
|
||||
@ -88,7 +99,7 @@ namespace DirectX
|
||||
_In_ unsigned int bindFlags,
|
||||
_In_ unsigned int cpuAccessFlags,
|
||||
_In_ unsigned int miscFlags,
|
||||
_In_ unsigned int loadFlags,
|
||||
_In_ WIC_LOADER_FLAGS loadFlags,
|
||||
_Outptr_opt_ ID3D11Resource** texture,
|
||||
_Outptr_opt_ ID3D11ShaderResourceView** textureView) noexcept;
|
||||
|
||||
@ -100,7 +111,7 @@ namespace DirectX
|
||||
_In_ unsigned int bindFlags,
|
||||
_In_ unsigned int cpuAccessFlags,
|
||||
_In_ unsigned int miscFlags,
|
||||
_In_ unsigned int loadFlags,
|
||||
_In_ WIC_LOADER_FLAGS loadFlags,
|
||||
_Outptr_opt_ ID3D11Resource** texture,
|
||||
_Outptr_opt_ ID3D11ShaderResourceView** textureView) noexcept;
|
||||
|
||||
@ -115,7 +126,7 @@ namespace DirectX
|
||||
_In_ unsigned int bindFlags,
|
||||
_In_ unsigned int cpuAccessFlags,
|
||||
_In_ unsigned int miscFlags,
|
||||
_In_ unsigned int loadFlags,
|
||||
_In_ WIC_LOADER_FLAGS loadFlags,
|
||||
_Outptr_opt_ ID3D11Resource** texture,
|
||||
_Outptr_opt_ ID3D11ShaderResourceView** textureView) noexcept;
|
||||
|
||||
@ -128,7 +139,7 @@ namespace DirectX
|
||||
_In_ unsigned int bindFlags,
|
||||
_In_ unsigned int cpuAccessFlags,
|
||||
_In_ unsigned int miscFlags,
|
||||
_In_ unsigned int loadFlags,
|
||||
_In_ WIC_LOADER_FLAGS loadFlags,
|
||||
_Outptr_opt_ ID3D11Resource** texture,
|
||||
_Outptr_opt_ ID3D11ShaderResourceView** textureView) noexcept;
|
||||
}
|
||||
|
@ -94,14 +94,13 @@ namespace
|
||||
//-------------------------------------------------------------------------------------
|
||||
// WIC Pixel Format nearest conversion table
|
||||
//-------------------------------------------------------------------------------------
|
||||
|
||||
struct WICConvert
|
||||
{
|
||||
const GUID& source;
|
||||
const GUID& target;
|
||||
const GUID& source;
|
||||
const GUID& target;
|
||||
};
|
||||
|
||||
constexpr WICConvert g_WICConvert[] =
|
||||
constexpr WICConvert g_WICConvert [] =
|
||||
{
|
||||
// Note target GUID in this conversion table must be one of those directly supported formats (above).
|
||||
|
||||
@ -683,7 +682,7 @@ HRESULT DirectX::LoadWICTextureFromMemoryEx(
|
||||
size_t wicDataSize,
|
||||
size_t maxsize,
|
||||
D3D12_RESOURCE_FLAGS resFlags,
|
||||
unsigned int loadFlags,
|
||||
WIC_LOADER_FLAGS loadFlags,
|
||||
ID3D12Resource** texture,
|
||||
std::unique_ptr<uint8_t[]>& decodedData,
|
||||
D3D12_SUBRESOURCE_DATA& subresource) noexcept
|
||||
@ -770,7 +769,7 @@ HRESULT DirectX::LoadWICTextureFromFileEx(
|
||||
const wchar_t* fileName,
|
||||
size_t maxsize,
|
||||
D3D12_RESOURCE_FLAGS resFlags,
|
||||
unsigned int loadFlags,
|
||||
WIC_LOADER_FLAGS loadFlags,
|
||||
ID3D12Resource** texture,
|
||||
std::unique_ptr<uint8_t[]>& decodedData,
|
||||
D3D12_SUBRESOURCE_DATA& subresource) noexcept
|
||||
|
@ -43,6 +43,17 @@ namespace DirectX
|
||||
WIC_LOADER_MAKE_SQUARE = 0x40,
|
||||
WIC_LOADER_FORCE_RGBA32 = 0x80,
|
||||
};
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-dynamic-exception-spec"
|
||||
#endif
|
||||
|
||||
DEFINE_ENUM_FLAG_OPERATORS(WIC_LOADER_FLAGS);
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Standard version
|
||||
@ -70,7 +81,7 @@ namespace DirectX
|
||||
size_t wicDataSize,
|
||||
size_t maxsize,
|
||||
D3D12_RESOURCE_FLAGS resFlags,
|
||||
unsigned int loadFlags,
|
||||
WIC_LOADER_FLAGS loadFlags,
|
||||
_Outptr_ ID3D12Resource** texture,
|
||||
std::unique_ptr<uint8_t[]>& decodedData,
|
||||
D3D12_SUBRESOURCE_DATA& subresource) noexcept;
|
||||
@ -80,7 +91,7 @@ namespace DirectX
|
||||
_In_z_ const wchar_t* szFileName,
|
||||
size_t maxsize,
|
||||
D3D12_RESOURCE_FLAGS resFlags,
|
||||
unsigned int loadFlags,
|
||||
WIC_LOADER_FLAGS loadFlags,
|
||||
_Outptr_ ID3D12Resource** texture,
|
||||
std::unique_ptr<uint8_t[]>& decodedData,
|
||||
D3D12_SUBRESOURCE_DATA& subresource) noexcept;
|
||||
|
@ -86,14 +86,13 @@ namespace
|
||||
//-------------------------------------------------------------------------------------
|
||||
// WIC Pixel Format nearest conversion table
|
||||
//-------------------------------------------------------------------------------------
|
||||
|
||||
struct WICConvert
|
||||
{
|
||||
const GUID& source;
|
||||
const GUID& target;
|
||||
const GUID& source;
|
||||
const GUID& target;
|
||||
};
|
||||
|
||||
constexpr WICConvert g_WICConvert[] =
|
||||
constexpr WICConvert g_WICConvert [] =
|
||||
{
|
||||
// Note target GUID in this conversion table must be one of those directly supported formats (above).
|
||||
|
||||
@ -272,7 +271,7 @@ namespace
|
||||
_In_ size_t maxsize,
|
||||
_In_ DWORD usage,
|
||||
_In_ D3DPOOL pool,
|
||||
_In_ unsigned int loadFlags,
|
||||
_In_ WIC_LOADER_FLAGS loadFlags,
|
||||
_Outptr_ LPDIRECT3DTEXTURE9* texture) noexcept
|
||||
{
|
||||
UINT width, height;
|
||||
@ -536,7 +535,7 @@ HRESULT DirectX::CreateWICTextureFromMemory(
|
||||
size_t wicDataSize,
|
||||
LPDIRECT3DTEXTURE9* texture,
|
||||
size_t maxsize,
|
||||
unsigned int loadFlags) noexcept
|
||||
WIC_LOADER_FLAGS loadFlags) noexcept
|
||||
{
|
||||
return CreateWICTextureFromMemoryEx(d3dDevice, wicData, wicDataSize, maxsize, 0u, D3DPOOL_DEFAULT, loadFlags, texture);
|
||||
}
|
||||
@ -550,7 +549,7 @@ HRESULT DirectX::CreateWICTextureFromMemoryEx(
|
||||
_In_ size_t maxsize,
|
||||
_In_ DWORD usage,
|
||||
_In_ D3DPOOL pool,
|
||||
_In_ unsigned int loadFlags,
|
||||
_In_ WIC_LOADER_FLAGS loadFlags,
|
||||
LPDIRECT3DTEXTURE9* texture) noexcept
|
||||
{
|
||||
if (texture)
|
||||
@ -602,7 +601,7 @@ HRESULT DirectX::CreateWICTextureFromFile(
|
||||
const wchar_t* fileName,
|
||||
LPDIRECT3DTEXTURE9* texture,
|
||||
size_t maxsize,
|
||||
unsigned int loadFlags) noexcept
|
||||
WIC_LOADER_FLAGS loadFlags) noexcept
|
||||
{
|
||||
return CreateWICTextureFromFileEx(d3dDevice, fileName, maxsize, 0u, D3DPOOL_DEFAULT, loadFlags, texture);
|
||||
}
|
||||
@ -614,7 +613,7 @@ HRESULT DirectX::CreateWICTextureFromFileEx(
|
||||
size_t maxsize,
|
||||
DWORD usage,
|
||||
D3DPOOL pool,
|
||||
unsigned int loadFlags,
|
||||
WIC_LOADER_FLAGS loadFlags,
|
||||
LPDIRECT3DTEXTURE9* texture) noexcept
|
||||
{
|
||||
if (texture)
|
||||
|
@ -39,6 +39,17 @@ namespace DirectX
|
||||
WIC_LOADER_MAKE_SQUARE = 0x40,
|
||||
WIC_LOADER_FORCE_RGBA32 = 0x80,
|
||||
};
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-dynamic-exception-spec"
|
||||
#endif
|
||||
|
||||
DEFINE_ENUM_FLAG_OPERATORS(WIC_LOADER_FLAGS);
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Standard version
|
||||
@ -48,14 +59,14 @@ namespace DirectX
|
||||
_In_ size_t wicDataSize,
|
||||
_Outptr_ LPDIRECT3DTEXTURE9* texture,
|
||||
_In_ size_t maxsize = 0,
|
||||
_In_ unsigned int loadFlags = 0) noexcept;
|
||||
_In_ WIC_LOADER_FLAGS loadFlags = WIC_LOADER_DEFAULT) noexcept;
|
||||
|
||||
HRESULT CreateWICTextureFromFile(
|
||||
_In_ LPDIRECT3DDEVICE9 d3dDevice,
|
||||
_In_z_ const wchar_t* fileName,
|
||||
_Outptr_ LPDIRECT3DTEXTURE9* texture,
|
||||
_In_ size_t maxsize = 0,
|
||||
_In_ unsigned int loadFlags = 0) noexcept;
|
||||
_In_ WIC_LOADER_FLAGS loadFlags = WIC_LOADER_DEFAULT) noexcept;
|
||||
|
||||
// Extended version
|
||||
HRESULT CreateWICTextureFromMemoryEx(
|
||||
@ -65,7 +76,7 @@ namespace DirectX
|
||||
_In_ size_t maxsize,
|
||||
_In_ DWORD usage,
|
||||
_In_ D3DPOOL pool,
|
||||
_In_ unsigned int loadFlags,
|
||||
_In_ WIC_LOADER_FLAGS loadFlags,
|
||||
_Outptr_ LPDIRECT3DTEXTURE9* texture) noexcept;
|
||||
|
||||
HRESULT CreateWICTextureFromFileEx(
|
||||
@ -74,6 +85,6 @@ namespace DirectX
|
||||
_In_ size_t maxsize,
|
||||
_In_ DWORD usage,
|
||||
_In_ D3DPOOL pool,
|
||||
_In_ unsigned int loadFlags,
|
||||
_In_ WIC_LOADER_FLAGS loadFlags,
|
||||
_Outptr_ LPDIRECT3DTEXTURE9* texture) noexcept;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user