> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GetResourceAllocationInfo1 (XBOX Series 主機)

> 取得此介面卡上資源集合所需記憶體大小與對齊方式的詳細資訊。(ID3D12Device4::GetResourceAllocationInfo1)

取得此介面卡上資源集合所需記憶體大小與對齊方式的詳細資訊。另請參閱 [ID3D12Device::GetResourceAllocationInfo](/zh-TW/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_getresourceallocationinfo_public)。

除了方法所傳回的 [D3D12\_RESOURCE\_ALLOCATION\_INFO](/zh-TW/reference/graphics/d3d12/structs/d3d12_resource_allocation_info_public) 之外，此版本還會傳回 [D3D12\_RESOURCE\_ALLOCATION\_INFO1](/zh-TW/reference/graphics/d3d12/structs/d3d12_resource_allocation_info1_public) 結構的陣列，針對每個作為輸入傳入的資源描述提供額外詳細資料。請參閱 *pResourceAllocationInfo1* 參數。

## 語法

```cpp theme={null}
D3D12_RESOURCE_ALLOCATION_INFO GetResourceAllocationInfo1(
    UINT visibleMask,
    UINT numResourceDescs,
    const D3D12_RESOURCE_DESC  pResourceDescs,
    D3D12_RESOURCE_ALLOCATION_INFO1  pResourceAllocationInfo1
)
```

### 參數

*visibleMask \[in]*\
類型：UINT

若為單一 GPU 作業，請將此值設為零。如果有多個 GPU 節點，請設定位元來識別節點 (裝置的實體介面卡)。遮罩中的每個位元對應單一節點。另請參閱[多介面卡系統](https://learn.microsoft.com/en-us/windows/win32/direct3d12/multi-engine)。

*numResourceDescs \[in]*\
類型：UINT

*pResourceDescs* 陣列中的資源描述元數目。這也是 *pResourceAllocationInfo1* 的大小 (元素數目)。

*pResourceDescs \[in]*\
類型：const D3D12\_RESOURCE\_DESC \*

**D3D12\_RESOURCE\_DESC** 結構的陣列，描述要取得其資訊的資源。

*pResourceAllocationInfo1 \[out]*\
類型：D3D12\_RESOURCE\_ALLOCATION\_INFO1 \*

[D3D12\_RESOURCE\_ALLOCATION\_INFO1](/zh-TW/reference/graphics/d3d12/structs/d3d12_resource_allocation_info1_public) 結構的陣列，包含每個作為輸入傳入之資源描述的額外詳細資料。這可讓您的應用程式更簡單地為多個資源配置堆積，而不需手動計算每個資源應放置位置的位移。

### 傳回值

類型：D3D12\_RESOURCE\_ALLOCATION\_INFO

[D3D12\_RESOURCE\_ALLOCATION\_INFO](/zh-TW/reference/graphics/d3d12/structs/d3d12_resource_allocation_info_public) 結構，提供為指定資源陣列所配置之視訊記憶體的相關資訊。

## 備註

當您使用 [CreatePlacedResource](/zh-TW/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_createplacedresource_public) 時，您的應用程式必須使用 **GetResourceAllocationInfo** 來了解紋理資源的大小與對齊特性。此方法的結果會因特定介面卡而異，且必須視為此介面卡與驅動程式版本所特有。

您的應用程式無法使用 **GetResourceAllocationInfo** 的輸出來了解紋理的封裝 mip 屬性。若要了解紋理的封裝 mip 屬性，您的應用程式必須使用 [GetResourceTiling](/zh-TW/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_getresourcetiling_public)。

紋理資源大小與 **GetResourceTiling** 傳回的資訊有顯著差異，因為某些介面卡架構會為紋理配置額外記憶體，以降低常見轉譯情境中的有效頻寬。這甚至包括紋理配置有限制或具有標準化紋理配置的紋理。應用程式無法使用 [CreateReservedResource](/zh-TW/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_createreservedresource_public) 與 [UpdateTileMappings](/zh-TW/reference/graphics/d3d12/interfaces/id3d12commandqueue/methods/id3d12commandqueue_updatetilemappings_public) 對該額外記憶體進行稀疏對應或重新對應，因此 **GetResourceTiling** 不會回報該記憶體。

您的應用程式可以不針對緩衝區資源 ([D3D12\_RESOURCE\_DIMENSION\_BUFFER](/zh-TW/reference/graphics/d3d12_x/enums/d3d12_resource_dimension)) 使用 **GetResourceAllocationInfo**。緩衝區在所有介面卡上的大小都相同，也就是大於或等於 [D3D12\_RESOURCE\_DESC::Width](/zh-TW/reference/graphics/d3d12/structs/d3d12_resource_desc_public) 的最小 64KB 倍數。

傳入多個資源描述時，會使用計算結構大小與對齊方式的 C++ 演算法。例如，一個包含兩個 64KB 對齊的極小資源及一個 4MB 對齊之極小資源的三元素陣列，會根據陣列順序回報不同的大小。如果 4MB 對齊的資源位於中間，則產生的 **Size** 為 12MB。否則，產生的 **Size** 為 8MB。傳回的 **Alignment** 一律為 4MB，因為它是資源陣列中所有對齊方式的超集。

## 需求

**標頭:** d3d12\_xs.h\
**程式庫:** d3d12\_xs.lib\
**支援的平台**: XBOX Series 主機

## 另請參閱

[ID3D12Device4](/zh-TW/reference/graphics/d3d12/interfaces/id3d12device4/id3d12device4_public)


## Related topics

- [D3D12_RESOURCE_ALLOCATION_INFO1](/zh-TW/reference/graphics/d3d12/structs/d3d12_resource_allocation_info1_public.md)
- [D3D12_RESOURCE_ALLOCATION_INFO](/zh-TW/reference/graphics/d3d12/structs/d3d12_resource_allocation_info_public.md)
- [GetResourceAllocationInfo](/zh-TW/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_getresourceallocationinfo_public.md)
- [DSTORAGE_QUEUE_INFO1](/zh-TW/reference/system/dstorage/structs/dstorage_queue_info1.md)
- [CreatePlacedResource2 (XBOX Series 主機)](/zh-TW/reference/graphics/d3d12/interfaces/id3d12device10/methods/id3d12device10_createplacedresource2_public.md)
