These functions provide utility functionality when working with DXGI_FORMATs throughout the library.

WIC helpers

GetWICCodec
Returns 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

IsValid
Returns false if the DXGI format is unknown.

IsCompressed
Returns true if the DXGI format is a block compressed format.

IsPacked
Returns true if the DXGI format is a 'packed' format (such as 4:2:2 video formats)

IsVideo
Returns true if the DXGI format is a DXGI 1.2 'video' format defined for Direct3D 11.1 video.

IsPlanar
Returns true if the DXGI format is a 'planar' format (such as 4:2:0 or 4:1:1 video formats).

IsPalettized
Returns true if the DXGI format is a paletted format (only legacy Direct3D 11.1 video formats are paletted).

IsDepthStencil
Returns true if the DXGI format is for use with depth/stencil resources.

IsSRGB
Returns true if the DXGI format is an sRGB format.

IsTypeless
Returns 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

HasAlpha
Returns 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.

BitsPerPixel
Returns the bits-per-pixel for a given DXGI format. For example, it returns 32 for DXGI_FORMAT_R10G10B10A2_UNORM.

BitsPerColor
Returns 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

ComputePitch
Returns 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.

ComputeScanlines
Returns the number of horizontal scanlines in an image given the DXGI format and pixel height.

DXGI format type promoters

MakeSRGB
Converts a DXGI format to the sRGB equivalent if any.

MakeTypeless
Converts a DXGI format to a TYPELESS equiavlent if any. This does not modify depth/stencil formats which have multiple 'typeless' mappings.

MakeTypelessUNORM
Converts a TYPELESS DXGI format to a UNORM equivalent if any.

MakeTypelessFLOAT
Converts 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.

Last edited Jun 21, 2015 at 5:52 PM by walbourn, version 18