public:
void DecompressResource(
ID3D11Resource *pDstResource,
UINT DstSubresource,
const D3D11X_POINT *pDstPoint,
ID3D11Resource *pSrcResource,
UINT SrcSubresource,
const D3D11X_RECT *pSrcRect,
DXGI_FORMAT DecompressFormat,
UINT DecompressFlags
)
pDstResource
Type: ID3D11Resource *
[in] The destination resource, as a pointer to ID3D11Resource.
DstSubresource
Type: UINT
[in] The index of the destination subresource, to select an array from the destination resource. A value of (UINT32) -1 causes decompression of all subresources.
For information about subresources, see Subresources.
pDstPoint
Type: D3D11X_POINT *
[in, optional] The upper-left destination location to place the result, as a pointer to a D3D11X_POINT, which is typedef’d: typedef POINT D3D11X_POINT; The destination point may be used to specify a destination region offset which differs from that of the source region, when performing color decompression operations (D3D11X_DECOMPRESS_EXPAND_COLOR).
pSrcResource
Type: ID3D11Resource *
[in] The source resource, as a pointer to a ID3D11Resource.
SrcSubresource
Type: UINT
[in] The index of the source subresource, to select an array from the source resource. A value of (UINT32) -1 causes decompression of all subresources.
For information about subresources, see Subresources.
pSrcRect
Type: D3D11X_RECT *
[in, optional] The source region from which to decompress, as a pointer to a D3D11X_RECT, which is typedef’d: typedef D3D11_RECT D3D11X_RECT;
DecompressFormat
Type: DXGI_FORMAT
[in] The format of the decompressed resource, as a DXGI_FORMAT enumeration constant.
This method operates on resource objects and not view objects. This parameter is used to apply typing (number format) to resources that have been created with typeless formats. This parameter is analogous to the Format parameter in the method ID3D11DeviceContext::ResolveSubresource - in that topic, see the Remarks section, about whether the source and destination are prestructured and typed or typeless.
DecompressFlags
Type: UINT
[in] Flags to control decompression, as a bitwise-OR’d combination of D3D11X_DECOMPRESS_FLAG enumeration constants.
DecompressResource is the only method available for explicit decompression. Decompression also happens internally and automatically on bind when using legacy semantics.
Decompressing from one resource to another is only supported for color sample expansion and depth decompression. If you try to decompress a clear operation from one resource to another, the source resource will be updated, but the destination resource will not be updated.
Render target and depth/stencil buffer resources may be compressed. These resources are identified by a D3D11_BIND_FLAG of D3D11_BIND_RENDER_TARGET or D3D11_BIND_DEPTH_STENCIL passed into ID3D11Device::CreateTexture2D. However, compression may be disabled on a resource if given a MiscFlags value (in the CD3D11_BUFFER_DESC constructor) of D3D11X_RESOURCE_MISC_NO_COLOR_COMPRESSION, D3D11X_RESOURCE_MISC_NO_DEPTH_COMPRESSION, and/or D3D11X_RESOURCE_MISC_NO_STENCIL_COMPRESSION. To determine whether a resource is in a compressed state, and the nature of that compression, call ID3D11DeviceContextX::GetResourceCompression.
For compressed render targets, generally you should sample from them in a compressed form (with explicit FMask processing in the shader) when possible, to combine decompression and post-processing work and to save on bandwidth. Compressed depth/stencil buffers have much more overhead to sample in a shader, due to HTile decode and plane expansion costs. (There is no GPU-supported sampling and decode of compressed depth/stencil in the shader.) So for depth/stencil targets, you should weigh the costs and benefits of sampling compressed versus doing a decompress pre-pass.
Header: Declared in d3d11_x.h.
Library: Use d3d11_x.lib.