> ## 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.

# MapPagePriorityArray (XBOX One 系列)

> 使用頁面優先順序陣列來對應頁面。

# XGMemoryLayout::MapPagePriorityArray 方法 (XBOX One 系列)

使用頁面優先順序陣列來對應頁面。

<a id="syntaxSection" />

## 語法

```cpp theme={null}
HRESULT MapPagePriorityArray(
         XGMemoryLayoutMapping *pMapping,
         const UINT32 *pPagePriorityValues,
         UINT32 PagePriorityCount,
         UINT32 PageCount,
         UINT32 MaxEsramPageCount
)  
```

<a id="ID4EG" />

### 參數

*pMapping*   \_Inout\_\
類型: XGMemoryLayoutMapping \*

\[in, out] 更新後的對應結果，以指向 [XGMemoryLayoutMapping](/zh-TW/reference/graphics/xgmemory_NR/structs/xgmemorylayoutmapping) 結構的指標表示。

*pPagePriorityValues*   \_In\_reads\_(PagePriorityCount)\
類型: UINT32\*

\[in] 頁面優先順序陣列中的優先順序值。

*PagePriorityCount*   \
類型: UINT32

頁面優先順序項目的數目。

*PageCount*   \
類型: UINT32

頁面優先順序陣列中的頁面總數，包括系統頁面和 ESRAM 頁面。此計數會調整對應的長度和/或 ESRAM 使用量。如果頁面優先順序值陣列不夠大，無法涵蓋整個對應，則會使用系統頁面填補至對應的結尾。

如果 *PageCount* 為 XG\_ALL\_REMAINING\_PAGES，則會以 [XGMemoryLayout::GetPageCountRemaining](/zh-TW/reference/graphics/xgmemory_NR/interfaces/XGMemoryLayout/methods/xgmemorylayout_getpagecountremaining) 取代作為 *PageCount* 的值。

*MaxEsramPageCount*\
類型: UINT32

頁面優先順序陣列中的 ESRAM 頁面數目上限。此計數會調整對應的長度和/或 ESRAM 使用量。如果頁面優先順序值陣列不夠大，無法涵蓋整個對應，則會使用系統頁面填補至對應的結尾。

如果 *MaxEsramPageCount* 為 XG\_ALL\_REMAINING\_PAGES，則會以 [XGMemoryLayout::GetFreeEsramPageCount](/zh-TW/reference/graphics/xgmemory_NR/interfaces/XGMemoryLayout/methods/xgmemorylayout_getfreeesrampagecount) 取代作為 *MaxEsramPageCount* 的值。

<a id="ID4EP" />

### 傳回值

類型: HRESULT

S\_OK、E\_INVALIDARG 或 E\_OUTOFMEMORY。

<a id="remarks" />

## 備註

此方法使用頁面優先順序陣列來對應頁面。頁面優先順序陣列中的每個值各對應一個頁面，並依虛擬位址排列。

值由使用者定義，值越大表示優先順序越高。

套用對應之前，ESRAM 頁面計數上限會轉換為最低優先順序值。陣列中任何大於或等於最低優先順序值的優先順序值，都會使用 ESRAM 頁面進行對應。從 ESRAM 頁面計數上限轉換為最低優先順序值，是對對應頁面計數執行的 O(*n* log *n*) 作業。

對應會以指定的頁面計數和 ESRAM 頁面計數上限建立。這些計數會調整對應的長度和/或 ESRAM 使用量。如果頁面優先順序值陣列不夠大，無法涵蓋整個對應，則會使用系統頁面填補至對應的結尾。

<a id="requirements" />

## 需求

**標頭:** xgmemory.h

<a id="ID4EMD" />

**支援的平台:** XBOX One 系列

## 另請參閱

[XGMemoryLayout](/zh-TW/reference/graphics/xgmemory_NR/interfaces/XGMemoryLayout/xgmemorylayout)


## Related topics

- [Map](/zh-CN/reference/graphics/d3d12/interfaces/id3d12resource/methods/id3d12resource_map_public.md)
- [XMemMapPhysicalPages](/zh-CN/reference/system/xmem/functions/xmemmapphysicalpages.md)
- [XMemMapPhysicalPagesScatter](/zh-CN/reference/system/xmem/functions/xmemmapphysicalpagesscatter.md)
- [SetResidencyPriority](/zh-CN/reference/graphics/d3d12/interfaces/id3d12device1/methods/id3d12device1_setresidencypriority_public.md)
- [XAppCaptureMetadataPriority](/zh-CN/reference/system/xappcapture/enums/xappcapturemetadatapriority.md)
