From dbaaffbefb734d199e3ef842ad6afee8189a1d76 Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Tue, 10 Mar 2020 01:05:10 -0700 Subject: [PATCH] Code review feedback for standalone texture loaders --- DDSTextureLoader/DDSTextureLoader.cpp | 54 ++++++++++++------------- DDSTextureLoader/DDSTextureLoader.h | 19 ++++----- DDSTextureLoader/DDSTextureLoader12.cpp | 36 +++++++++-------- DDSTextureLoader/DDSTextureLoader12.h | 2 +- ScreenGrab/ScreenGrab.cpp | 34 ++++++++-------- ScreenGrab/ScreenGrab.h | 4 +- ScreenGrab/ScreenGrab12.cpp | 28 ++++++------- ScreenGrab/ScreenGrab12.h | 4 +- WICTextureLoader/WICTextureLoader.cpp | 47 ++++++++++----------- WICTextureLoader/WICTextureLoader.h | 21 +++++----- WICTextureLoader/WICTextureLoader12.cpp | 24 +++++------ WICTextureLoader/WICTextureLoader12.h | 13 +++--- 12 files changed, 145 insertions(+), 141 deletions(-) diff --git a/DDSTextureLoader/DDSTextureLoader.cpp b/DDSTextureLoader/DDSTextureLoader.cpp index d7e42c8..92ff045 100644 --- a/DDSTextureLoader/DDSTextureLoader.cpp +++ b/DDSTextureLoader/DDSTextureLoader.cpp @@ -119,7 +119,7 @@ namespace { struct handle_closer { void operator()(HANDLE h) { if (h) CloseHandle(h); } }; - typedef std::unique_ptr ScopedHandle; + using ScopedHandle = std::unique_ptr; inline HANDLE safe_handle( HANDLE h ) { return (h == INVALID_HANDLE_VALUE) ? nullptr : h; } @@ -140,7 +140,7 @@ namespace size_t ddsDataSize, const DDS_HEADER** header, const uint8_t** bitData, - size_t* bitSize) + size_t* bitSize) noexcept { if (!header || !bitData || !bitSize) { @@ -205,7 +205,7 @@ namespace std::unique_ptr& ddsData, const DDS_HEADER** header, const uint8_t** bitData, - size_t* bitSize) + size_t* bitSize) noexcept { if (!header || !bitData || !bitSize) { @@ -321,7 +321,7 @@ namespace //-------------------------------------------------------------------------------------- // Return the BPP for a particular format //-------------------------------------------------------------------------------------- - size_t BitsPerPixel(_In_ DXGI_FORMAT fmt) + size_t BitsPerPixel(_In_ DXGI_FORMAT fmt) noexcept { switch (fmt) { @@ -477,7 +477,7 @@ namespace _In_ DXGI_FORMAT fmt, size_t* outNumBytes, _Out_opt_ size_t* outRowBytes, - _Out_opt_ size_t* outNumRows) + _Out_opt_ size_t* outNumRows) noexcept { uint64_t numBytes = 0; uint64_t rowBytes = 0; @@ -620,7 +620,7 @@ namespace //-------------------------------------------------------------------------------------- #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) + DXGI_FORMAT GetDXGIFormat(const DDS_PIXELFORMAT& ddpf) noexcept { if (ddpf.flags & DDS_RGB) { @@ -861,7 +861,7 @@ namespace //-------------------------------------------------------------------------------------- - DXGI_FORMAT MakeSRGB(_In_ DXGI_FORMAT format) + DXGI_FORMAT MakeSRGB(_In_ DXGI_FORMAT format) noexcept { switch (format) { @@ -907,7 +907,7 @@ namespace _Out_ size_t& theight, _Out_ size_t& tdepth, _Out_ size_t& skipMip, - _Out_writes_(mipCount*arraySize) D3D11_SUBRESOURCE_DATA* initData) + _Out_writes_(mipCount*arraySize) D3D11_SUBRESOURCE_DATA* initData) noexcept { if (!bitData || !initData) { @@ -1008,7 +1008,7 @@ namespace _In_ bool isCubeMap, _In_reads_opt_(mipCount*arraySize) D3D11_SUBRESOURCE_DATA* initData, _Outptr_opt_ ID3D11Resource** texture, - _Outptr_opt_ ID3D11ShaderResourceView** textureView) + _Outptr_opt_ ID3D11ShaderResourceView** textureView) noexcept { if (!d3dDevice) return E_POINTER; @@ -1238,7 +1238,7 @@ namespace _In_ unsigned int miscFlags, _In_ bool forceSRGB, _Outptr_opt_ ID3D11Resource** texture, - _Outptr_opt_ ID3D11ShaderResourceView** textureView) + _Outptr_opt_ ID3D11ShaderResourceView** textureView) noexcept { HRESULT hr = S_OK; @@ -1553,26 +1553,26 @@ namespace case D3D_FEATURE_LEVEL_9_2: if (isCubeMap) { - maxsize = 512 /*D3D_FL9_1_REQ_TEXTURECUBE_DIMENSION*/; + maxsize = 512u /*D3D_FL9_1_REQ_TEXTURECUBE_DIMENSION*/; } else { maxsize = (resDim == D3D11_RESOURCE_DIMENSION_TEXTURE3D) - ? 256 /*D3D_FL9_1_REQ_TEXTURE3D_U_V_OR_W_DIMENSION*/ - : 2048 /*D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION*/; + ? 256u /*D3D_FL9_1_REQ_TEXTURE3D_U_V_OR_W_DIMENSION*/ + : 2048u /*D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION*/; } break; case D3D_FEATURE_LEVEL_9_3: maxsize = (resDim == D3D11_RESOURCE_DIMENSION_TEXTURE3D) - ? 256 /*D3D_FL9_1_REQ_TEXTURE3D_U_V_OR_W_DIMENSION*/ - : 4096 /*D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION*/; + ? 256u /*D3D_FL9_1_REQ_TEXTURE3D_U_V_OR_W_DIMENSION*/ + : 4096u /*D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION*/; break; default: // D3D_FEATURE_LEVEL_10_0 & D3D_FEATURE_LEVEL_10_1 maxsize = (resDim == D3D11_RESOURCE_DIMENSION_TEXTURE3D) - ? 2048 /*D3D10_REQ_TEXTURE3D_U_V_OR_W_DIMENSION*/ - : 8192 /*D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION*/; + ? 2048u /*D3D10_REQ_TEXTURE3D_U_V_OR_W_DIMENSION*/ + : 8192u /*D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION*/; break; } @@ -1598,7 +1598,7 @@ namespace //-------------------------------------------------------------------------------------- - DDS_ALPHA_MODE GetAlphaMode(_In_ const DDS_HEADER* header) + DDS_ALPHA_MODE GetAlphaMode(_In_ const DDS_HEADER* header) noexcept { if (header->ddspf.flags & DDS_FOURCC) { @@ -1633,7 +1633,7 @@ namespace void SetDebugTextureInfo( _In_z_ const wchar_t* fileName, _In_opt_ ID3D11Resource** texture, - _In_opt_ ID3D11ShaderResourceView** textureView) + _In_opt_ ID3D11ShaderResourceView** textureView) noexcept { #if !defined(NO_D3D11_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) ) if (texture || textureView) @@ -1694,7 +1694,7 @@ HRESULT DirectX::CreateDDSTextureFromMemory( ID3D11Resource** texture, ID3D11ShaderResourceView** textureView, size_t maxsize, - DDS_ALPHA_MODE* alphaMode) + DDS_ALPHA_MODE* alphaMode) noexcept { return CreateDDSTextureFromMemoryEx(d3dDevice, nullptr, ddsData, ddsDataSize, @@ -1713,7 +1713,7 @@ HRESULT DirectX::CreateDDSTextureFromMemory( ID3D11Resource** texture, ID3D11ShaderResourceView** textureView, size_t maxsize, - DDS_ALPHA_MODE* alphaMode) + DDS_ALPHA_MODE* alphaMode) noexcept { return CreateDDSTextureFromMemoryEx(d3dDevice, d3dContext, ddsData, ddsDataSize, @@ -1736,7 +1736,7 @@ HRESULT DirectX::CreateDDSTextureFromMemoryEx( bool forceSRGB, ID3D11Resource** texture, ID3D11ShaderResourceView** textureView, - DDS_ALPHA_MODE* alphaMode) + DDS_ALPHA_MODE* alphaMode) noexcept { return CreateDDSTextureFromMemoryEx(d3dDevice, nullptr, ddsData, ddsDataSize, @@ -1760,7 +1760,7 @@ HRESULT DirectX::CreateDDSTextureFromMemoryEx( bool forceSRGB, ID3D11Resource** texture, ID3D11ShaderResourceView** textureView, - DDS_ALPHA_MODE* alphaMode) + DDS_ALPHA_MODE* alphaMode) noexcept { if (texture) { @@ -1833,7 +1833,7 @@ HRESULT DirectX::CreateDDSTextureFromFile( ID3D11Resource** texture, ID3D11ShaderResourceView** textureView, size_t maxsize, - DDS_ALPHA_MODE* alphaMode) + DDS_ALPHA_MODE* alphaMode) noexcept { return CreateDDSTextureFromFileEx(d3dDevice, nullptr, fileName, maxsize, @@ -1850,7 +1850,7 @@ HRESULT DirectX::CreateDDSTextureFromFile( ID3D11Resource** texture, ID3D11ShaderResourceView** textureView, size_t maxsize, - DDS_ALPHA_MODE* alphaMode) + DDS_ALPHA_MODE* alphaMode) noexcept { return CreateDDSTextureFromFileEx(d3dDevice, d3dContext, fileName, @@ -1872,7 +1872,7 @@ HRESULT DirectX::CreateDDSTextureFromFileEx( bool forceSRGB, ID3D11Resource** texture, ID3D11ShaderResourceView** textureView, - DDS_ALPHA_MODE* alphaMode) + DDS_ALPHA_MODE* alphaMode) noexcept { return CreateDDSTextureFromFileEx(d3dDevice, nullptr, fileName, @@ -1895,7 +1895,7 @@ HRESULT DirectX::CreateDDSTextureFromFileEx( bool forceSRGB, ID3D11Resource** texture, ID3D11ShaderResourceView** textureView, - DDS_ALPHA_MODE* alphaMode) + DDS_ALPHA_MODE* alphaMode) noexcept { if (texture) { diff --git a/DDSTextureLoader/DDSTextureLoader.h b/DDSTextureLoader/DDSTextureLoader.h index 69a2249..23eb8f1 100644 --- a/DDSTextureLoader/DDSTextureLoader.h +++ b/DDSTextureLoader/DDSTextureLoader.h @@ -17,7 +17,8 @@ #pragma once #include -#include + +#include namespace DirectX @@ -42,7 +43,7 @@ namespace DirectX _Outptr_opt_ ID3D11Resource** texture, _Outptr_opt_ ID3D11ShaderResourceView** textureView, _In_ size_t maxsize = 0, - _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr); + _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr) noexcept; HRESULT CreateDDSTextureFromFile( _In_ ID3D11Device* d3dDevice, @@ -50,7 +51,7 @@ namespace DirectX _Outptr_opt_ ID3D11Resource** texture, _Outptr_opt_ ID3D11ShaderResourceView** textureView, _In_ size_t maxsize = 0, - _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr); + _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr) noexcept; // Standard version with optional auto-gen mipmap support HRESULT CreateDDSTextureFromMemory( @@ -61,7 +62,7 @@ namespace DirectX _Outptr_opt_ ID3D11Resource** texture, _Outptr_opt_ ID3D11ShaderResourceView** textureView, _In_ size_t maxsize = 0, - _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr); + _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr) noexcept; HRESULT CreateDDSTextureFromFile( _In_ ID3D11Device* d3dDevice, @@ -70,7 +71,7 @@ namespace DirectX _Outptr_opt_ ID3D11Resource** texture, _Outptr_opt_ ID3D11ShaderResourceView** textureView, _In_ size_t maxsize = 0, - _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr); + _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr) noexcept; // Extended version HRESULT CreateDDSTextureFromMemoryEx( @@ -85,7 +86,7 @@ namespace DirectX _In_ bool forceSRGB, _Outptr_opt_ ID3D11Resource** texture, _Outptr_opt_ ID3D11ShaderResourceView** textureView, - _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr); + _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr) noexcept; HRESULT CreateDDSTextureFromFileEx( _In_ ID3D11Device* d3dDevice, @@ -98,7 +99,7 @@ namespace DirectX _In_ bool forceSRGB, _Outptr_opt_ ID3D11Resource** texture, _Outptr_opt_ ID3D11ShaderResourceView** textureView, - _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr); + _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr) noexcept; // Extended version with optional auto-gen mipmap support HRESULT CreateDDSTextureFromMemoryEx( @@ -114,7 +115,7 @@ namespace DirectX _In_ bool forceSRGB, _Outptr_opt_ ID3D11Resource** texture, _Outptr_opt_ ID3D11ShaderResourceView** textureView, - _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr); + _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr) noexcept; HRESULT CreateDDSTextureFromFileEx( _In_ ID3D11Device* d3dDevice, @@ -128,5 +129,5 @@ namespace DirectX _In_ bool forceSRGB, _Outptr_opt_ ID3D11Resource** texture, _Outptr_opt_ ID3D11ShaderResourceView** textureView, - _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr); + _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr) noexcept; } diff --git a/DDSTextureLoader/DDSTextureLoader12.cpp b/DDSTextureLoader/DDSTextureLoader12.cpp index 7adae17..26b49d7 100644 --- a/DDSTextureLoader/DDSTextureLoader12.cpp +++ b/DDSTextureLoader/DDSTextureLoader12.cpp @@ -124,7 +124,7 @@ namespace { struct handle_closer { void operator()(HANDLE h) { if (h) CloseHandle(h); } }; - typedef std::unique_ptr ScopedHandle; + using ScopedHandle = std::unique_ptr; inline HANDLE safe_handle(HANDLE h) { return (h == INVALID_HANDLE_VALUE) ? nullptr : h; } @@ -139,7 +139,7 @@ namespace #endif } - inline uint32_t CountMips(uint32_t width, uint32_t height) + inline uint32_t CountMips(uint32_t width, uint32_t height) noexcept { if (width == 0 || height == 0) return 0; @@ -161,7 +161,7 @@ namespace size_t ddsDataSize, const DDS_HEADER** header, const uint8_t** bitData, - size_t* bitSize) + size_t* bitSize) noexcept { if (!header || !bitData || !bitSize) { @@ -226,7 +226,7 @@ namespace std::unique_ptr& ddsData, const DDS_HEADER** header, const uint8_t** bitData, - size_t* bitSize) + size_t* bitSize) noexcept { if (!header || !bitData || !bitSize) { @@ -332,7 +332,7 @@ namespace //-------------------------------------------------------------------------------------- // Return the BPP for a particular format //-------------------------------------------------------------------------------------- - size_t BitsPerPixel( _In_ DXGI_FORMAT fmt ) + size_t BitsPerPixel( _In_ DXGI_FORMAT fmt ) noexcept { switch( fmt ) { @@ -491,7 +491,7 @@ namespace _In_ DXGI_FORMAT fmt, size_t* outNumBytes, _Out_opt_ size_t* outRowBytes, - _Out_opt_ size_t* outNumRows) + _Out_opt_ size_t* outNumRows) noexcept { uint64_t numBytes = 0; uint64_t rowBytes = 0; @@ -635,7 +635,7 @@ namespace //-------------------------------------------------------------------------------------- #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 ) + DXGI_FORMAT GetDXGIFormat( const DDS_PIXELFORMAT& ddpf ) noexcept { if (ddpf.flags & DDS_RGB) { @@ -876,7 +876,7 @@ namespace //-------------------------------------------------------------------------------------- - DXGI_FORMAT MakeSRGB( _In_ DXGI_FORMAT format ) + DXGI_FORMAT MakeSRGB( _In_ DXGI_FORMAT format ) noexcept { switch( format ) { @@ -908,7 +908,7 @@ namespace //-------------------------------------------------------------------------------------- - inline bool IsDepthStencil(DXGI_FORMAT fmt) + inline bool IsDepthStencil(DXGI_FORMAT fmt) noexcept { switch (fmt) { @@ -935,7 +935,7 @@ namespace _In_ DXGI_FORMAT fmt, _In_ size_t height, _In_ size_t slicePlane, - _Inout_ D3D12_SUBRESOURCE_DATA& res) + _Inout_ D3D12_SUBRESOURCE_DATA& res) noexcept { switch (fmt) { @@ -1092,7 +1092,7 @@ namespace DXGI_FORMAT format, D3D12_RESOURCE_FLAGS resFlags, unsigned int loadFlags, - _Outptr_ ID3D12Resource** texture) + _Outptr_ ID3D12Resource** texture) noexcept { if (!d3dDevice) return E_POINTER; @@ -1144,7 +1144,7 @@ namespace unsigned int loadFlags, _Outptr_ ID3D12Resource** texture, std::vector& subresources, - _Out_opt_ bool* outIsCubeMap) + _Out_opt_ bool* outIsCubeMap) noexcept(false) { HRESULT hr = S_OK; @@ -1364,9 +1364,10 @@ namespace { subresources.clear(); - maxsize = (resDim == D3D12_RESOURCE_DIMENSION_TEXTURE3D) + maxsize = static_cast( + (resDim == D3D12_RESOURCE_DIMENSION_TEXTURE3D) ? D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION - : D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION; + : D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION); hr = FillInitData(width, height, depth, mipCount, arraySize, numberOfPlanes, format, @@ -1389,7 +1390,7 @@ namespace } //-------------------------------------------------------------------------------------- - DDS_ALPHA_MODE GetAlphaMode( _In_ const DDS_HEADER* header ) + DDS_ALPHA_MODE GetAlphaMode( _In_ const DDS_HEADER* header ) noexcept { if ( header->ddspf.flags & DDS_FOURCC ) { @@ -1423,7 +1424,7 @@ namespace //-------------------------------------------------------------------------------------- void SetDebugTextureInfo( _In_z_ const wchar_t* fileName, - _In_ ID3D12Resource** texture) + _In_ ID3D12Resource** texture) noexcept { #if !defined(NO_D3D12_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) ) if (texture) @@ -1513,7 +1514,8 @@ HRESULT DirectX::LoadDDSTextureFromMemoryEx( const uint8_t* bitData = nullptr; size_t bitSize = 0; - HRESULT hr = LoadTextureDataFromMemory(ddsData, ddsDataSize, + HRESULT hr = LoadTextureDataFromMemory(ddsData, + ddsDataSize, &header, &bitData, &bitSize diff --git a/DDSTextureLoader/DDSTextureLoader12.h b/DDSTextureLoader/DDSTextureLoader12.h index 3e1e925..92986b0 100644 --- a/DDSTextureLoader/DDSTextureLoader12.h +++ b/DDSTextureLoader/DDSTextureLoader12.h @@ -18,9 +18,9 @@ #include +#include #include #include -#include namespace DirectX diff --git a/ScreenGrab/ScreenGrab.cpp b/ScreenGrab/ScreenGrab.cpp index 78bf6e8..3b5b4a3 100644 --- a/ScreenGrab/ScreenGrab.cpp +++ b/ScreenGrab/ScreenGrab.cpp @@ -82,7 +82,7 @@ namespace #define DDS_SURFACE_FLAGS_TEXTURE 0x00001000 // DDSCAPS_TEXTURE - typedef struct + struct DDS_HEADER { uint32_t size; uint32_t flags; @@ -98,16 +98,16 @@ namespace uint32_t caps3; uint32_t caps4; uint32_t reserved2; - } DDS_HEADER; + }; - typedef struct + struct DDS_HEADER_DXT10 { DXGI_FORMAT dxgiFormat; uint32_t resourceDimension; uint32_t miscFlag; // see D3D11_RESOURCE_MISC_FLAG uint32_t arraySize; uint32_t reserved; - } DDS_HEADER_DXT10; + }; #pragma pack(pop) @@ -192,7 +192,7 @@ namespace //----------------------------------------------------------------------------- struct handle_closer { void operator()(HANDLE h) { if (h) CloseHandle(h); } }; - typedef std::unique_ptr ScopedHandle; + using ScopedHandle = std::unique_ptr; inline HANDLE safe_handle( HANDLE h ) { return (h == INVALID_HANDLE_VALUE) ? nullptr : h; } @@ -245,7 +245,7 @@ namespace //-------------------------------------------------------------------------------------- // Return the BPP for a particular format //-------------------------------------------------------------------------------------- - size_t BitsPerPixel( _In_ DXGI_FORMAT fmt ) + size_t BitsPerPixel( _In_ DXGI_FORMAT fmt ) noexcept { switch( fmt ) { @@ -395,7 +395,7 @@ namespace //-------------------------------------------------------------------------------------- // Determines if the format is block compressed //-------------------------------------------------------------------------------------- - bool IsCompressed( _In_ DXGI_FORMAT fmt ) + bool IsCompressed( _In_ DXGI_FORMAT fmt ) noexcept { switch ( fmt ) { @@ -437,7 +437,7 @@ namespace _In_ DXGI_FORMAT fmt, _Out_opt_ size_t* outNumBytes, _Out_opt_ size_t* outRowBytes, - _Out_opt_ size_t* outNumRows) + _Out_opt_ size_t* outNumRows) noexcept { uint64_t numBytes = 0; uint64_t rowBytes = 0; @@ -578,7 +578,7 @@ namespace //-------------------------------------------------------------------------------------- - DXGI_FORMAT EnsureNotTypeless( DXGI_FORMAT fmt ) + DXGI_FORMAT EnsureNotTypeless( DXGI_FORMAT fmt ) noexcept { // Assumes UNORM or FLOAT; doesn't use UINT or SINT switch( fmt ) @@ -612,7 +612,7 @@ namespace _In_ ID3D11DeviceContext* pContext, _In_ ID3D11Resource* pSource, D3D11_TEXTURE2D_DESC& desc, - ComPtr& pStaging ) + ComPtr& pStaging ) noexcept { if ( !pContext || !pSource ) return E_INVALIDARG; @@ -769,7 +769,7 @@ _Use_decl_annotations_ HRESULT DirectX::SaveDDSTextureToFile( ID3D11DeviceContext* pContext, ID3D11Resource* pSource, - const wchar_t* fileName ) + const wchar_t* fileName ) noexcept { if ( !fileName ) return E_INVALIDARG; @@ -940,7 +940,7 @@ HRESULT DirectX::SaveWICTextureToFile( const wchar_t* fileName, const GUID* targetFormat, std::function setCustomProps, - bool forceSRGB) + bool forceSRGB) noexcept { if ( !fileName ) return E_INVALIDARG; @@ -1030,16 +1030,16 @@ HRESULT DirectX::SaveWICTextureToFile( if ( FAILED(hr) ) return hr; - if ( targetFormat && memcmp( &guidContainerFormat, &GUID_ContainerFormatBmp, sizeof(WICPixelFormatGUID) ) == 0 && g_WIC2 ) + if (targetFormat && memcmp(&guidContainerFormat, &GUID_ContainerFormatBmp, sizeof(WICPixelFormatGUID)) == 0 && g_WIC2) { // Opt-in to the WIC2 support for writing 32-bit Windows BMP files with an alpha channel PROPBAG2 option = {}; option.pstrName = const_cast(L"EnableV5Header32bppBGRA"); - VARIANT varValue; + VARIANT varValue; varValue.vt = VT_BOOL; - varValue.boolVal = VARIANT_TRUE; - (void)props->Write( 1, &option, &varValue ); + varValue.boolVal = VARIANT_TRUE; + (void)props->Write(1, &option, &varValue); } if ( setCustomProps ) @@ -1073,7 +1073,7 @@ HRESULT DirectX::SaveWICTextureToFile( #if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) || defined(_WIN7_PLATFORM_UPDATE) case DXGI_FORMAT_R32G32B32A32_FLOAT: case DXGI_FORMAT_R16G16B16A16_FLOAT: - if ( g_WIC2 ) + if (g_WIC2) { targetGuid = GUID_WICPixelFormat96bppRGBFloat; } diff --git a/ScreenGrab/ScreenGrab.h b/ScreenGrab/ScreenGrab.h index 0bb12ab..6f495d9 100644 --- a/ScreenGrab/ScreenGrab.h +++ b/ScreenGrab/ScreenGrab.h @@ -28,7 +28,7 @@ namespace DirectX HRESULT __cdecl SaveDDSTextureToFile( _In_ ID3D11DeviceContext* pContext, _In_ ID3D11Resource* pSource, - _In_z_ const wchar_t* fileName); + _In_z_ const wchar_t* fileName) noexcept; HRESULT __cdecl SaveWICTextureToFile( _In_ ID3D11DeviceContext* pContext, @@ -37,5 +37,5 @@ namespace DirectX _In_z_ const wchar_t* fileName, _In_opt_ const GUID* targetFormat = nullptr, _In_opt_ std::function setCustomProps = nullptr, - _In_ bool forceSRGB = false); + _In_ bool forceSRGB = false) noexcept; } diff --git a/ScreenGrab/ScreenGrab12.cpp b/ScreenGrab/ScreenGrab12.cpp index c977229..b2604b6 100644 --- a/ScreenGrab/ScreenGrab12.cpp +++ b/ScreenGrab/ScreenGrab12.cpp @@ -90,7 +90,7 @@ namespace #define DDS_SURFACE_FLAGS_TEXTURE 0x00001000 // DDSCAPS_TEXTURE - typedef struct + struct DDS_HEADER { uint32_t size; uint32_t flags; @@ -106,16 +106,16 @@ namespace uint32_t caps3; uint32_t caps4; uint32_t reserved2; - } DDS_HEADER; + }; - typedef struct + struct DDS_HEADER_DXT10 { DXGI_FORMAT dxgiFormat; uint32_t resourceDimension; uint32_t miscFlag; // see D3D11_RESOURCE_MISC_FLAG uint32_t arraySize; uint32_t reserved; - } DDS_HEADER_DXT10; + }; #pragma pack(pop) @@ -200,7 +200,7 @@ namespace //----------------------------------------------------------------------------- struct handle_closer { void operator()(HANDLE h) { if (h) CloseHandle(h); } }; - typedef std::unique_ptr ScopedHandle; + using ScopedHandle = std::unique_ptr; inline HANDLE safe_handle( HANDLE h ) { return (h == INVALID_HANDLE_VALUE) ? nullptr : h; } @@ -253,7 +253,7 @@ namespace //-------------------------------------------------------------------------------------- // Return the BPP for a particular format //-------------------------------------------------------------------------------------- - size_t BitsPerPixel( _In_ DXGI_FORMAT fmt ) + size_t BitsPerPixel( _In_ DXGI_FORMAT fmt ) noexcept { switch( fmt ) { @@ -406,7 +406,7 @@ namespace //-------------------------------------------------------------------------------------- // Determines if the format is block compressed //-------------------------------------------------------------------------------------- - bool IsCompressed( _In_ DXGI_FORMAT fmt ) + bool IsCompressed( _In_ DXGI_FORMAT fmt ) noexcept { switch ( fmt ) { @@ -448,7 +448,7 @@ namespace _In_ DXGI_FORMAT fmt, _Out_opt_ size_t* outNumBytes, _Out_opt_ size_t* outRowBytes, - _Out_opt_ size_t* outNumRows) + _Out_opt_ size_t* outNumRows) noexcept { uint64_t numBytes = 0; uint64_t rowBytes = 0; @@ -590,7 +590,7 @@ namespace //-------------------------------------------------------------------------------------- - DXGI_FORMAT EnsureNotTypeless( DXGI_FORMAT fmt ) + DXGI_FORMAT EnsureNotTypeless( DXGI_FORMAT fmt ) noexcept { // Assumes UNORM or FLOAT; doesn't use UINT or SINT switch( fmt ) @@ -624,7 +624,7 @@ namespace _In_ ID3D12GraphicsCommandList* commandList, _In_ ID3D12Resource* resource, _In_ D3D12_RESOURCE_STATES stateBefore, - _In_ D3D12_RESOURCE_STATES stateAfter) + _In_ D3D12_RESOURCE_STATES stateAfter) noexcept { assert(commandList != nullptr); assert(resource != nullptr); @@ -651,7 +651,7 @@ namespace const D3D12_RESOURCE_DESC& desc, ComPtr& pStaging, D3D12_RESOURCE_STATES beforeState, - D3D12_RESOURCE_STATES afterState) + D3D12_RESOURCE_STATES afterState) noexcept { if (!pCommandQ || !pSource) return E_INVALIDARG; @@ -823,7 +823,7 @@ namespace ifactory)) ? TRUE : FALSE; } - IWICImagingFactory2* _GetWIC() + IWICImagingFactory2* _GetWIC() noexcept { static INIT_ONCE s_initOnce = INIT_ONCE_STATIC_INIT; @@ -848,7 +848,7 @@ HRESULT DirectX::SaveDDSTextureToFile( ID3D12Resource* pSource, const wchar_t* fileName, D3D12_RESOURCE_STATES beforeState, - D3D12_RESOURCE_STATES afterState) + D3D12_RESOURCE_STATES afterState) noexcept { if ( !fileName ) return E_INVALIDARG; @@ -1054,7 +1054,7 @@ HRESULT DirectX::SaveWICTextureToFile( D3D12_RESOURCE_STATES afterState, const GUID* targetFormat, std::function setCustomProps, - bool forceSRGB) + bool forceSRGB) noexcept { if ( !fileName ) return E_INVALIDARG; diff --git a/ScreenGrab/ScreenGrab12.h b/ScreenGrab/ScreenGrab12.h index 53a38c3..573c8de 100644 --- a/ScreenGrab/ScreenGrab12.h +++ b/ScreenGrab/ScreenGrab12.h @@ -30,7 +30,7 @@ namespace DirectX _In_ ID3D12Resource* pSource, _In_z_ const wchar_t* fileName, D3D12_RESOURCE_STATES beforeState = D3D12_RESOURCE_STATE_RENDER_TARGET, - D3D12_RESOURCE_STATES afterState = D3D12_RESOURCE_STATE_RENDER_TARGET); + D3D12_RESOURCE_STATES afterState = D3D12_RESOURCE_STATE_RENDER_TARGET) noexcept; HRESULT __cdecl SaveWICTextureToFile( _In_ ID3D12CommandQueue* pCommandQ, @@ -41,5 +41,5 @@ namespace DirectX D3D12_RESOURCE_STATES afterState = D3D12_RESOURCE_STATE_RENDER_TARGET, _In_opt_ const GUID* targetFormat = nullptr, _In_opt_ std::function setCustomProps = nullptr, - bool forceSRGB = false); + bool forceSRGB = false) noexcept; } diff --git a/WICTextureLoader/WICTextureLoader.cpp b/WICTextureLoader/WICTextureLoader.cpp index 5e256d7..2d3c4a2 100644 --- a/WICTextureLoader/WICTextureLoader.cpp +++ b/WICTextureLoader/WICTextureLoader.cpp @@ -48,7 +48,7 @@ namespace { //-------------------------------------------------------------------------------------- template - inline void SetDebugObjectName(_In_ ID3D11DeviceChild* resource, _In_ const char(&name)[TNameLength]) + inline void SetDebugObjectName(_In_ ID3D11DeviceChild* resource, _In_ const char(&name)[TNameLength]) noexcept { #if !defined(NO_D3D11_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) ) resource->SetPrivateData(WKPDID_D3DDebugObjectName, TNameLength - 1, name); @@ -203,12 +203,13 @@ namespace #endif } - IWICImagingFactory* _GetWIC() + IWICImagingFactory* _GetWIC() noexcept { static INIT_ONCE s_initOnce = INIT_ONCE_STATIC_INIT; IWICImagingFactory* factory = nullptr; - if (!InitOnceExecuteOnce(&s_initOnce, + if (!InitOnceExecuteOnce( + &s_initOnce, InitializeWICFactory, nullptr, reinterpret_cast(&factory))) @@ -220,7 +221,7 @@ namespace } //--------------------------------------------------------------------------------- - DXGI_FORMAT _WICToDXGI(const GUID& guid) + DXGI_FORMAT _WICToDXGI(const GUID& guid) noexcept { for (size_t i = 0; i < _countof(g_WICFormats); ++i) { @@ -240,7 +241,7 @@ namespace } //--------------------------------------------------------------------------------- - size_t _WICBitsPerPixel(REFGUID targetGuid) + size_t _WICBitsPerPixel(REFGUID targetGuid) noexcept { auto pWIC = _GetWIC(); if (!pWIC) @@ -270,7 +271,7 @@ namespace //-------------------------------------------------------------------------------------- - DXGI_FORMAT MakeSRGB(_In_ DXGI_FORMAT format) + DXGI_FORMAT MakeSRGB(_In_ DXGI_FORMAT format) noexcept { switch (format) { @@ -312,7 +313,7 @@ namespace _In_ unsigned int miscFlags, _In_ unsigned int loadFlags, _Outptr_opt_ ID3D11Resource** texture, - _Outptr_opt_ ID3D11ShaderResourceView** textureView) + _Outptr_opt_ ID3D11ShaderResourceView** textureView) noexcept { UINT width, height; HRESULT hr = frame->GetSize(&width, &height); @@ -334,20 +335,20 @@ namespace { case D3D_FEATURE_LEVEL_9_1: case D3D_FEATURE_LEVEL_9_2: - maxsize = 2048 /*D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION*/; + maxsize = 2048u /*D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION*/; break; case D3D_FEATURE_LEVEL_9_3: - maxsize = 4096 /*D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION*/; + maxsize = 4096u /*D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION*/; break; case D3D_FEATURE_LEVEL_10_0: case D3D_FEATURE_LEVEL_10_1: - maxsize = 8192 /*D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION*/; + maxsize = 8192u /*D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION*/; break; default: - maxsize = D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION; + maxsize = size_t(D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION); break; } } @@ -618,10 +619,10 @@ namespace } // Create texture - D3D11_TEXTURE2D_DESC desc; + D3D11_TEXTURE2D_DESC desc = {}; desc.Width = twidth; desc.Height = theight; - desc.MipLevels = (autogen) ? 0 : 1; + desc.MipLevels = (autogen) ? 0u : 1u; desc.ArraySize = 1; desc.Format = format; desc.SampleDesc.Count = 1; @@ -655,7 +656,7 @@ namespace SRVDesc.Format = desc.Format; SRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D; - SRVDesc.Texture2D.MipLevels = (autogen) ? UINT(-1) : 1; + SRVDesc.Texture2D.MipLevels = (autogen) ? unsigned(-1) : 1u; hr = d3dDevice->CreateShaderResourceView(tex, &SRVDesc, textureView); if (FAILED(hr)) @@ -691,7 +692,7 @@ namespace void SetDebugTextureInfo( _In_z_ const wchar_t* fileName, _In_opt_ ID3D11Resource** texture, - _In_opt_ ID3D11ShaderResourceView** textureView) + _In_opt_ ID3D11ShaderResourceView** textureView) noexcept { #if !defined(NO_D3D11_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) ) if (texture || textureView) @@ -751,7 +752,7 @@ HRESULT DirectX::CreateWICTextureFromMemory( size_t wicDataSize, ID3D11Resource** texture, ID3D11ShaderResourceView** textureView, - size_t maxsize) + size_t maxsize) noexcept { return CreateWICTextureFromMemoryEx(d3dDevice, nullptr, wicData, wicDataSize, @@ -769,7 +770,7 @@ HRESULT DirectX::CreateWICTextureFromMemory( size_t wicDataSize, ID3D11Resource** texture, ID3D11ShaderResourceView** textureView, - size_t maxsize) + size_t maxsize) noexcept { return CreateWICTextureFromMemoryEx(d3dDevice, d3dContext, wicData, wicDataSize, @@ -791,7 +792,7 @@ HRESULT DirectX::CreateWICTextureFromMemoryEx( unsigned int miscFlags, unsigned int loadFlags, ID3D11Resource** texture, - ID3D11ShaderResourceView** textureView) + ID3D11ShaderResourceView** textureView) noexcept { return CreateWICTextureFromMemoryEx(d3dDevice, nullptr, wicData, wicDataSize, @@ -814,7 +815,7 @@ HRESULT DirectX::CreateWICTextureFromMemoryEx( unsigned int miscFlags, unsigned int loadFlags, ID3D11Resource** texture, - ID3D11ShaderResourceView** textureView) + ID3D11ShaderResourceView** textureView) noexcept { if (texture) { @@ -895,7 +896,7 @@ HRESULT DirectX::CreateWICTextureFromFile( const wchar_t* fileName, ID3D11Resource** texture, ID3D11ShaderResourceView** textureView, - size_t maxsize) + size_t maxsize) noexcept { return CreateWICTextureFromFileEx(d3dDevice, nullptr, fileName, maxsize, @@ -911,7 +912,7 @@ HRESULT DirectX::CreateWICTextureFromFile( const wchar_t* fileName, ID3D11Resource** texture, ID3D11ShaderResourceView** textureView, - size_t maxsize) + size_t maxsize) noexcept { return CreateWICTextureFromFileEx(d3dDevice, d3dContext, fileName, @@ -932,7 +933,7 @@ HRESULT DirectX::CreateWICTextureFromFileEx( unsigned int miscFlags, unsigned int loadFlags, ID3D11Resource** texture, - ID3D11ShaderResourceView** textureView) + ID3D11ShaderResourceView** textureView) noexcept { return CreateWICTextureFromFileEx(d3dDevice, nullptr, fileName, @@ -954,7 +955,7 @@ HRESULT DirectX::CreateWICTextureFromFileEx( unsigned int miscFlags, unsigned int loadFlags, ID3D11Resource** texture, - ID3D11ShaderResourceView** textureView) + ID3D11ShaderResourceView** textureView) noexcept { if (texture) { diff --git a/WICTextureLoader/WICTextureLoader.h b/WICTextureLoader/WICTextureLoader.h index 1795097..f67d3b8 100644 --- a/WICTextureLoader/WICTextureLoader.h +++ b/WICTextureLoader/WICTextureLoader.h @@ -24,14 +24,14 @@ #pragma once #include -#include +#include namespace DirectX { #ifndef WIC_LOADER_FLAGS_DEFINED #define WIC_LOADER_FLAGS_DEFINED - enum WIC_LOADER_FLAGS + enum WIC_LOADER_FLAGS : uint32_t { WIC_LOADER_DEFAULT = 0, WIC_LOADER_FORCE_SRGB = 0x1, @@ -46,14 +46,14 @@ namespace DirectX _In_ size_t wicDataSize, _Outptr_opt_ ID3D11Resource** texture, _Outptr_opt_ ID3D11ShaderResourceView** textureView, - _In_ size_t maxsize = 0); + _In_ size_t maxsize = 0) noexcept; HRESULT CreateWICTextureFromFile( _In_ ID3D11Device* d3dDevice, _In_z_ const wchar_t* szFileName, _Outptr_opt_ ID3D11Resource** texture, _Outptr_opt_ ID3D11ShaderResourceView** textureView, - _In_ size_t maxsize = 0); + _In_ size_t maxsize = 0) noexcept; // Standard version with optional auto-gen mipmap support HRESULT CreateWICTextureFromMemory( @@ -63,7 +63,7 @@ namespace DirectX _In_ size_t wicDataSize, _Outptr_opt_ ID3D11Resource** texture, _Outptr_opt_ ID3D11ShaderResourceView** textureView, - _In_ size_t maxsize = 0); + _In_ size_t maxsize = 0) noexcept; HRESULT CreateWICTextureFromFile( _In_ ID3D11Device* d3dDevice, @@ -71,7 +71,7 @@ namespace DirectX _In_z_ const wchar_t* szFileName, _Outptr_opt_ ID3D11Resource** texture, _Outptr_opt_ ID3D11ShaderResourceView** textureView, - _In_ size_t maxsize = 0); + _In_ size_t maxsize = 0) noexcept; // Extended version HRESULT CreateWICTextureFromMemoryEx( @@ -85,7 +85,7 @@ namespace DirectX _In_ unsigned int miscFlags, _In_ unsigned int loadFlags, _Outptr_opt_ ID3D11Resource** texture, - _Outptr_opt_ ID3D11ShaderResourceView** textureView); + _Outptr_opt_ ID3D11ShaderResourceView** textureView) noexcept; HRESULT CreateWICTextureFromFileEx( _In_ ID3D11Device* d3dDevice, @@ -97,7 +97,7 @@ namespace DirectX _In_ unsigned int miscFlags, _In_ unsigned int loadFlags, _Outptr_opt_ ID3D11Resource** texture, - _Outptr_opt_ ID3D11ShaderResourceView** textureView); + _Outptr_opt_ ID3D11ShaderResourceView** textureView) noexcept; // Extended version with optional auto-gen mipmap support HRESULT CreateWICTextureFromMemoryEx( @@ -112,7 +112,7 @@ namespace DirectX _In_ unsigned int miscFlags, _In_ unsigned int loadFlags, _Outptr_opt_ ID3D11Resource** texture, - _Outptr_opt_ ID3D11ShaderResourceView** textureView); + _Outptr_opt_ ID3D11ShaderResourceView** textureView) noexcept; HRESULT CreateWICTextureFromFileEx( _In_ ID3D11Device* d3dDevice, @@ -125,6 +125,5 @@ namespace DirectX _In_ unsigned int miscFlags, _In_ unsigned int loadFlags, _Outptr_opt_ ID3D11Resource** texture, - _Outptr_opt_ ID3D11ShaderResourceView** textureView); + _Outptr_opt_ ID3D11ShaderResourceView** textureView) noexcept; } - diff --git a/WICTextureLoader/WICTextureLoader12.cpp b/WICTextureLoader/WICTextureLoader12.cpp index 0b86bd8..69f7948 100644 --- a/WICTextureLoader/WICTextureLoader12.cpp +++ b/WICTextureLoader/WICTextureLoader12.cpp @@ -161,7 +161,7 @@ namespace ifactory)) ? TRUE : FALSE; } - IWICImagingFactory2* _GetWIC() + IWICImagingFactory2* _GetWIC() noexcept { static INIT_ONCE s_initOnce = INIT_ONCE_STATIC_INIT; @@ -179,7 +179,7 @@ namespace //--------------------------------------------------------------------------------- template - inline void SetDebugObjectName(_In_ ID3D12DeviceChild* resource, _In_z_ const wchar_t(&name)[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); @@ -189,7 +189,7 @@ namespace #endif } - inline uint32_t CountMips(uint32_t width, uint32_t height) + inline uint32_t CountMips(uint32_t width, uint32_t height) noexcept { if (width == 0 || height == 0) return 0; @@ -205,7 +205,7 @@ namespace } //-------------------------------------------------------------------------------------- - DXGI_FORMAT MakeSRGB(_In_ DXGI_FORMAT format) + DXGI_FORMAT MakeSRGB(_In_ DXGI_FORMAT format) noexcept { switch (format) { @@ -236,7 +236,7 @@ namespace } //--------------------------------------------------------------------------------- - DXGI_FORMAT _WICToDXGI(const GUID& guid) + DXGI_FORMAT _WICToDXGI(const GUID& guid) noexcept { for (size_t i = 0; i < _countof(g_WICFormats); ++i) { @@ -248,7 +248,7 @@ namespace } //--------------------------------------------------------------------------------- - size_t _WICBitsPerPixel(REFGUID targetGuid) + size_t _WICBitsPerPixel(REFGUID targetGuid) noexcept { auto pWIC = _GetWIC(); if (!pWIC) @@ -284,7 +284,7 @@ namespace unsigned int loadFlags, _Outptr_ ID3D12Resource** texture, std::unique_ptr& decodedData, - D3D12_SUBRESOURCE_DATA& subresource) + D3D12_SUBRESOURCE_DATA& subresource) noexcept { UINT width, height; HRESULT hr = frame->GetSize(&width, &height); @@ -549,7 +549,7 @@ namespace //-------------------------------------------------------------------------------------- void SetDebugTextureInfo( _In_z_ const wchar_t* fileName, - _In_ ID3D12Resource** texture) + _In_ ID3D12Resource** texture) noexcept { #if !defined(NO_D3D12_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) ) if (texture) @@ -586,7 +586,7 @@ HRESULT DirectX::LoadWICTextureFromMemory( ID3D12Resource** texture, std::unique_ptr& decodedData, D3D12_SUBRESOURCE_DATA& subresource, - size_t maxsize) + size_t maxsize) noexcept { return LoadWICTextureFromMemoryEx( d3dDevice, @@ -612,7 +612,7 @@ HRESULT DirectX::LoadWICTextureFromMemoryEx( unsigned int loadFlags, ID3D12Resource** texture, std::unique_ptr& decodedData, - D3D12_SUBRESOURCE_DATA& subresource) + D3D12_SUBRESOURCE_DATA& subresource) noexcept { if (texture) { @@ -675,7 +675,7 @@ HRESULT DirectX::LoadWICTextureFromFile( ID3D12Resource** texture, std::unique_ptr& wicData, D3D12_SUBRESOURCE_DATA& subresource, - size_t maxsize) + size_t maxsize) noexcept { return LoadWICTextureFromFileEx( d3dDevice, @@ -699,7 +699,7 @@ HRESULT DirectX::LoadWICTextureFromFileEx( unsigned int loadFlags, ID3D12Resource** texture, std::unique_ptr& decodedData, - D3D12_SUBRESOURCE_DATA& subresource) + D3D12_SUBRESOURCE_DATA& subresource) noexcept { if (texture) { diff --git a/WICTextureLoader/WICTextureLoader12.h b/WICTextureLoader/WICTextureLoader12.h index ac26851..340f72b 100644 --- a/WICTextureLoader/WICTextureLoader12.h +++ b/WICTextureLoader/WICTextureLoader12.h @@ -21,7 +21,8 @@ #pragma once #include -#include + +#include #include @@ -29,7 +30,7 @@ namespace DirectX { #ifndef WIC_LOADER_FLAGS_DEFINED #define WIC_LOADER_FLAGS_DEFINED - enum WIC_LOADER_FLAGS + enum WIC_LOADER_FLAGS : uint32_t { WIC_LOADER_DEFAULT = 0, WIC_LOADER_FORCE_SRGB = 0x1, @@ -47,7 +48,7 @@ namespace DirectX _Outptr_ ID3D12Resource** texture, std::unique_ptr& decodedData, D3D12_SUBRESOURCE_DATA& subresource, - size_t maxsize = 0); + size_t maxsize = 0) noexcept; HRESULT __cdecl LoadWICTextureFromFile( _In_ ID3D12Device* d3dDevice, @@ -55,7 +56,7 @@ namespace DirectX _Outptr_ ID3D12Resource** texture, std::unique_ptr& decodedData, D3D12_SUBRESOURCE_DATA& subresource, - size_t maxsize = 0); + size_t maxsize = 0) noexcept; // Extended version HRESULT __cdecl LoadWICTextureFromMemoryEx( @@ -67,7 +68,7 @@ namespace DirectX unsigned int loadFlags, _Outptr_ ID3D12Resource** texture, std::unique_ptr& decodedData, - D3D12_SUBRESOURCE_DATA& subresource); + D3D12_SUBRESOURCE_DATA& subresource) noexcept; HRESULT __cdecl LoadWICTextureFromFileEx( _In_ ID3D12Device* d3dDevice, @@ -77,5 +78,5 @@ namespace DirectX unsigned int loadFlags, _Outptr_ ID3D12Resource** texture, std::unique_ptr& decodedData, - D3D12_SUBRESOURCE_DATA& subresource); + D3D12_SUBRESOURCE_DATA& subresource) noexcept; }