Made DDS_LOADER_FLAGS and WIC_LOADER_FLAGS strongly typed

This commit is contained in:
Chuck Walbourn 2020-05-29 02:06:28 -07:00
Родитель 710dc38e9f
Коммит d7e2964676
8 изменённых файлов: 68 добавлений и 29 удалений

Просмотреть файл

@ -116,7 +116,7 @@ namespace DirectX
if (eng->GetChannelMask() & SPEAKER_LOW_FREQUENCY)
mFlags = flags | SoundEffectInstance_UseRedirectLFE;
else
mFlags = static_cast<SOUND_EFFECT_INSTANCE_FLAGS>(static_cast<unsigned int>(flags) & ~static_cast<unsigned int>(SoundEffectInstance_UseRedirectLFE));
mFlags = flags & ~SoundEffectInstance_UseRedirectLFE;
memset(&mDSPSettings, 0, sizeof(X3DAUDIO_DSP_SETTINGS));
assert(wfx != nullptr);
@ -315,7 +315,7 @@ namespace DirectX
if (engine->GetChannelMask() & SPEAKER_LOW_FREQUENCY)
mFlags = mFlags | SoundEffectInstance_UseRedirectLFE;
else
mFlags = static_cast<SOUND_EFFECT_INSTANCE_FLAGS>(static_cast<unsigned int>(mFlags) & ~static_cast<unsigned int>(SoundEffectInstance_UseRedirectLFE));
mFlags = mFlags & ~SoundEffectInstance_UseRedirectLFE;
mDSPSettings.DstChannelCount = engine->GetOutputChannels();
}

Просмотреть файл

@ -132,8 +132,6 @@ namespace DirectX
AudioEngine_DisableVoiceReuse = 0x40000,
};
inline AUDIO_ENGINE_FLAGS operator|(AUDIO_ENGINE_FLAGS a, AUDIO_ENGINE_FLAGS b) noexcept { return static_cast<AUDIO_ENGINE_FLAGS>( static_cast<int>(a) | static_cast<int>(b) ); }
enum SOUND_EFFECT_INSTANCE_FLAGS : uint32_t
{
SoundEffectInstance_Default = 0x0,
@ -145,8 +143,6 @@ namespace DirectX
SoundEffectInstance_UseRedirectLFE = 0x10000,
};
inline SOUND_EFFECT_INSTANCE_FLAGS operator|(SOUND_EFFECT_INSTANCE_FLAGS a, SOUND_EFFECT_INSTANCE_FLAGS b) noexcept { return static_cast<SOUND_EFFECT_INSTANCE_FLAGS>(static_cast<int>(a) | static_cast<int>(b)); }
enum AUDIO_ENGINE_REVERB : unsigned int
{
Reverb_Off,
@ -738,4 +734,16 @@ namespace DirectX
std::unique_ptr<Impl> pImpl;
};
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-dynamic-exception-spec"
#endif
DEFINE_ENUM_FLAG_OPERATORS(AUDIO_ENGINE_FLAGS);
DEFINE_ENUM_FLAG_OPERATORS(SOUND_EFFECT_INSTANCE_FLAGS);
#ifdef __clang__
#pragma clang diagnostic pop
#endif
}

Просмотреть файл

@ -100,7 +100,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,
@ -111,7 +111,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,
@ -126,7 +126,7 @@ namespace DirectX
size_t ddsDataSize,
size_t maxsize,
D3D12_RESOURCE_FLAGS resFlags,
unsigned int loadFlags,
DDS_LOADER_FLAGS loadFlags,
_Outptr_ ID3D12Resource** texture,
_Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr,
_Out_opt_ bool* isCubeMap = nullptr);
@ -137,8 +137,19 @@ 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,
_Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr,
_Out_opt_ bool* isCubeMap = nullptr);
#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
}

Просмотреть файл

@ -51,8 +51,6 @@ namespace DirectX
ModelLoader_AllowLargeModels = 0x2,
};
inline ModelLoaderFlags operator|(ModelLoaderFlags a, ModelLoaderFlags b) noexcept { return static_cast<ModelLoaderFlags>(static_cast<int>(a) | static_cast<int>(b)); }
//----------------------------------------------------------------------------------
// Each mesh part is a submesh with a single effect
class ModelMeshPart
@ -350,4 +348,15 @@ namespace DirectX
int samplerDescriptorOffset,
_In_ const ModelMeshPart* part) const;
};
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-dynamic-exception-spec"
#endif
DEFINE_ENUM_FLAG_OPERATORS(ModelLoaderFlags);
#ifdef __clang__
#pragma clang diagnostic pop
#endif
}

Просмотреть файл

@ -90,7 +90,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;
@ -100,7 +100,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;
@ -113,7 +113,7 @@ namespace DirectX
size_t wicDataSize,
size_t maxsize,
D3D12_RESOURCE_FLAGS resFlags,
unsigned int loadFlags,
WIC_LOADER_FLAGS loadFlags,
_Outptr_ ID3D12Resource** texture);
HRESULT __cdecl CreateWICTextureFromFileEx(
@ -122,6 +122,17 @@ 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);
#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
}

Просмотреть файл

@ -227,7 +227,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)
@ -278,7 +278,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)
@ -623,7 +623,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,
@ -713,7 +713,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,
@ -804,7 +804,7 @@ HRESULT DirectX::CreateDDSTextureFromMemoryEx(
size_t ddsDataSize,
size_t maxsize,
D3D12_RESOURCE_FLAGS resFlags,
unsigned int loadFlags,
DDS_LOADER_FLAGS loadFlags,
ID3D12Resource** texture,
DDS_ALPHA_MODE* alphaMode,
bool* isCubeMap)
@ -922,7 +922,7 @@ HRESULT DirectX::CreateDDSTextureFromFileEx(
const wchar_t* fileName,
size_t maxsize,
D3D12_RESOURCE_FLAGS resFlags,
unsigned int loadFlags,
DDS_LOADER_FLAGS loadFlags,
ID3D12Resource** texture,
DDS_ALPHA_MODE* alphaMode,
bool* isCubeMap)

Просмотреть файл

@ -130,7 +130,7 @@ size_t EffectTextureFactory::Impl::CreateTexture(_In_z_ const wchar_t* name, int
wchar_t ext[_MAX_EXT];
_wsplitpath_s(name, nullptr, 0, nullptr, 0, nullptr, 0, ext, _MAX_EXT);
unsigned int loadFlags = DDS_LOADER_DEFAULT;
DDS_LOADER_FLAGS loadFlags = DDS_LOADER_DEFAULT;
if (mForceSRGB)
loadFlags |= DDS_LOADER_FORCE_SRGB;
if (mAutoGenMips)
@ -170,7 +170,7 @@ size_t EffectTextureFactory::Impl::CreateTexture(_In_z_ const wchar_t* name, int
fullName,
0u,
D3D12_RESOURCE_FLAG_NONE,
loadFlags,
static_cast<WIC_LOADER_FLAGS>(loadFlags),
textureEntry.mResource.ReleaseAndGetAddressOf());
if (FAILED(hr))
{

Просмотреть файл

@ -224,7 +224,7 @@ namespace
_In_ IWICBitmapFrameDecode *frame,
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
@ -632,7 +632,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
@ -697,7 +697,7 @@ HRESULT DirectX::CreateWICTextureFromMemoryEx(
size_t wicDataSize,
size_t maxsize,
D3D12_RESOURCE_FLAGS resFlags,
unsigned int loadFlags,
WIC_LOADER_FLAGS loadFlags,
ID3D12Resource** texture)
{
if (texture)
@ -832,7 +832,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
@ -883,7 +883,7 @@ HRESULT DirectX::CreateWICTextureFromFileEx(
const wchar_t* fileName,
size_t maxsize,
D3D12_RESOURCE_FLAGS resFlags,
unsigned int loadFlags,
WIC_LOADER_FLAGS loadFlags,
ID3D12Resource** texture)
{
if (texture)