ID3D12Resource::GetDesc method

Gets the resource description.

Syntax

D3D12_RESOURCE_DESC GetDesc();

Parameters

This method has no parameters.

Return value

Type: D3D12_RESOURCE_DESC

A Direct3D 12 resource description structure.

Examples

Returns required size of a buffer to be used for data upload.

// Returns required size of a buffer to be used for data upload
inline UINT64 GetRequiredIntermediateSize(
    _In_ ID3D12Resource* pDestinationResource,
    _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource,
    _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources)
{
    D3D12_RESOURCE_DESC Desc = pDestinationResource->GetDesc();
    UINT64 RequiredSize = 0;
    
    ID3D12Device* pDevice;
    pDestinationResource->GetDevice(__uuidof(*pDevice), reinterpret_cast<void**>(&pDevice));
    pDevice->GetCopyableFootprints(&Desc, FirstSubresource, NumSubresources, 0, nullptr, nullptr, nullptr, &RequiredSize);
    pDevice->Release();
    
    return RequiredSize;
}

Refer to the Example Code in the D3D12 Reference.

See also

ID3D12Resource