Modifier

Partager via


ID3D12Device4::GetResourceAllocationInfo1(UINT,UINT,constD3D12_RESOURCE_DESC*,D3D12_RESOURCE_ALLOCATION_INFO1*) method (d3d12.h)

Gets rich info about the size and alignment of memory required for a collection of resources on this adapter. Also see ID3D12Device::GetResourceAllocationInfo.

In addition to the D3D12_RESOURCE_ALLOCATION_INFO returned from the method, this version also returns an array of D3D12_RESOURCE_ALLOCATION_INFO1 structures, which provide additional details for each resource description passed as input. See the pResourceAllocationInfo1 parameter.

Syntax

D3D12_RESOURCE_ALLOCATION_INFO GetResourceAllocationInfo1(
  [in]  UINT                            visibleMask,
  [in]  UINT                            numResourceDescs,
  [in]  const D3D12_RESOURCE_DESC       *pResourceDescs,
  [out] D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1
);

Parameters

[in] visibleMask

Type: UINT

For single-GPU operation, set this to zero. If there are multiple GPU nodes, then set bits to identify the nodes (the device's physical adapters). Each bit in the mask corresponds to a single node. Also see Multi-adapter systems.

[in] numResourceDescs

Type: UINT

The number of resource descriptors in the pResourceDescs array. This is also the size (the number of elements in) pResourceAllocationInfo1.

[in] pResourceDescs

Type: const D3D12_RESOURCE_DESC*

An array of D3D12_RESOURCE_DESC structures that described the resources to get info about.

[out] pResourceAllocationInfo1

Type: D3D12_RESOURCE_ALLOCATION_INFO1*

An array of D3D12_RESOURCE_ALLOCATION_INFO1 structures, containing additional details for each resource description passed as input. This makes it simpler for your application to allocate a heap for multiple resources, and without manually computing offsets for where each resource should be placed.

Return value

Type: D3D12_RESOURCE_ALLOCATION_INFO

A D3D12_RESOURCE_ALLOCATION_INFO structure that provides info about video memory allocated for the specified array of resources.

Remarks

When you're using CreatePlacedResource, your application must use GetResourceAllocationInfo in order 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.

Your application can't use the output of GetResourceAllocationInfo to understand packed mip properties of textures. To understand packed mip properties of textures, your application 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 can't be sparsely mapped nor remapped by an application using CreateReservedResource and UpdateTileMappings, so it isn't reported by GetResourceTiling.

Your application 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 that's 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, then the resulting Size is 12MB. Otherwise, the resulting Size is 8MB. The Alignment returned would always be 4MB, because it's the superset of all alignments in the resource array.

Requirements

Requirement Value
Minimum supported client Windows 10 Build 20348
Minimum supported server Windows 10 Build 20348
Target Platform Windows
Header d3d12.h
Library d3d12.lib
DLL d3d12.dll

See also

ID3D12Device4