What are 'typeless' DXGI texture formats in DirectX?

Viewed 1353

There are various texture formats in directX: https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format

most are clear, but what are 'typeless' textures? for example, for BC6H, there are

DXGI_FORMAT_BC6H_TYPELESS,
DXGI_FORMAT_BC6H_UF16,
DXGI_FORMAT_BC6H_SF16,

UF16 is unsigned float and SF16 is signed float and at least the encoder https://docs.microsoft.com/en-us/windows/win32/direct3d11/bc6h-format (maybe the decoder too?) seems to care about whether the format is signed or unsigned.

But what means 'typeless'? how is such a texture encoded and decoded?

1 Answers

The "typeless" variants of DXGI formats are for special cases where you can change the way the data is interpreted. This allows you to create the resource (i.e. the actual "bag of bits") with the correct memory layout for the hardware (i.e. using a _TYPELESS format), and then you can create more than one view object using the specific type you want. This effectively lets you do the equivalent of a "C++ cast" in limited cases.

The most common cases for using typeless is dealing with depth/stencil formats, doing RGB swizzling a shader, and in DirectCompute implemented BC codecs. It's not a thing you use often, but when you do the option of loosening the type validation comes in handy.

For some examples of using typeless DXGI formats, see the directx-sdk-samples GitHub and look at AdaptiveTessellationCS40, BasicCompute11, CascadedShadowMaps11, MultithreadedRendering11, and VarianceShadows11.

For Xbox development, there are a few more cases where _TYPELESS comes in handy because it's a Unified Memory Access (UMA) architecture, but these bend the validation rules of 'stock' Direct3D.

See Microsoft Docs and the Direct3D 11.3 specification.

Related