The DirectXTex library includes a full-featured DDS reader and writer including legacy format conversions, a TGA reader and writer, a WIC-based bitmap reader and writer (BMP, JPEG, PNG, TIFF, and HD Photo), and various texture processing
functions. This is intended primarily for tool usage.
The library assumes that the client code will have already called CoInitialize or CoInitializeEx as needed by the application before calling any DirectXTex routines
NOTE: DirectXTex is not supported on Windows Phone 8, because WIC is not available on that platform. The .DDS files it generates are suitable for use on Windows Phone 8 assuming the pixel format is supported by the device (currently Feature Level 9.3).
The majority of the header files here are intended for internal implementation of the library only (BC.h, DDS.h, DirectXTexP.h, and scoped.h). Only DirectXTex.h is meant as a 'public' header for the library.
All the functions in the library are in the "DirectX" C++ namespace.
DDS I/O Functions
TGA I/O Functions
WIC I/O Functions
Direct3D 11 Helper Functions
contains metadata information about the texture resource and organization such as width, height, depth, format, dimension, etc.
- TEX_DIMENSION_TEXTURE1D, TEX_DIMENSION_TEXTURE2D, and TEX_DIMENSION_TEXTURE3D are alises for D3D10_RESOURCE_DIMEMSION and D3D11_RESOURCE_DIMENSION.
- TEX_MISC_TEXTURECUBE is an alias for the same D3D10_RESOURCE_MISC_FLAG and D3D11_RESOURCE_MISC_FLAG.
contains information about the surface including width, height, format, pitch, and a pointer to pixel data.
is a helper class that manages memory for functions that return a Image or set of Images.
is a helper class that manages for functions that return a binary blob of data.
contains a simple pixel-based rectangle used by the CopyRectangle
Adding to a VS Project
In your application's solution, right-click on the Solution and use "Add \ Existing Project..." to add the appropriate .vcxproj file to your solution.
In your application's project, right-click on the Project and use "References...", then "Add New Reference...", and then check the DirectXTex project name and click OK. For a
Windows Store app
, you need to set Reference Assembly Output
since DirectXTex is a static C++ library and not a WinRT component.
In your application's project settings, on the "C++ / General" page set Configuration to "All Configurations", set Platform to "All Platforms", and then add the relative path to
to the Additional Include Directories
properties. Click Apply.
- The DirectXTex library does not support block compression or decompression of mipmapped non-power-of-2 textures, although
DDSTextureLoader will load these files correctly if the underlying device supports it.
CodePlex issue 640
- The DirectXTex library only supports CLAMP filtering, and does not yet support MIRROR or WRAP filtering (WIC operations only support CLAMP filtering).
CodePlex issue 641
- The DirectXTex library only supports box and POINT filtering, and does not support LINEAR or CUBIC filtering, for 3D volume mipmap-generation.
CodePlex issue 642
- The WIC conversion cases currently ignore TEX_FILTER_SRGB_IN and TEX_FILTER_SRGB_OUT out, which results in incorrect sRGB handling in a number of cases.
CodePlex issue 643
- Due to the underlying Windows BMP WIC codec, alpha channels are not supported for 16bpp or 32bpp BMP pixel format files. The Windows 8 version of the Windows BMP WIC codec does support 32bpp pixel formats with alpha when using the BITMAPV5HEADER file header.
- For the DXGI 1.1 version of DirectXTex, 4:4:4:4 pixel format DDS files are always expanded to 8:8:8:8 upon load since DXGI 1.0 and DXGI 1.1 versions of Direct3D do not support these resource formats. The DXGI 1.2 version (indicated by #define DXGI_1_2_FORMATS)
of DirectXTex make use of the DXGI_FORMAT_B4G4R4A4_UNORM format instead.
- While DXGI 1.0 and DXGI 1.1 include 5:6:5 (DXGI_FORMAT_B5G6R5_UNORM) and 5:5:5:1 (DXGI_FORMAT_B5G5R5A1_UNORM) pixel format enumerations, the DirectX 10.x and 11.0 Runtimes do not support these formats for use with Direct3D. The DirectX 11.1 runtime, DXGI
1.2, and the WDDM 1.2 driver model fully support 16bpp formats (5:6:5, 5:5:5:1, and 4:4:4:4).
- 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.