Format conversion functions (HLSL reference)

The section contains the format conversion functions used in Compute and Pixel Shaders.

The D3DX_DXGIFormatConvert.inl header ships in the legacy DirectX SDK and relied on XNAMath for C++ support. It is also included in the Microsoft.DXSDK.D3DX NuGet package. The latest version uses DirectXMath for C++ support, and all functions are defined in the DirectX C++ namespace.

Converter Functions

DXGI_FORMAT_R10G10B10A2_UNORM

D3DX_R10G10B10A2_UNORM_to_FLOAT4
D3DX_FLOAT4_to_R10G10B10A2_UNORM

DXGI_FORMAT_R10G10B10A2_UINT

D3DX_R10G10B10A2_UINT_to_UINT4
D3DX_UINT4_to_R10G10B10A2_UINT

DXGI_FORMAT_R8G8B8A8_UNORM:

D3DX_R8G8B8A8_UNORM_to_FLOAT4
D3DX_FLOAT4_to_R8G8B8A8_UNORM

DXGI_FORMAT_R8G8B8A8_UNORM_SRGB

D3DX_R8G8B8A8_UNORM_SRGB_to_FLOAT4_inexact
D3DX_R8G8B8A8_UNORM_SRGB_to_FLOAT4
D3DX_FLOAT4_to_R8G8B8A8_UNORM_SRGB

DXGI_FORMAT_R8G8B8A8_UINT

D3DX_R8G8B8A8_UINT_to_UINT4
D3DX_UINT4_to_R8G8B8A8_UINT

DXGI_FORMAT_R8G8B8A8_SNORM

D3DX_R8G8B8A8_SNORM_to_FLOAT4
D3DX_FLOAT4_to_R8G8B8A8_SNORM

DXGI_FORMAT_R8G8B8A8_SINT

D3DX_R8G8B8A8_SINT_to_INT4
D3DX_INT4_to_R8G8B8A8_SINT

DXGI_FORMAT_B8G8R8A8_UNORM

D3DX_B8G8R8A8_UNORM_to_FLOAT4
D3DX_FLOAT4_to_B8G8R8A8_UNORM

DXGI_FORMAT_B8G8R8A8_UNORM_SRGB

D3DX_B8G8R8A8_UNORM_SRGB_to_FLOAT4_inexact
D3DX_B8G8R8A8_UNORM_SRGB_to_FLOAT4
D3DX_FLOAT4_to_R8G8B8A8_UNORM_SRGB

DXGI_FORMAT_B8G8R8X8_UNORM

D3DX_B8G8R8X8_UNORM_to_FLOAT3
D3DX_FLOAT3_to_B8G8R8X8_UNORM

DXGI_FORMAT_B8G8R8X8_UNORM_SRGB

D3DX_B8G8R8X8_UNORM_SRGB_to_FLOAT3_inexact
D3DX_B8G8R8X8_UNORM_SRGB_to_FLOAT3
D3DX_FLOAT3_to_B8G8R8X8_UNORM_SRGB

DXGI_FORMAT_R16G16_FLOAT

D3DX_R16G16_FLOAT_to_FLOAT2
D3DX_FLOAT2_to_R16G16_FLOAT

DXGI_FORMAT_R16G16_UNORM

D3DX_R16G16_UNORM_to_FLOAT2
D3DX_FLOAT2_to_R16G16_UNORM

DXGI_FORMAT_R16G16_UINT

D3DX_R16G16_UINT_to_UINT2
D3DX_UINT2_to_R16G16_UINT

DXGI_FORMAT_R16G16_SNORM

D3DX_R16G16_SNORM_to_FLOAT2
D3DX_FLOAT2_to_R16G16_SNORM

DXGI_FORMAT_R16G16_SINT

D3DX_R16G16_SINT_to_INT2
D3DX_INT2_to_R16G16_SINT

Inline Format Conversion Reference

Unpacking and Packing DXGI_FORMAT for In-Place Image Editing