Skip to content

Texdiag

Chuck Walbourn edited this page Sep 25, 2016 · 32 revisions

DirectXTex sample is a command-line utility analyzing the content of images.

This tool is primarily used for debugging and development purposes.

Syntax

Texdiag.exe uses the following command syntax:

texdiag <command> [-r]
[-if filter] [-tu | -tf] [-dword] [-badtails] [-xlum]
[-targetx <num>] [-targety <num>] [-nologo]
<file-name(s)>

The file-name parameter indicates the file(s) to diagnose using dds, tga, hdr, or a WIC-supported format (bmp, jpg, png, jxr, etc.).

Commands

info: Outputs image metadata information such as width, height, format, etc.

analyze: Analyzes the image and generates statistics.

compare: Compares two images and returns the mean-square-error and peak-signal-to-noise ratio between them. Images must be the same size in width & height.

dumpbc: Prints out the content of a BC compressed image in a human readable form. Can output all blocks or just a block for a given target pixel.

Optional Switches Description

-r: Input file names can contain wildcard characters (? or *). If this switch is used, subdirectories are also searched.

-if filter: Image filter used for loading WIC-based images required for some formats. 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.

-tu: DDS files with TYPELESS formats are treated as UNORM
-tf: DDS files with TYPELESS formats are treated as FLOAT

Generally typeless formats will fail most operations, so these options let you override the type.

-dword: For DDS files that use a DWORD alignment instead of BYTE alignment (used for some legacy files typically 24bpp).

-badtails: For older DDS files that incorrectly encode the DXTn block compression mipchain surface blocks smaller than 4x4. This switch causes the loader to tolerate the slightly too short file length and to copy the 4x4 blocks to the smaller ones. The result is not identical to re-computing computing the mipchain fully, but does provide non-corrupted data.

-xlum: DDS files with L8, A8L8, or L16 formats are expanded to 8:8:8:8 or 16:16:16:16. Without this flag, they are converted to 1-channel (red) or 2-channel (red/green) formats.

-targetx num, -targety num: Provides a target pixel location for the dumpbc command. For DDS files with mipmap chains it will match the block that maps to the pixel location in subsequently lower mip-levels. By default dumpbc dumps out all blocks.

-nologo: Suppress copyright message.

Examples

texdiag info reftexture.dds

Results in the following output:

reftexture.dd
        width = 256
       height = 256
        depth = 1
    mipLevels = 9
    arraySize = 1
       format = B8G8R8A8_UNORM
    dimension = 2D
   alpha mode = Unknown

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