Skip to content

Commit 9654b6e

Browse files
committed
Updated for DirectXTex November 2021 release
1 parent 0095b8a commit 9654b6e

File tree

15 files changed

+132
-93
lines changed

15 files changed

+132
-93
lines changed

Kits/DirectXTex/BC.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ namespace
6969
uint32_t cSteps,
7070
uint32_t flags) noexcept
7171
{
72-
static const float fEpsilon = (0.25f / 64.0f) * (0.25f / 64.0f);
72+
constexpr float fEpsilon = (0.25f / 64.0f) * (0.25f / 64.0f);
7373
static const float pC3[] = { 2.0f / 2.0f, 1.0f / 2.0f, 0.0f / 2.0f };
7474
static const float pD3[] = { 0.0f / 2.0f, 1.0f / 2.0f, 2.0f / 2.0f };
7575
static const float pC4[] = { 3.0f / 3.0f, 2.0f / 3.0f, 1.0f / 3.0f, 0.0f / 3.0f };

Kits/DirectXTex/BCDirectCompute.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ using Microsoft::WRL::ComPtr;
2020

2121
namespace
2222
{
23-
#include "Shaders\Compiled\BC7Encode_EncodeBlockCS.inc"
24-
#include "Shaders\Compiled\BC7Encode_TryMode02CS.inc"
25-
#include "Shaders\Compiled\BC7Encode_TryMode137CS.inc"
26-
#include "Shaders\Compiled\BC7Encode_TryMode456CS.inc"
27-
#include "Shaders\Compiled\BC6HEncode_EncodeBlockCS.inc"
28-
#include "Shaders\Compiled\BC6HEncode_TryModeG10CS.inc"
29-
#include "Shaders\Compiled\BC6HEncode_TryModeLE10CS.inc"
23+
#include "BC7Encode_EncodeBlockCS.inc"
24+
#include "BC7Encode_TryMode02CS.inc"
25+
#include "BC7Encode_TryMode137CS.inc"
26+
#include "BC7Encode_TryMode456CS.inc"
27+
#include "BC6HEncode_EncodeBlockCS.inc"
28+
#include "BC6HEncode_TryModeG10CS.inc"
29+
#include "BC6HEncode_TryModeLE10CS.inc"
3030

3131
struct BufferBC6HBC7
3232
{

Kits/DirectXTex/DirectXTex.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ struct IWICImagingFactory;
4747
struct IWICMetadataQueryReader;
4848
#endif
4949

50-
#define DIRECTX_TEX_VERSION 193
50+
#define DIRECTX_TEX_VERSION 195
5151

5252

5353
namespace DirectX

Kits/DirectXTex/DirectXTexConvert.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ namespace
159159
DirectX::XMFLOAT3A tmp;
160160
DirectX::XMStoreFloat3A(&tmp, V);
161161

162-
static const float maxf9 = float(0x1FF << 7);
163-
static const float minf9 = float(1.f / (1 << 16));
162+
constexpr float maxf9 = float(0x1FF << 7);
163+
constexpr float minf9 = float(1.f / (1 << 16));
164164

165165
float x = (tmp.x >= 0.f) ? ((tmp.x > maxf9) ? maxf9 : tmp.x) : 0.f;
166166
float y = (tmp.y >= 0.f) ? ((tmp.y > maxf9) ? maxf9 : tmp.y) : 0.f;

Kits/DirectXTex/DirectXTexResize.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ namespace
254254
assert(srcImage.format == destImage.format);
255255

256256
// Allocate temporary space (2 scanlines)
257-
auto scanline = make_AlignedArrayXMVECTOR(srcImage.width + destImage.width);
257+
auto scanline = make_AlignedArrayXMVECTOR(uint64_t(srcImage.width) + destImage.width);
258258
if (!scanline)
259259
return E_OUTOFMEMORY;
260260

Kits/DirectXTex/DirectXTexWIC.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ namespace
390390
return E_NOTIMPL;
391391
}
392392

393-
HRESULT STDMETHODCALLTYPE Revert(void) override
393+
HRESULT STDMETHODCALLTYPE Revert() override
394394
{
395395
return E_NOTIMPL;
396396
}
@@ -635,7 +635,7 @@ namespace
635635
}
636636
#endif
637637

638-
(void)PropVariantClear(&value);
638+
std::ignore = PropVariantClear(&value);
639639

640640
if (sRGB)
641641
metadata.format = MakeSRGB(metadata.format);
@@ -889,65 +889,65 @@ namespace
889889
if (memcmp(&containerFormat, &GUID_ContainerFormatPng, sizeof(GUID)) == 0)
890890
{
891891
// Set Software name
892-
(void)metawriter->SetMetadataByName(L"/tEXt/{str=Software}", &value);
892+
std::ignore = metawriter->SetMetadataByName(L"/tEXt/{str=Software}", &value);
893893

894894
// Set sRGB chunk
895895
if (sRGB)
896896
{
897897
value.vt = VT_UI1;
898898
value.bVal = 0;
899-
(void)metawriter->SetMetadataByName(L"/sRGB/RenderingIntent", &value);
899+
std::ignore = metawriter->SetMetadataByName(L"/sRGB/RenderingIntent", &value);
900900
}
901901
else
902902
{
903903
// add gAMA chunk with gamma 1.0
904904
value.vt = VT_UI4;
905905
value.uintVal = 100000; // gama value * 100,000 -- i.e. gamma 1.0
906-
(void)metawriter->SetMetadataByName(L"/gAMA/ImageGamma", &value);
906+
std::ignore = metawriter->SetMetadataByName(L"/gAMA/ImageGamma", &value);
907907

908908
// remove sRGB chunk which is added by default.
909-
(void)metawriter->RemoveMetadataByName(L"/sRGB/RenderingIntent");
909+
std::ignore = metawriter->RemoveMetadataByName(L"/sRGB/RenderingIntent");
910910
}
911911
}
912912
#if (defined(_XBOX_ONE) && defined(_TITLE)) || defined(_GAMING_XBOX)
913913
else if (memcmp(&containerFormat, &GUID_ContainerFormatJpeg, sizeof(GUID)) == 0)
914914
{
915915
// Set Software name
916-
(void)metawriter->SetMetadataByName(L"/app1/ifd/{ushort=305}", &value);
916+
std::ignore = metawriter->SetMetadataByName(L"/app1/ifd/{ushort=305}", &value);
917917

918918
if (sRGB)
919919
{
920920
// Set EXIF Colorspace of sRGB
921921
value.vt = VT_UI2;
922922
value.uiVal = 1;
923-
(void)metawriter->SetMetadataByName(L"/app1/ifd/exif/{ushort=40961}", &value);
923+
std::ignore = metawriter->SetMetadataByName(L"/app1/ifd/exif/{ushort=40961}", &value);
924924
}
925925
}
926926
else if (memcmp(&containerFormat, &GUID_ContainerFormatTiff, sizeof(GUID)) == 0)
927927
{
928928
// Set Software name
929-
(void)metawriter->SetMetadataByName(L"/ifd/{ushort=305}", &value);
929+
std::ignore = metawriter->SetMetadataByName(L"/ifd/{ushort=305}", &value);
930930

931931
if (sRGB)
932932
{
933933
// Set EXIF Colorspace of sRGB
934934
value.vt = VT_UI2;
935935
value.uiVal = 1;
936-
(void)metawriter->SetMetadataByName(L"/ifd/exif/{ushort=40961}", &value);
936+
std::ignore = metawriter->SetMetadataByName(L"/ifd/exif/{ushort=40961}", &value);
937937
}
938938
}
939939
#else
940940
else
941941
{
942942
// Set Software name
943-
(void)metawriter->SetMetadataByName(L"System.ApplicationName", &value);
943+
std::ignore = metawriter->SetMetadataByName(L"System.ApplicationName", &value);
944944

945945
if (sRGB)
946946
{
947947
// Set EXIF Colorspace of sRGB
948948
value.vt = VT_UI2;
949949
value.uiVal = 1;
950-
(void)metawriter->SetMetadataByName(L"System.Image.ColorSpace", &value);
950+
std::ignore = metawriter->SetMetadataByName(L"System.Image.ColorSpace", &value);
951951
}
952952
}
953953
#endif
@@ -1109,7 +1109,7 @@ namespace
11091109
VARIANT varValue;
11101110
varValue.vt = VT_BOOL;
11111111
varValue.boolVal = VARIANT_TRUE;
1112-
(void)props->Write(1, &option, &varValue);
1112+
std::ignore = props->Write(1, &option, &varValue);
11131113
}
11141114

11151115
if (setCustomProps)

Kits/DirectXTex/DirectXTexXboxDDS.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ namespace
4444

4545
#pragma pack(pop)
4646

47-
static const uint32_t XBOX_TILEMODE_SCARLETT = 0x1000000;
47+
constexpr uint32_t XBOX_TILEMODE_SCARLETT = 0x1000000;
4848

4949
static_assert(sizeof(DDS_HEADER_XBOX) == 36, "DDS XBOX Header size mismatch");
5050
static_assert(sizeof(DDS_HEADER_XBOX) >= sizeof(DDS_HEADER_DXT10), "DDS XBOX Header should be larger than DX10 header");
5151

52-
static const size_t XBOX_HEADER_SIZE = sizeof(uint32_t) + sizeof(DDS_HEADER) + sizeof(DDS_HEADER_XBOX);
52+
constexpr size_t XBOX_HEADER_SIZE = sizeof(uint32_t) + sizeof(DDS_HEADER) + sizeof(DDS_HEADER_XBOX);
5353

5454
//-------------------------------------------------------------------------------------
5555
// Decodes DDS header using XBOX extended header (variant of DX10 header)

Kits/DirectXTex/DirectXTex_XboxOneXDK_PC_2015.vcxproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
<PreprocessorDefinitions>_UNICODE;UNICODE;WIN32;_DEBUG;_LIB;_WIN7_PLATFORM_UPDATE;_WIN32_WINNT=0x0601;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
8484
<PrecompiledHeader>Use</PrecompiledHeader>
8585
<PrecompiledHeaderFile>DirectXTexP.h</PrecompiledHeaderFile>
86+
<AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)Shaders\Compiled;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
8687
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
8788
<SDLCheck>true</SDLCheck>
8889
</ClCompile>
@@ -111,6 +112,7 @@
111112
<PreprocessorDefinitions>_UNICODE;UNICODE;WIN32;NDEBUG;_LIB;_WIN7_PLATFORM_UPDATE;_WIN32_WINNT=0x0601;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
112113
<PrecompiledHeader>Use</PrecompiledHeader>
113114
<PrecompiledHeaderFile>DirectXTexP.h</PrecompiledHeaderFile>
115+
<AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)Shaders\Compiled;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
114116
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
115117
<SDLCheck>true</SDLCheck>
116118
</ClCompile>
@@ -141,6 +143,7 @@
141143
<PreprocessorDefinitions>_UNICODE;UNICODE;WIN32;NDEBUG;PROFILE;_LIB;_WIN7_PLATFORM_UPDATE;_WIN32_WINNT=0x0601;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
142144
<PrecompiledHeader>Use</PrecompiledHeader>
143145
<PrecompiledHeaderFile>DirectXTexP.h</PrecompiledHeaderFile>
146+
<AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)Shaders\Compiled;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
144147
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
145148
<SDLCheck>true</SDLCheck>
146149
</ClCompile>

Kits/DirectXTex/DirectXTexp.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,15 @@
9393
#endif
9494

9595
#ifdef _GAMING_XBOX_SCARLETT
96+
#pragma warning(push)
97+
#pragma warning(disable: 5204 5249)
9698
#include <d3d12_xs.h>
99+
#pragma warning(pop)
97100
#elif defined(_GAMING_XBOX)
101+
#pragma warning(push)
102+
#pragma warning(disable: 5204)
98103
#include <d3d12_x.h>
104+
#pragma warning(pop)
99105
#elif defined(_XBOX_ONE) && defined(_TITLE)
100106
#include <d3d12_x.h>
101107
#include <d3d11_x.h>
@@ -124,6 +130,7 @@
124130
#include <iterator>
125131
#include <memory>
126132
#include <new>
133+
#include <tuple>
127134

128135
#ifndef WIN32
129136
#include <fstream>
@@ -144,7 +151,11 @@
144151
#include <malloc.h>
145152

146153
#ifdef WIN32
154+
#ifdef NTDDI_WIN10_FE
155+
#include <ole2.h>
156+
#else
147157
#include <Ole2.h>
158+
#endif
148159
#include <wincodec.h>
149160
#include <wrl\client.h>
150161
#else

Kits/DirectXTex/README.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
![DirectX Logo](https://github.com/Microsoft/DirectXTex/wiki/X_jpg.jpg)
1+
![DirectX Logo](https://raw.githubusercontent.com/wiki/Microsoft/DirectXTex/X_jpg.jpg)
22

33
# DirectXTex texture processing library (Xbox variant)
44

55
http://go.microsoft.com/fwlink/?LinkId=248926
66

77
Copyright (c) Microsoft Corporation.
88

9-
**June 9, 2021**
9+
**November 8, 2021**
1010

1111
This package contains 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 ``.TGA`` and ``.HDR`` readers and writers since these image file formats are commonly used for texture content processing pipelines, but are not currently supported by a built-in WIC codec.
1212

13-
This code is designed to build with Visual Studio 2017 ([15.9](https://walbourn.github.io/vs-2017-15-9-update/)), Visual Studio 2019, or clang for Windows v9 or later. It is recommended that you make use of the Windows 10 May 2020 Update SDK ([19041](https://walbourn.github.io/windows-10-may-2020-update-sdk/)) or later.
13+
This code is designed to build with Visual Studio 2017 ([15.9](https://walbourn.github.io/vs-2017-15-9-update/)), Visual Studio 2019, Visual Studio 2022, or clang for Windows v11 or later. Use of the Windows 10 May 2020 Update SDK ([19041](https://walbourn.github.io/windows-10-may-2020-update-sdk/)) or later is required.
1414

1515
These components are designed to work without requiring any content from the legacy DirectX SDK. For details, see [Where is the DirectX SDK?](https://aka.ms/dxsdk).
1616

@@ -87,10 +87,16 @@ For the latest version of DirectXTex, bug reports, etc. please visit the project
8787

8888
* Loading of 96bpp floating-point TIFF files results in a corrupted image prior to Windows 8. This fix is available on Windows 7 SP1 with KB 2670838 installed.
8989

90-
* The UWP projects and the VS 2019 Win10 classic desktop project include configurations for the ARM64 platform. These require VS 2017 (15.9 update) or VS 2019 to build, with the ARM64 toolset installed.
90+
* The UWP projects and the Win10 classic desktop project include configurations for the ARM64 platform. These require VS 2017 (15.9 update) or later to build, with the ARM64 toolset installed.
9191

9292
* The ``CompileShaders.cmd`` script must have Windows-style (CRLF) line-endings. If it is changed to Linux-style (LF) line-endings, it can fail to build all the required shaders.
9393

94+
## Support
95+
96+
For questions, consider using [Stack Overflow](https://stackoverflow.com/questions/tagged/directxtk) with the *directxtk* tag, or the [DirectX Discord Server](https://discord.gg/directx) in the *dx12-developers* or *dx9-dx11-developers* channel.
97+
98+
For bug reports and feature requests, please use GitHub [issues](https://github.com/microsoft/DirectXTex/issues) for this project.
99+
94100
## Contributing
95101

96102
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
@@ -102,3 +108,9 @@ This project has adopted the [Microsoft Open Source Code of Conduct](https://ope
102108
## Trademarks
103109

104110
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow [Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general). Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.
111+
112+
## Credits
113+
114+
The DirectXTex library is the work of Chuck Walbourn, with contributions from Matt Lee, Xin Huang, Craig Peeper, and the numerous other Microsoft engineers who developed the D3DX utility library over the years.
115+
116+
Thanks to Paul Penson for his help with the implementation of ``MemoryStreamOnBlob``.

0 commit comments

Comments
 (0)