These functions provide utility functionality when working with DXGI_FORMATs throughout the library.
WIC helpers
GetWICCodecReturns a WIC GUID for a given file container given a simple enumeration value. This function is optional and you can instead use the WIC container GUID directly instead.
DXGI format tests
IsValidReturns false if the DXGI format is unknown.
IsCompressedReturns true if the DXGI format is a block compressed format.
IsPackedReturns true if the DXGI format is a 'packed' format (such as 4:2:2 video formats)
IsVideoReturns true if the DXGI format is a DXGI 1.2 'video' format defined for Direct3D 11.1 video.
IsPlanarReturns true if the DXGI format is a 'planar' format (such as 4:2:0 or 4:1:1 video formats).
IsPalettizedReturns true if the DXGI format is a paletted format (only legacy Direct3D 11.1 video formats are paletted).
IsDepthStencilReturns true if the DXGI format is for use with depth/stencil resources.
IsSRGBReturns true if the DXGI format is an sRGB format.
IsTypelessReturns true if the DXGI format is a 'typeless' format. If
partialTypeless is 'true' (the default) then formats with both typeless and typed content return true. If
partialTypeless is 'false', then the mixed DXGI types (such as DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS) will return false instead.
DXGI format properties
HasAlphaReturns true of the DXGI format includes an alpha channel. Note that BC1 formats return true because they have a 'transparency bit' trick in the encoding to handle 1-bit alpha.
BitsPerPixelReturns the bits-per-pixel for a given DXGI format. For example, it returns 32 for DXGI_FORMAT_R10G10B10A2_UNORM.
BitsPerColorReturns the color-depth (aka bit-depth) for a given DXGI format. For formats with a mix of different channel sizes, it returns the color-depth of the largest channel. For example, it returns 10 for DXGI_FORMAT_R10G10B10A2_UNORM.
Image layout
ComputePitchReturns both the row and slice pitch for a given width, height, and DXGI format. It supports a number of flags for overriding the default byte-alignment usually used by DDS files and Direct3D 11 resources.
ComputeScanlinesReturns the number of horizontal scanlines in an image given the DXGI format and pixel height.
DXGI format type promoters
MakeSRGBConverts a DXGI format to the sRGB equivalent if any.
MakeTypelessConverts a DXGI format to a TYPELESS equiavlent if any. This does not modify depth/stencil formats which have multiple 'typeless' mappings.
MakeTypelessUNORMConverts a TYPELESS DXGI format to a UNORM equivalent if any.
MakeTypelessFLOATConverts a TYPELESS DXGI format to a FLOAT equivalent if any.
Note if there is no format that matches the desired property for the input format, the original format is returned.