ID3D12Device::GetResourceAllocationInfo method
Gets the size and alignment of memory required for a collection of resources on this adapter.
Syntax
D3D12_RESOURCE_ALLOCATION_INFO GetResourceAllocationInfo( [in] UINT visibleMask, [in] UINT numResourceDescs, [in] const D3D12_RESOURCE_DESC *pResourceDescs );
Parameters
- visibleMask [in]
-
Type: UINT
For single GPU operation, set this to zero. If there are multiple GPU nodes, set bits to identify the nodes (the device's physical adapters). Each bit in the mask corresponds to a single node. Refer to Multi-Adapter.
- numResourceDescs [in]
-
Type: UINT
The number of resource descriptors in the pResourceDescs array.
- pResourceDescs [in]
-
Type: const D3D12_RESOURCE_DESC*
An array of D3D12_RESOURCE_DESC structures that described the resources to get info about.
Return value
Type: D3D12_RESOURCE_ALLOCATION_INFO
Returns a D3D12_RESOURCE_ALLOCATION_INFO structure that provides info about video memory allocated for the specified array of resources.
Remarks
When using CreatePlacedResource, the application must use this method to understand the size and alignment characteristics of texture resources. The results of this method vary depending on the particular adapter, and must be treated as unique to this adapter and driver version.
Applications cannot use the output of GetResourceAllocationInfo to understand packed mip properties of textures. To understand packed mip properties of textures, applications must use GetResourceTiling. Texture resource sizes significantly differ from the information returned by GetResourceTiling, because some adapter architectures allocate extra memory for textures to reduce the effective bandwidth during common rendering scenarios. This even includes textures that have constraints on their texture layouts or have standardized texture layouts. That extra memory cannot be sparsely mapped or remapped by an application using CreateReservedResource and UpdateTileMappings, so it isn't reported in GetResourceTiling.
Applications can forgo using GetResourceAllocationInfo for buffer resources (D3D12_RESOURCE_DIMENSION_BUFFER). Buffers have the same size on all adapters, which is merely the smallest multiple of 64KB which is greater or equal to D3D12_RESOURCE_DESC::Width.
When multiple resource descriptions are passed in, the C++ algorithm for calculating a structure size and alignment are used. For example, a three-element array with two tiny 64KB-aligned resources and a tiny 4MB-aligned resource reports differing sizes based on the order of the array. If the 4MB aligned resource is in the middle, the resulting Size is 12MB. Otherwise, the resulting Size is 8MB. The Alignment returned would always be 4MB, as it is the superset of all alignments in the resource array.
Requirements
|
Header |
|
|---|---|
|
Library |
|
|
DLL |
|
See also