Decompresses a block-compressed (BC) image or set of BC images.

HRESULT Decompress( _In_ const Image& cImage, _In_ DXGI_FORMAT format,
    _Out_ ScratchImage& image );

HRESULT Decompress( _In_reads_(nimages) const Image* cImages, _In_ size_t nimages,
    _In_ const TexMetadata& metadata,
    _In_ DXGI_FORMAT format,
    _Out_ ScratchImage& images );


cimage: Must be a BC compressed image or this function will fail.

format: Format to decompress to. If set to DXGI_FORMAT_UNKNOWN the routine picks a reasonable default based on the input BC format.


ScratchImage bcImage;


ScratchImage destImage;
hr = Decompress( bcImage.GetImages(), bcImage.GetImageCount(), bcImage.GetMetadata(), DXGI_FORMAT_UNKNOWN, destImage );
if ( FAILED(hr) )


The DirectXTex library functions allow arbitrary sized images to handle non-power-of-2 mipmapped BC textures. Note that Direct3D will not allow a resource to be created using BC format with the top-level size set to something other than a multiple of 4 in width and height, even though it does allow the mipchain below it to not meet that requirement. In other words, the library allows some textures to be decompressed that are not actually valid on Direct3D 11.

Related Links

See Compress

Last edited Jun 22, 2015 at 6:25 AM by walbourn, version 5