This DirectXTex sample is an implementation of the "texconv" command-line texture utility from the DirectX SDK utilizing DirectXTex rather than D3DX.To create cubemaps, volume maps, or texture arrays from individual files, use Texassemble
Texconv.exe uses the following command syntax:
texconv [-w number] [-h number] [-m number] [-f format] [-if filter] [-srgb | -srgbi | -srgbo] [-px string] [-sx string] [-o directory] [-ft file-type] [-hflip] [-vflip] [-sepalpha] [-wrap | -mirror] [-pmalpha] [-fl feature-level] [-pow2] [-tu | -tf] [-dword] [-xlum] [-dx10] [-nologo] [-singleproc] [-nogpu] [-aw number] <file-name(s)>
The file-name parameter indicates the file(s) to convert.
The optional command-line switches are described in the following table.
Optional Switches Description
- -w number Width of the output texture in pixels.
- -h number Height of the output texture in pixels.
- -m number Number of mipmap levels to generate in the output texture. This setting only applies to DDS output.
- -f format Output format. Specify the DXGI format without the DXGI_FORMAT_ prefix (i.e. "-f BC1_UNORM").
- -if filter Image filter. Use one of the following: POINT, LINEAR, CUBIC, FANT, BOX, TRIANGLE, POINT_DITHER, LINEAR_DITHER, CUBIC_DITHER, FANT_DITHER, BOX_DITHER, TRIANGLE_DITHER, POINT_DITHER_DIFFUSION, LINEAR_DITHER_DIFFUSION, CUBIC_DITHER_DIFFUSION, FANT_DITHER_DIFFUSION, BOX_DITHER_DIFFUSION, or TRIANGLE_DITHER_DIFFUSION. Filters with DITHER in their name indicate that the 4x4 ordered dither algorithm, while "DITHER_DIFFUSION" is error diffusion dithering.
- -srgb, -srgbi, or -srgbo Use sRGB if both the input and output data are in the sRGB color format (ie. gamma ~2.2). Use sRGBi if only the input is in sRGB; use sRGBo if only the output is in sRGB.
- -px string Text string to attach to the front of the resulting texture's name.
- -sx string Text string to attach to the end of the resulting texture's name.
- -o directory Output directory.
- -ft file-type A file type for the output texture. Use one of the following: bmp, dds, jpg, png, or tiff. The default value is dds.
- -hflip Perform horizonal flip of image
- -vflip Perform horizonal flip of image
- -sepalpha Separates alpha channel for resize/mipmap generation. This implies an alpha mode setting of DDS_ALPHA_MODE_CUSTOM as this is typically only used if the alpha channel doesn't contain transparency information.
- -wrap, -mirror Sets the texture addressing mode for filtering to wrap or mirror, otherwise defaults to clamp.
- -pmalpha Converts the final texture data to use premultiplied alpha. This sets an alpha mode of DDS_ALPHA_MODE_PREMULTIPLIED unless the entire alpha channel is fully opaque.
- -pow2 Fits each texture to a power-of-2 for width & height, minimizing changes to the aspect ratio.
- -fl feature-level Sets the target feature level which determines the maximum supported texture size. Defaults to "11.0" which is 16834, the limit for 11.0 and 11.1 Feature Level hardware.
- -tu DDS files with TYPELESS formats are treated as UNORM
- -tf DDS files with TYPELESS formats are treated as FLOAT
- -dword For DDS files use a DWORD alignment instead of BYTE alignment (used for some legacy files)
- -xlum DDS files with L8, A8L8, or L16 formats are expanded to 8:8:8:8 or 16:16:16:16
- -dx10 Forces DDS file output to always use the "DX10" header extension, and allows the writing of alpha mode metadata information. The resulting file may not be compatible with the legacy D3DX10 or D3DX11 libraries.
- -nologo Suppress copyright message.
- -singleproc If the DirectXTex library and the texconv utility are built with OpenMP enabled, by default the tool will use multi-threading for CPU-based compression of BC6H and BC7 formats to spread the compression work across multiple cores. This flag disables this behavior forcing it to remain on a single core.
- -nogpu When compressing BC6H / BC7 content, texconv will use DirectCompute on the GPU if available. Use of this flag forces texconv to always use the software codec instead.
- -aw number Provides an alpha weighting to use with the error metric for the BC7 GPU compressor. Defaults to 1.0.