Skip to content

Commit

Permalink
Upgrade DirectXTex to the September 1, 2023 release
Browse files Browse the repository at this point in the history
  • Loading branch information
0xC0000054 committed Sep 6, 2023
1 parent fc4ea14 commit f8b70ae
Show file tree
Hide file tree
Showing 22 changed files with 257 additions and 278 deletions.
2 changes: 1 addition & 1 deletion 3rdParty/DirectXTex/.nuget/directxtex_desktop_2019.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<description>This version is for Windows desktop applications using Visual Studio 2019 (16.11) or Visual Studio 2022 and supports Windows 7 / DirectX 11.

DirectXTex, a shared source library for reading and writing .DDS files, and performing various texture content processing operations including resizing, format conversion, mip-map generation, block compression for Direct3D runtime texture resources, and height-map to normal-map conversion. This library makes use of the Windows Image Component (WIC) APIs. It also includes simple .TGA and .HDR readers and writers since these image file format are commonly used for texture content processing pipelines, but are not currently supported by a built-in WIC codec.</description>
<releaseNotes>Matches the June 13, 2023 release on GitHub.</releaseNotes>
<releaseNotes>Matches the September 1, 2023 release on GitHub.</releaseNotes>
<projectUrl>http://go.microsoft.com/fwlink/?LinkId=248926</projectUrl>
<repository type="git" url="https://github.com/microsoft/DirectXTex.git" />
<icon>images\icon.jpg</icon>
Expand Down
2 changes: 1 addition & 1 deletion 3rdParty/DirectXTex/.nuget/directxtex_desktop_win10.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<description>This version is for Windows desktop applications using Visual Studio 2019 (16.11) or Visual Studio 2022 and supports Windows 10 / Windows 11 including both DirectX 11 and DirectX 12.

DirectXTex, a shared source library for reading and writing .DDS files, and performing various texture content processing operations including resizing, format conversion, mip-map generation, block compression for Direct3D runtime texture resources, and height-map to normal-map conversion. This library makes use of the Windows Image Component (WIC) APIs. It also includes simple .TGA and .HDR readers and writers since these image file format are commonly used for texture content processing pipelines, but are not currently supported by a built-in WIC codec.</description>
<releaseNotes>Matches the June 13, 2023 release on GitHub.</releaseNotes>
<releaseNotes>Matches the September 1, 2023 release on GitHub.</releaseNotes>
<projectUrl>http://go.microsoft.com/fwlink/?LinkId=248926</projectUrl>
<repository type="git" url="https://github.com/microsoft/DirectXTex.git" />
<icon>images\icon.jpg</icon>
Expand Down
8 changes: 1 addition & 7 deletions 3rdParty/DirectXTex/.nuget/directxtex_uwp.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<description>This version is for Universal Windows Platform apps on Windows 10 / Windows 11 using Visual Studio 2019 (16.11) or Visual Studio 2022.

DirectXTex, a shared source library for reading and writing .DDS files, and performing various texture content processing operations including resizing, format conversion, mip-map generation, block compression for Direct3D runtime texture resources, and height-map to normal-map conversion. This library makes use of the Windows Image Component (WIC) APIs. It also includes simple .TGA and .HDR readers and writers since these image file format are commonly used for texture content processing pipelines, but are not currently supported by a built-in WIC codec.</description>
<releaseNotes>Matches the June 13, 2023 release on GitHub.</releaseNotes>
<releaseNotes>Matches the September 1, 2023 release on GitHub.</releaseNotes>
<projectUrl>http://go.microsoft.com/fwlink/?LinkId=248926</projectUrl>
<repository type="git" url="https://github.com/microsoft/DirectXTex.git" />
<icon>images\icon.jpg</icon>
Expand All @@ -28,12 +28,6 @@ DirectXTex, a shared source library for reading and writing .DDS files, and perf
<file target="include" src="DirectXTex\DirectXTex.h" />
<file target="include" src="DirectXTex\DirectXTex.inl" />

<file target="native\lib\ARM\Debug" src="DirectXTex\Bin\Windows10_2019\ARM\Debug\*.lib" />
<file target="native\lib\ARM\Debug" src="DirectXTex\Bin\Windows10_2019\ARM\Debug\*.pdb" />

<file target="native\lib\ARM\Release" src="DirectXTex\Bin\Windows10_2019\ARM\Release\*.lib" />
<file target="native\lib\ARM\Release" src="DirectXTex\Bin\Windows10_2019\ARM\Release\*.pdb" />

<file target="native\lib\ARM64\Debug" src="DirectXTex\Bin\Windows10_2019\ARM64\Debug\*.lib" />
<file target="native\lib\ARM64\Debug" src="DirectXTex\Bin\Windows10_2019\ARM64\Debug\*.pdb" />

Expand Down
11 changes: 10 additions & 1 deletion 3rdParty/DirectXTex/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

cmake_minimum_required (VERSION 3.20)

set(DIRECTXTEX_VERSION 1.9.9)
set(DIRECTXTEX_VERSION 2.0.0)

if(DEFINED XBOX_CONSOLE_TARGET)
set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY")
Expand Down Expand Up @@ -37,6 +37,8 @@ option(ENABLE_CODE_ANALYSIS "Use Static Code Analysis on build" OFF)

option(USE_PREBUILT_SHADERS "Use externally built HLSL shaders" OFF)

option(NO_WCHAR_T "Use legacy wide-character as unsigned short" OFF)

# Includes the functions for loading/saving OpenEXR files at runtime
option(ENABLE_OPENEXR_SUPPORT "Build with OpenEXR support" OFF)

Expand Down Expand Up @@ -399,6 +401,13 @@ if(MSVC)
target_link_options(${t} PRIVATE "$<$<NOT:$<CONFIG:DEBUG>>:/guard:ehcont>")
endforeach()
endif()

if(NO_WCHAR_T)
message(STATUS "Using non-native wchar_t as unsigned short")
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
target_compile_options(${t} PRIVATE "/Zc:wchar_t-")
endforeach()
endif()
else()
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
target_compile_definitions(${t} PRIVATE $<IF:$<CONFIG:DEBUG>,_DEBUG,NDEBUG>)
Expand Down
11 changes: 0 additions & 11 deletions 3rdParty/DirectXTex/CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,6 @@
"cacheVariables": { "DIRECTX_ARCH": "x86" },
"hidden": true
},
{
"name": "ARM",
"architecture": {
"value": "arm",
"strategy": "external"
},
"cacheVariables": { "DIRECTX_ARCH": "arm" },
"hidden": true
},
{
"name": "ARM64",
"architecture": {
Expand Down Expand Up @@ -188,8 +179,6 @@
{ "name": "x64-Release-UWP" , "description": "MSVC for x64 (Release) for UWP", "inherits": [ "base", "x64", "Release", "MSVC", "UWP" ] },
{ "name": "x86-Debug-UWP" , "description": "MSVC for x86 (Debug) for UWP", "inherits": [ "base", "x86", "Debug", "MSVC", "UWP" ] },
{ "name": "x86-Release-UWP" , "description": "MSVC for x86 (Release) for UWP", "inherits": [ "base", "x86", "Release", "MSVC", "UWP" ] },
{ "name": "arm-Debug-UWP" , "description": "MSVC for ARM (Debug) for UWP", "inherits": [ "base", "ARM", "Debug", "MSVC", "UWP" ] },
{ "name": "arm-Release-UWP" , "description": "MSVC for ARM (Release) for UWP", "inherits": [ "base", "ARM", "Release", "MSVC", "UWP" ] },
{ "name": "arm64-Debug-UWP" , "description": "MSVC for ARM64 (Debug) for UWP", "inherits": [ "base", "ARM64", "Debug", "MSVC", "UWP" ] },
{ "name": "arm64-Release-UWP", "description": "MSVC for ARM64 (Release) for UWP", "inherits": [ "base", "ARM64", "Release", "MSVC", "UWP" ] },

Expand Down
33 changes: 18 additions & 15 deletions 3rdParty/DirectXTex/DirectXTex/DirectXTex.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ struct IWICImagingFactory;
struct IWICMetadataQueryReader;
#endif

#define DIRECTX_TEX_VERSION 199
#define DIRECTX_TEX_VERSION 200


namespace DirectX
Expand Down Expand Up @@ -350,13 +350,13 @@ namespace DirectX
_In_reads_bytes_(size) const void* pSource, _In_ size_t size,
_In_ WIC_FLAGS flags,
_Out_ TexMetadata& metadata,
_In_opt_ std::function<void __cdecl(IWICMetadataQueryReader*)> getMQR = nullptr);
_In_ std::function<void __cdecl(IWICMetadataQueryReader*)> getMQR = nullptr);

HRESULT __cdecl GetMetadataFromWICFile(
_In_z_ const wchar_t* szFile,
_In_ WIC_FLAGS flags,
_Out_ TexMetadata& metadata,
_In_opt_ std::function<void __cdecl(IWICMetadataQueryReader*)> getMQR = nullptr);
_In_ std::function<void __cdecl(IWICMetadataQueryReader*)> getMQR = nullptr);
#endif

// Compatability helpers
Expand Down Expand Up @@ -554,31 +554,31 @@ namespace DirectX
_In_reads_bytes_(size) const void* pSource, _In_ size_t size,
_In_ WIC_FLAGS flags,
_Out_opt_ TexMetadata* metadata, _Out_ ScratchImage& image,
_In_opt_ std::function<void __cdecl(IWICMetadataQueryReader*)> getMQR = nullptr);
_In_ std::function<void __cdecl(IWICMetadataQueryReader*)> getMQR = nullptr);
HRESULT __cdecl LoadFromWICFile(
_In_z_ const wchar_t* szFile, _In_ WIC_FLAGS flags,
_Out_opt_ TexMetadata* metadata, _Out_ ScratchImage& image,
_In_opt_ std::function<void __cdecl(IWICMetadataQueryReader*)> getMQR = nullptr);
_In_ std::function<void __cdecl(IWICMetadataQueryReader*)> getMQR = nullptr);

HRESULT __cdecl SaveToWICMemory(
_In_ const Image& image, _In_ WIC_FLAGS flags, _In_ REFGUID guidContainerFormat,
_Out_ Blob& blob, _In_opt_ const GUID* targetFormat = nullptr,
_In_opt_ std::function<void __cdecl(IPropertyBag2*)> setCustomProps = nullptr);
_In_ std::function<void __cdecl(IPropertyBag2*)> setCustomProps = nullptr);
HRESULT __cdecl SaveToWICMemory(
_In_count_(nimages) const Image* images, _In_ size_t nimages,
_In_ WIC_FLAGS flags, _In_ REFGUID guidContainerFormat,
_Out_ Blob& blob, _In_opt_ const GUID* targetFormat = nullptr,
_In_opt_ std::function<void __cdecl(IPropertyBag2*)> setCustomProps = nullptr);
_In_ std::function<void __cdecl(IPropertyBag2*)> setCustomProps = nullptr);

HRESULT __cdecl SaveToWICFile(
_In_ const Image& image, _In_ WIC_FLAGS flags, _In_ REFGUID guidContainerFormat,
_In_z_ const wchar_t* szFile, _In_opt_ const GUID* targetFormat = nullptr,
_In_opt_ std::function<void __cdecl(IPropertyBag2*)> setCustomProps = nullptr);
_In_ std::function<void __cdecl(IPropertyBag2*)> setCustomProps = nullptr);
HRESULT __cdecl SaveToWICFile(
_In_count_(nimages) const Image* images, _In_ size_t nimages,
_In_ WIC_FLAGS flags, _In_ REFGUID guidContainerFormat,
_In_z_ const wchar_t* szFile, _In_opt_ const GUID* targetFormat = nullptr,
_In_opt_ std::function<void __cdecl(IPropertyBag2*)> setCustomProps = nullptr);
_In_ std::function<void __cdecl(IPropertyBag2*)> setCustomProps = nullptr);
#endif // WIN32

// Compatability helpers
Expand Down Expand Up @@ -699,11 +699,12 @@ namespace DirectX

HRESULT __cdecl ConvertEx(
_In_ const Image& srcImage, _In_ DXGI_FORMAT format, _In_ const ConvertOptions& options,
_Out_ ScratchImage& image, _In_opt_ std::function<bool __cdecl(size_t, size_t)> statusCallBack = nullptr);
_Out_ ScratchImage& image,
_In_ std::function<bool __cdecl(size_t, size_t)> statusCallBack = nullptr);
HRESULT __cdecl ConvertEx(
_In_reads_(nimages) const Image* srcImages, _In_ size_t nimages, _In_ const TexMetadata& metadata,
_In_ DXGI_FORMAT format, _In_ const ConvertOptions& options, _Out_ ScratchImage& result,
_In_opt_ std::function<bool __cdecl(size_t, size_t)> statusCallBack = nullptr);
_In_ std::function<bool __cdecl(size_t, size_t)> statusCallBack = nullptr);
// Convert the image to a new format

HRESULT __cdecl ConvertToSinglePlane(_In_ const Image& srcImage, _Out_ ScratchImage& image) noexcept;
Expand Down Expand Up @@ -810,11 +811,12 @@ namespace DirectX

HRESULT __cdecl CompressEx(
_In_ const Image& srcImage, _In_ DXGI_FORMAT format, _In_ const CompressOptions& options,
_Out_ ScratchImage& cImage, _In_opt_ std::function<bool __cdecl(size_t, size_t)> statusCallBack = nullptr);
_Out_ ScratchImage& cImage,
_In_ std::function<bool __cdecl(size_t, size_t)> statusCallBack = nullptr);
HRESULT __cdecl CompressEx(
_In_reads_(nimages) const Image* srcImages, _In_ size_t nimages, _In_ const TexMetadata& metadata,
_In_ DXGI_FORMAT format, _In_ const CompressOptions& options, _Out_ ScratchImage& cImages,
_In_opt_ std::function<bool __cdecl(size_t, size_t)> statusCallBack = nullptr);
_In_ std::function<bool __cdecl(size_t, size_t)> statusCallBack = nullptr);

#if defined(__d3d11_h__) || defined(__d3d11_x_h__)
HRESULT __cdecl Compress(
Expand All @@ -827,11 +829,12 @@ namespace DirectX

HRESULT __cdecl CompressEx(
_In_ ID3D11Device* pDevice, _In_ const Image& srcImage, _In_ DXGI_FORMAT format, _In_ const CompressOptions& options,
_Out_ ScratchImage& image, _In_opt_ std::function<bool __cdecl(size_t, size_t)> statusCallBack = nullptr);
_Out_ ScratchImage& image,
_In_ std::function<bool __cdecl(size_t, size_t)> statusCallBack = nullptr);
HRESULT __cdecl CompressEx(
_In_ ID3D11Device* pDevice, _In_ const Image* srcImages, _In_ size_t nimages, _In_ const TexMetadata& metadata,
_In_ DXGI_FORMAT format, _In_ const CompressOptions& options, _Out_ ScratchImage& cImages,
_In_opt_ std::function<bool __cdecl(size_t, size_t)> statusCallBack = nullptr);
_In_ std::function<bool __cdecl(size_t, size_t)> statusCallBack = nullptr);
#endif

HRESULT __cdecl Decompress(_In_ const Image& cImage, _In_ DXGI_FORMAT format, _Out_ ScratchImage& image) noexcept;
Expand Down
66 changes: 66 additions & 0 deletions 3rdParty/DirectXTex/DirectXTex/DirectXTexDDS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2762,6 +2762,72 @@ HRESULT DirectX::SaveToDDSFile(
return S_OK;
}


//--------------------------------------------------------------------------------------
// Adapters for /Zc:wchar_t- clients

#if defined(_MSC_VER) && !defined(_NATIVE_WCHAR_T_DEFINED)

namespace DirectX
{
HRESULT __cdecl GetMetadataFromDDSFile(
_In_z_ const __wchar_t* szFile,
_In_ DDS_FLAGS flags,
_Out_ TexMetadata& metadata) noexcept
{
return GetMetadataFromDDSFile(reinterpret_cast<const unsigned short*>(szFile), flags, metadata);
}

HRESULT __cdecl GetMetadataFromDDSFileEx(
_In_z_ const __wchar_t* szFile,
_In_ DDS_FLAGS flags,
_Out_ TexMetadata& metadata,
_Out_opt_ DDSMetaData* ddPixelFormat) noexcept
{
return GetMetadataFromDDSFileEx(reinterpret_cast<const unsigned short*>(szFile), flags, metadata, ddPixelFormat);
}

HRESULT __cdecl LoadFromDDSFile(
_In_z_ const __wchar_t* szFile,
_In_ DDS_FLAGS flags,
_Out_opt_ TexMetadata* metadata,
_Out_ ScratchImage& image) noexcept
{
return LoadFromDDSFile(reinterpret_cast<const unsigned short*>(szFile), flags, metadata, image);
}

HRESULT __cdecl LoadFromDDSFileEx(
_In_z_ const __wchar_t* szFile,
_In_ DDS_FLAGS flags,
_Out_opt_ TexMetadata* metadata,
_Out_opt_ DDSMetaData* ddPixelFormat,
_Out_ ScratchImage& image) noexcept
{
return LoadFromDDSFileEx(reinterpret_cast<const unsigned short*>(szFile), flags, metadata, ddPixelFormat, image);
}

HRESULT __cdecl SaveToDDSFile(
_In_ const Image& image,
_In_ DDS_FLAGS flags,
_In_z_ const __wchar_t* szFile) noexcept
{
return SaveToDDSFile(image, flags, reinterpret_cast<const unsigned short*>(szFile));
}

HRESULT __cdecl SaveToDDSFile(
_In_reads_(nimages) const Image* images,
_In_ size_t nimages,
_In_ const TexMetadata& metadata,
_In_ DDS_FLAGS flags,
_In_z_ const __wchar_t* szFile) noexcept
{
return SaveToDDSFile(images, nimages, metadata, flags, reinterpret_cast<const unsigned short*>(szFile));
}
}

#endif // !_NATIVE_WCHAR_T_DEFINED


//-------------------------------------------------------------------------------------
// Save a DDS file using the specified I/O callbacks
//-------------------------------------------------------------------------------------
Expand Down
33 changes: 33 additions & 0 deletions 3rdParty/DirectXTex/DirectXTex/DirectXTexHDR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1298,3 +1298,36 @@ HRESULT DirectX::SaveToHDRFile(const Image& image, const wchar_t* szFile) noexce

return S_OK;
}


//--------------------------------------------------------------------------------------
// Adapters for /Zc:wchar_t- clients

#if defined(_MSC_VER) && !defined(_NATIVE_WCHAR_T_DEFINED)

namespace DirectX
{
HRESULT __cdecl GetMetadataFromHDRFile(
_In_z_ const __wchar_t* szFile,
_Out_ TexMetadata& metadata) noexcept
{
return GetMetadataFromHDRFile(reinterpret_cast<const unsigned short*>(szFile), metadata);
}

HRESULT __cdecl LoadFromHDRFile(
_In_z_ const __wchar_t* szFile,
_Out_opt_ TexMetadata* metadata,
_Out_ ScratchImage& image) noexcept
{
return LoadFromHDRFile(reinterpret_cast<const unsigned short*>(szFile), metadata, image);
}

HRESULT __cdecl SaveToHDRFile(
_In_ const Image& image,
_In_z_ const __wchar_t* szFile) noexcept
{
return SaveToHDRFile(image, reinterpret_cast<const unsigned short*>(szFile));
}
}

#endif // !_NATIVE_WCHAR_T_DEFINED
2 changes: 2 additions & 0 deletions 3rdParty/DirectXTex/DirectXTex/DirectXTexP.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@
#pragma clang diagnostic ignored "-Wtautological-type-limit-compare"
#pragma clang diagnostic ignored "-Wunknown-pragmas"
#pragma clang diagnostic ignored "-Wundef"
#pragma clang diagnostic ignored "-Wunknown-warning-option"
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
#endif

#ifdef _WIN32
Expand Down
36 changes: 36 additions & 0 deletions 3rdParty/DirectXTex/DirectXTex/DirectXTexTGA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2522,3 +2522,39 @@ HRESULT DirectX::SaveToTGAFile(

return S_OK;
}


//--------------------------------------------------------------------------------------
// Adapters for /Zc:wchar_t- clients

#if defined(_MSC_VER) && !defined(_NATIVE_WCHAR_T_DEFINED)

namespace DirectX
{
HRESULT __cdecl GetMetadataFromTGAFile(
_In_z_ const __wchar_t* szFile,
_In_ TGA_FLAGS flags,
_Out_ TexMetadata& metadata) noexcept
{
return GetMetadataFromTGAFile(reinterpret_cast<const unsigned short*>(szFile), flags, metadata);
}

HRESULT __cdecl LoadFromTGAFile(
_In_z_ const __wchar_t* szFile,
_In_ TGA_FLAGS flags,
_Out_opt_ TexMetadata* metadata,
_Out_ ScratchImage& image) noexcept
{
return LoadFromTGAFile(reinterpret_cast<const unsigned short*>(szFile), flags, metadata, image);
}

HRESULT __cdecl SaveToTGAFile(_In_ const Image& image,
_In_ TGA_FLAGS flags,
_In_z_ const __wchar_t* szFile,
_In_opt_ const TexMetadata* metadata) noexcept
{
return SaveToTGAFile(image, flags, reinterpret_cast<const unsigned short*>(szFile), metadata);
}
}

#endif // !_NATIVE_WCHAR_T_DEFINED
Loading

0 comments on commit f8b70ae

Please sign in to comment.