Skip to content

Commit

Permalink
Update for latest minor fixes for DXUT / FX11
Browse files Browse the repository at this point in the history
  • Loading branch information
walbourn committed May 13, 2022
1 parent 54a7184 commit 25a9849
Show file tree
Hide file tree
Showing 14 changed files with 107 additions and 83 deletions.
22 changes: 22 additions & 0 deletions BuildAllSolutions.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="BuildAll" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<ItemGroup>
<FullSolutionList Include="$(MSBuildThisProjectDirectory)**\*.sln" />
</ItemGroup>

<Target Name="BuildAll"
Outputs="%(FullSolutionList.Identity)">

<PropertyGroup>
<_OneSln>%(FullSolutionList.Identity)</_OneSln>
</PropertyGroup>

<MSBuild Projects="$(_OneSln)"
Properties="Configuration=Debug;Platform=x64" />

<MSBuild Projects="$(_OneSln)"
Properties="Configuration=Release;Platform=x64" />

</Target>
</Project>
18 changes: 9 additions & 9 deletions DXUT/Core/DDSTextureLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ using namespace DirectX;
//--------------------------------------------------------------------------------------
#pragma pack(push,1)

const uint32_t DDS_MAGIC = 0x20534444; // "DDS "
constexpr uint32_t DDS_MAGIC = 0x20534444; // "DDS "

struct DDS_PIXELFORMAT
{
Expand Down Expand Up @@ -162,7 +162,7 @@ namespace
}

// DDS files always start with the same magic number ("DDS ")
auto dwMagicNumber = *reinterpret_cast<const uint32_t*>(ddsData);
auto const dwMagicNumber = *reinterpret_cast<const uint32_t*>(ddsData);
if (dwMagicNumber != DDS_MAGIC)
{
return E_FAIL;
Expand Down Expand Up @@ -286,7 +286,7 @@ namespace
}

// DDS files always start with the same magic number ("DDS ")
auto dwMagicNumber = *reinterpret_cast<const uint32_t*>(ddsData.get());
auto const dwMagicNumber = *reinterpret_cast<const uint32_t*>(ddsData.get());
if (dwMagicNumber != DDS_MAGIC)
{
ddsData.reset();
Expand Down Expand Up @@ -592,7 +592,7 @@ namespace
}
else
{
size_t bpp = BitsPerPixel(fmt);
const size_t bpp = BitsPerPixel(fmt);
if (!bpp)
return E_INVALIDARG;

Expand Down Expand Up @@ -1043,7 +1043,7 @@ namespace
_In_ unsigned int miscFlags,
_In_ bool forceSRGB,
_In_ bool isCubeMap,
_In_reads_opt_(mipCount*arraySize) D3D11_SUBRESOURCE_DATA* initData,
_In_reads_opt_(mipCount*arraySize) const D3D11_SUBRESOURCE_DATA* initData,
_Outptr_opt_ ID3D11Resource** texture,
_Outptr_opt_ ID3D11ShaderResourceView** textureView) noexcept
{
Expand Down Expand Up @@ -1279,7 +1279,7 @@ namespace
{
HRESULT hr = S_OK;

UINT width = header->width;
const UINT width = header->width;
UINT height = header->height;
UINT depth = header->depth;

Expand Down Expand Up @@ -1531,7 +1531,7 @@ namespace
return HRESULT_FROM_WIN32(ERROR_HANDLE_EOF);
}

UINT res = D3D11CalcSubresource(0, item, mipLevels);
const UINT res = D3D11CalcSubresource(0, item, mipLevels);
d3dContext->UpdateSubresource(tex, res, nullptr, pSrcBits, static_cast<UINT>(rowBytes), static_cast<UINT>(numBytes));
pSrcBits += numBytes;
}
Expand Down Expand Up @@ -1642,7 +1642,7 @@ namespace
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 mode = static_cast<DDS_ALPHA_MODE>(d3d10ext->miscFlags2 & DDS_MISC_FLAGS2_ALPHA_MODE_MASK);
auto const mode = static_cast<DDS_ALPHA_MODE>(d3d10ext->miscFlags2 & DDS_MISC_FLAGS2_ALPHA_MODE_MASK);
switch (mode)
{
case DDS_ALPHA_MODE_STRAIGHT:
Expand Down Expand Up @@ -1676,7 +1676,7 @@ namespace
if (texture || textureView)
{
CHAR strFileA[MAX_PATH];
int result = WideCharToMultiByte(CP_UTF8,
const int result = WideCharToMultiByte(CP_UTF8,
WC_NO_BEST_FIT_CHARS,
fileName,
-1,
Expand Down
2 changes: 1 addition & 1 deletion DXUT/Core/DXUT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4476,7 +4476,7 @@ HRESULT DXUTSnapDeviceSettingsToEnumDevice( DXUTDeviceSettings* pDeviceSettings,
}
if (pDeviceSettingsCombo->pOutputInfo)
{
const auto& bestDisplayMode = pDeviceSettingsCombo->pOutputInfo->displayModeList[ bestModeIndex ];
auto const& bestDisplayMode = pDeviceSettingsCombo->pOutputInfo->displayModeList[ bestModeIndex ];
if (!pDeviceSettingsCombo->Windowed)
{
pDeviceSettings->d3d11.sd.BufferDesc.Height = bestDisplayMode.Height;
Expand Down
4 changes: 2 additions & 2 deletions DXUT/Core/DXUTDevice11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,7 @@ float DXUTRankD3D11DeviceCombo( CD3D11EnumDeviceSettingsCombo* pDeviceSettingsCo
// Match both Resolution & Refresh Rate
for( size_t idm = 0; idm < pDeviceSettingsCombo->pOutputInfo->displayModeList.size() && !bResolutionFound; idm++ )
{
const auto& displayMode = pDeviceSettingsCombo->pOutputInfo->displayModeList[ idm ];
auto const& displayMode = pDeviceSettingsCombo->pOutputInfo->displayModeList[ idm ];

float refreshDiff = fabsf( ( float( displayMode.RefreshRate.Numerator ) / float( displayMode.RefreshRate.Denominator ) ) -
( float( pOptimalDeviceSettings->sd.BufferDesc.RefreshRate.Numerator ) / float( pOptimalDeviceSettings->sd.BufferDesc.RefreshRate.Denominator ) ) );
Expand Down Expand Up @@ -1143,7 +1143,7 @@ float DXUTRankD3D11DeviceCombo( CD3D11EnumDeviceSettingsCombo* pDeviceSettingsCo
// Match just Resolution
for( size_t idm = 0; idm < pDeviceSettingsCombo->pOutputInfo->displayModeList.size() && !bResolutionFound; idm++ )
{
const auto& displayMode = pDeviceSettingsCombo->pOutputInfo->displayModeList[ idm ];
auto const& displayMode = pDeviceSettingsCombo->pOutputInfo->displayModeList[ idm ];

if( displayMode.Width == pOptimalDeviceSettings->sd.BufferDesc.Width
&& displayMode.Height == pOptimalDeviceSettings->sd.BufferDesc.Height )
Expand Down
12 changes: 6 additions & 6 deletions DXUT/Core/DXUT_2019_Win10.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<FloatingPointModel>Fast</FloatingPointModel>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zc:__cplusplus /ZH:SHA_256 %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions>WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;_LIB;USE_DIRECT3D11_4;_WIN32_WINNT=0x0601;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
<PrecompiledHeader>Use</PrecompiledHeader>
Expand Down Expand Up @@ -165,7 +165,7 @@
<Optimization>Disabled</Optimization>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<FloatingPointModel>Fast</FloatingPointModel>
<AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zc:__cplusplus /ZH:SHA_256 %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions>WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;_LIB;USE_DIRECT3D11_4;_WIN32_WINNT=0x0601;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
<PrecompiledHeader>Use</PrecompiledHeader>
Expand Down Expand Up @@ -196,7 +196,7 @@
<Optimization>MaxSpeed</Optimization>
<FloatingPointModel>Fast</FloatingPointModel>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zc:__cplusplus /ZH:SHA_256 %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_LIB;USE_DIRECT3D11_4;_WIN32_WINNT=0x0601;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
<PrecompiledHeader>Use</PrecompiledHeader>
Expand Down Expand Up @@ -226,7 +226,7 @@
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FloatingPointModel>Fast</FloatingPointModel>
<AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zc:__cplusplus /ZH:SHA_256 %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_LIB;USE_DIRECT3D11_4;_WIN32_WINNT=0x0601;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
<PrecompiledHeader>Use</PrecompiledHeader>
Expand Down Expand Up @@ -257,7 +257,7 @@
<Optimization>MaxSpeed</Optimization>
<FloatingPointModel>Fast</FloatingPointModel>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zc:__cplusplus /ZH:SHA_256 %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions>WIN32;NDEBUG;PROFILE;_WINDOWS;_LIB;USE_DIRECT3D11_4;_WIN32_WINNT=0x0601;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
<PrecompiledHeader>Use</PrecompiledHeader>
Expand Down Expand Up @@ -287,7 +287,7 @@
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FloatingPointModel>Fast</FloatingPointModel>
<AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zc:__cplusplus /ZH:SHA_256 %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions>WIN32;NDEBUG;PROFILE;_WINDOWS;_LIB;USE_DIRECT3D11_4;_WIN32_WINNT=0x0601;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
<PrecompiledHeader>Use</PrecompiledHeader>
Expand Down
12 changes: 6 additions & 6 deletions DXUT/Core/DXUT_DirectXTK_2019_Win10.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
<FloatingPointModel>Fast</FloatingPointModel>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<AdditionalIncludeDirectories>..\..\DirectXTK\Inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zc:__cplusplus /ZH:SHA_256 %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions>WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;_LIB;USE_DIRECT3D11_4;USE_DIRECTXTK;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
<PrecompiledHeader>Use</PrecompiledHeader>
Expand Down Expand Up @@ -167,7 +167,7 @@
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<FloatingPointModel>Fast</FloatingPointModel>
<AdditionalIncludeDirectories>..\..\DirectXTK\Inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zc:__cplusplus /ZH:SHA_256 %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions>WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;_LIB;USE_DIRECT3D11_4;USE_DIRECTXTK;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
<PrecompiledHeader>Use</PrecompiledHeader>
Expand Down Expand Up @@ -199,7 +199,7 @@
<FloatingPointModel>Fast</FloatingPointModel>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<AdditionalIncludeDirectories>..\..\DirectXTK\Inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zc:__cplusplus /ZH:SHA_256 %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_LIB;USE_DIRECT3D11_4;USE_DIRECTXTK;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
<PrecompiledHeader>Use</PrecompiledHeader>
Expand Down Expand Up @@ -230,7 +230,7 @@
<Optimization>MaxSpeed</Optimization>
<FloatingPointModel>Fast</FloatingPointModel>
<AdditionalIncludeDirectories>..\..\DirectXTK\Inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zc:__cplusplus /ZH:SHA_256 %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_LIB;USE_DIRECT3D11_4;USE_DIRECTXTK;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
<PrecompiledHeader>Use</PrecompiledHeader>
Expand Down Expand Up @@ -262,7 +262,7 @@
<FloatingPointModel>Fast</FloatingPointModel>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<AdditionalIncludeDirectories>..\..\DirectXTK\Inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zc:__cplusplus /ZH:SHA_256 %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions>WIN32;NDEBUG;PROFILE;_WINDOWS;_LIB;USE_DIRECT3D11_4;USE_DIRECTXTK;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
<PrecompiledHeader>Use</PrecompiledHeader>
Expand Down Expand Up @@ -293,7 +293,7 @@
<Optimization>MaxSpeed</Optimization>
<FloatingPointModel>Fast</FloatingPointModel>
<AdditionalIncludeDirectories>..\..\DirectXTK\Inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zc:__cplusplus /ZH:SHA_256 %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions>WIN32;NDEBUG;PROFILE;_WINDOWS;_LIB;USE_DIRECT3D11_4;USE_DIRECTXTK;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
<PrecompiledHeader>Use</PrecompiledHeader>
Expand Down
33 changes: 17 additions & 16 deletions DXUT/Core/ScreenGrab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <cstring>
#include <memory>
#include <new>
#include <tuple>

#include <wincodec.h>

Expand Down Expand Up @@ -214,7 +215,7 @@ namespace
{
FILE_DISPOSITION_INFO info = {};
info.DeleteFile = TRUE;
(void)SetFileInformationByHandle(m_handle, FileDispositionInfo, &info, sizeof(info));
std::ignore = SetFileInformationByHandle(m_handle, FileDispositionInfo, &info, sizeof(info));
}
}

Expand Down Expand Up @@ -555,7 +556,7 @@ namespace
}
else
{
size_t bpp = BitsPerPixel(fmt);
const size_t bpp = BitsPerPixel(fmt);
if (!bpp)
return E_INVALIDARG;

Expand Down Expand Up @@ -660,7 +661,7 @@ namespace

assert(pTemp);

DXGI_FORMAT fmt = EnsureNotTypeless(desc.Format);
const DXGI_FORMAT fmt = EnsureNotTypeless(desc.Format);

UINT support = 0;
hr = d3dDevice->CheckFormatSupport(fmt, &support);
Expand All @@ -674,7 +675,7 @@ namespace
{
for (UINT level = 0; level < desc.MipLevels; ++level)
{
UINT index = D3D11CalcSubresource(level, item, desc.MipLevels);
const UINT index = D3D11CalcSubresource(level, item, desc.MipLevels);
pContext->ResolveSubresource(pTemp.Get(), index, pSource, index, fmt);
}
}
Expand Down Expand Up @@ -758,7 +759,7 @@ namespace
#endif
}

IWICImagingFactory* _GetWIC() noexcept
IWICImagingFactory* GetWIC() noexcept
{
static INIT_ONCE s_initOnce = INIT_ONCE_STATIC_INIT;

Expand Down Expand Up @@ -806,7 +807,7 @@ HRESULT DirectX::SaveDDSTextureToFile(
auto_delete_file delonfail(hFile.get());

// Setup header
const size_t MAX_HEADER_SIZE = sizeof(uint32_t) + sizeof(DDS_HEADER) + sizeof(DDS_HEADER_DXT10);
constexpr size_t MAX_HEADER_SIZE = sizeof(uint32_t) + sizeof(DDS_HEADER) + sizeof(DDS_HEADER_DXT10);
uint8_t fileHeader[MAX_HEADER_SIZE] = {};

*reinterpret_cast<uint32_t*>(&fileHeader[0]) = DDS_MAGIC;
Expand Down Expand Up @@ -914,7 +915,7 @@ HRESULT DirectX::SaveDDSTextureToFile(

uint8_t* dptr = pixels.get();

size_t msize = std::min<size_t>(rowPitch, mapped.RowPitch);
const size_t msize = std::min<size_t>(rowPitch, mapped.RowPitch);
for (size_t h = 0; h < rowCount; ++h)
{
memcpy_s(dptr, rowPitch, sptr, msize);
Expand Down Expand Up @@ -1012,7 +1013,7 @@ HRESULT DirectX::SaveWICTextureToFile(
return HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED);
}

auto pWIC = _GetWIC();
auto pWIC = GetWIC();
if (!pWIC)
return E_NOINTERFACE;

Expand Down Expand Up @@ -1051,7 +1052,7 @@ HRESULT DirectX::SaveWICTextureToFile(
VARIANT varValue;
varValue.vt = VT_BOOL;
varValue.boolVal = VARIANT_TRUE;
(void)props->Write(1, &option, &varValue);
std::ignore = props->Write(1, &option, &varValue);
}

if (setCustomProps)
Expand Down Expand Up @@ -1137,37 +1138,37 @@ HRESULT DirectX::SaveWICTextureToFile(
if (memcmp(&guidContainerFormat, &GUID_ContainerFormatPng, sizeof(GUID)) == 0)
{
// Set Software name
(void)metawriter->SetMetadataByName(L"/tEXt/{str=Software}", &value);
std::ignore = metawriter->SetMetadataByName(L"/tEXt/{str=Software}", &value);

// Set sRGB chunk
if (sRGB)
{
value.vt = VT_UI1;
value.bVal = 0;
(void)metawriter->SetMetadataByName(L"/sRGB/RenderingIntent", &value);
std::ignore = metawriter->SetMetadataByName(L"/sRGB/RenderingIntent", &value);
}
else
{
// add gAMA chunk with gamma 1.0
value.vt = VT_UI4;
value.uintVal = 100000; // gama value * 100,000 -- i.e. gamma 1.0
(void)metawriter->SetMetadataByName(L"/gAMA/ImageGamma", &value);
std::ignore = metawriter->SetMetadataByName(L"/gAMA/ImageGamma", &value);

// remove sRGB chunk which is added by default.
(void)metawriter->RemoveMetadataByName(L"/sRGB/RenderingIntent");
std::ignore = metawriter->RemoveMetadataByName(L"/sRGB/RenderingIntent");
}
}
else
{
// Set Software name
(void)metawriter->SetMetadataByName(L"System.ApplicationName", &value);
std::ignore = metawriter->SetMetadataByName(L"System.ApplicationName", &value);

if (sRGB)
{
// Set EXIF Colorspace of sRGB
value.vt = VT_UI2;
value.uiVal = 1;
(void)metawriter->SetMetadataByName(L"System.Image.ColorSpace", &value);
std::ignore = metawriter->SetMetadataByName(L"System.Image.ColorSpace", &value);
}
}
}
Expand All @@ -1177,7 +1178,7 @@ HRESULT DirectX::SaveWICTextureToFile(
if (FAILED(hr))
return hr;

uint64_t imageSize = uint64_t(mapped.RowPitch) * uint64_t(desc.Height);
const uint64_t imageSize = uint64_t(mapped.RowPitch) * uint64_t(desc.Height);
if (imageSize > UINT32_MAX)
{
pContext->Unmap(pStaging.Get(), 0);
Expand Down
Loading

0 comments on commit 25a9849

Please sign in to comment.