DirectXTex
codeplex, conference, ddsOriginally posted to Chuck Walbourn's Blog on MSDN,
As part of my Gamefest 2011 presentation Modern Texture Content Pipelines (link), I demonstrated the “DirectXTex” library which is a shared source implementation of DDS file I/O (including the “DX10” header extension), texture content processing operations (resize, format conversion, mip-map-generation), software block compression (BC1 - BC7), height-map to normal-map conversion, and a simple .TGA file reader and writer.
The attached package includes:
- The DirectXTex library
- Texconv, a sample using DirectXTex that is a command-line tool replacement for the DirectX SDK Texture Conversion Tool (Extended)
- DDSView, a simple DDS viewer sample using DirectXTex
- DDSTextureLoader, a light-weight DDS loader for DirectX 11 applications
- WICTextureLoader, a WIC-based image loader for creating simple 2D textures with auto-gen mipmaps for DirectX 11 applications
- ScreenGrab, a light-weight screen shot saver for DirectX 11 applications
A copy of XNAMath 2.04, which is required to build the DirectXTex library with VS 2010
See the ReadMe file in the package for more details.
Platforms: The code is designed to build with the Windows 8.x SDK using Visual Studio 2010, 2012, or 2013 and works on Windows Vista, Windows 7, Windows 8.x Win32 desktop, Windows Store apps, Windows phone 8.1, and Xbox One.
Note: DDSTextureLoader, WICTextureLoader, and ScreenGrab are also provided in the DirectX Tool Kit for DX11 / DX12
Porting Notes
Here's a handy table of equivalents for D3DX (see Living without D3DX for a complete listing):
D3DX11ComputeNormalMap |
|
D3DX11CreateShaderResourceViewFromFile |
-or-
|
D3DX11CreateShaderResourceViewFromResource |
-or-
|
D3DX11CreateTextureFromFile |
-or-
|
D3DX11CreateTextureFromResource |
-or-
|
D3DX11FilterTexture |
|
D3DX11GetImageInfoFromFile |
|
D3DX11GetImageInfoFromResource |
|
D3DX11LoadTextureFromTexture |
|
D3DX11SaveTextureToFile |
-or-
|
D3DX11SaveTextureToMemory |
|
Where XXX is “DDS” for working with .DDS files, “WIC” for working with WIC-supported bitmap image formats such as .BMP, .JPG, .PNG, etc. or “TGA” for working with Targa Truvision files. Note that .TGA
is supported by legacy D3DX and by DirectXTex, but not by WICTextureLoader or DirectXTK.
UPDATE: DirectXTex now also supports .HDR
files. See this post. The XXX above would be “HDR”.
Note
There is another version of the Texconv sample with the DirectXTex library that uses DirectXMath with DXGI 1.2 support available on the Windows SDK Samples Code Gallery. It can be built using either Visual Studio 2012 or VS 2010 with the new Windows SDK. There is also a Windows Store app (a.k.a. Metro style app) version of the DDSTextureLoader there as well. The Windows SDK Samples Code Gallery version of DirectXTex can be made to run on Windows Vista and Windows 7 by adding _WIN32_WINNT=0x0600
to the Preprocessor Definitions.
Update: DirectXTex is now hosted on CodePlexGitHub. The latest version of the library, documentation, notes on future work, release history, and other information is now available there.
vcpkg: The vcpkg C++ Package Manager has a directxtex port available.
Related: DirectX Tool Kit for DX11, DirectXMesh, DirectX Tool Kit for DX12