Skip to content
Chuck Walbourn edited this page Dec 6, 2024 · 91 revisions

https://go.microsoft.com/fwlink/?LinkId=248926

OpenSSF Best Practices

GitHub All Releases GitHub Release Date

Nuget UWP Nuget Win32 Nuget Win10 Nuget VS 2017

GitHub last commit Code size

Azure DevOps VS 2019 Azure DevOps VS 2022

Azure DevOps GDK Azure DevOps GDK

Azure DevOps GDK Xbox Exts Azure DevOps GDK Xbox Exts

Azure DevOps CMake Azure DevOps CMake Latest

Azure DevOps WSL 9 Azure DevOps WSL 11 Azure DevOps MinGW

Azure DevOps test suite build Azure DevOps test suite build

DirectX Logo 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 supported by a built-in WIC codec.

See this blog post for an overview.

DirectXTex library

Texconv utility

Texassemble utility

Texdiag utility

DDSView sample

Image formats

Resources

NuGet

DirectXTex is also available from the NuGet Gallery:

vcpkg C++ Package Manager

DirectXTex has a vcpkg installation port as well.

Porting from D3DX

See this post for a complete listing of D3DX equivalents.

DirectXTex vs. DirectX Tool Kit

The DirectXTex library is designed a full-featured texture processing library that includes a sophisticated DDS file reader. This reader can handle numerous legacy formats and automatically performs required conversions. This makes it extremely useful in tools and content pipelines, but is far more code that is really needed for a game or application at runtime that loads 'cooked' textures.

Instead, a game or application should make use of DDSTextureLoader (DX9 / DX11 / DX12) and/or WICTextureLoader (DX9 / DX11 / DX12). These modules provide light-weight versions of texture creation from .dds, .bmp, .png, .gif, .jpg, .tif, and JPEG-XR / HD Photo files. ScreenGrab (DX9 / DX11 / DX12) is a light-weight screenshot capture utility for writing out the same file types.

These modules are included in DirectX Tool Kit (DX11 and DX12), and there are 'standalone' versions available in the DirectXTex distribution as well.

See Direct3D 11 Textures and Block Compression

Xbox

The xtexconv sample also includes some auxiliary platform-specific functionality for Xbox One XDK / Microsoft GDKX development, which are in the Auxiliary folder. This includes functions for tiling & de-tiling textures, and a variant .DDS file reader/writer for storing tiled textures. The DirectX Tool Kit includes the XboxDDSTextureLoader DX11 / DX12 for using placement texture creation using this DDS file variant.

BC/DXT compression

The implementation of BC1-BC7 software compression & decompression in this library comes from the D3DX library, with some fixes included from Xbox variant libraries (XGraphics) for BC1-5. The intent of the software library here is a 'reference' compression scheme for these formats. In other words, it should always be as good as or better than legacy D3DX9/D3DX10/D3DX11.

The GPU implementation of BC6H/BC7 is from the BC6HBC7EncoderCS DirectCompute 4.0 sample that originally shipped in the legacy DirectX SDK.

IHV compressors

The various video independent hardware vendors (IHVs) have their own texture toolsets as well.

Note that the NVIDIA tools haven't been updated in some time, and are currently missing support for the DX10 header extension, BC6H, and BC7.

OSS libraries

Support

For questions, consider using Stack Overflow with the directxtk tag, or the DirectX Discord Server in the dx12-developers or dx9-dx11-developers channel.

For bug reports and feature requests, please use GitHub issues for this project.

Security

The DirectXTex library functions are invoked by client code. While effort is made to validate parameters and arguments in code, the client code is responsible for validating any relevant user-input. The primary security focus for DirectXTex is the image loading code which process potentially untrusted content from disk/memory. When using Windows Imaging Component (WIC), that component has a strong security guarantee and validation story for security vulnerabilities. For the custom DDS, HDR, and TGA codecs, significant hardening and validation has been applied and the code is subject to file-fuzzing.

This project is subject to Microsoft's Open Source Security Policy.

For a list of known vulnerabilities, see GitHub.

Roadmap

Planned work is implementing DirectX12 features like the DirectCompute-based GPU BC6/BC7 codec (currently only supports DirectX 11), and an implementation of Standard Swizzle.

New command-line tools are planned texenvmap for generating various styles of environment maps, and textile for processing data for texture tiling.

Contributing

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.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

Tests for new features should also be submitted as a PR to the Test Suite repository.

Information on coding-style can be found here.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Trademarks

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. 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.

Credits

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.

Thanks to Paul Penson for his help with the implementation of MemoryStreamOnBlob.

Thanks to Andrew Farrier and Scott Matloff for their on-going help with code reviews.

Thanks to Park DongHa for their contribution of the JPEG/PNG auxiliary functions.

Thanks to Isaac Plunkett, Danny Chen, Jesse Natalie, and James Stanard for their help with the Standard Swizzle implementation.

For Use

  • Universal Windows Platform apps
  • Windows desktop apps
  • Windows 11
  • Windows 10
  • Windows 8.1
  • Xbox One
  • Xbox Series X|S
  • Windows Subsystem for Linux

Architecture

  • x86
  • x64
  • ARM64

For Development

  • Visual Studio 2022
  • Visual Studio 2019 (16.11)
  • clang/LLVM v12 - v18
  • GCC 10.5, 11.4, 12.3
  • MinGW 12.2, 13.2
  • CMake 3.20

Related Projects

DirectXTex Rust bindings

DirectX Tool Kit for DirectX 11

DirectX Tool Kit for DirectX 12

DirectXMesh

DirectXMath

Tools

Test Suite

Content Exporter

DxCapsViewer

See also

DirectX Landing Page

Clone this wiki locally