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

# CreateMapping (XBOX One 系列)

> 以指定的名稱建立新的對應。

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

以指定的名稱建立新的對應。

<a id="syntaxSection" />

## 語法

```cpp theme={null}
HRESULT CreateMapping(
         const WCHAR *strName,
         XGMemoryLayoutMapping *pMapping,
         UINT32 AlignmentBytes= 0  
)  
```

<a id="ID4EG" />

### 參數

*strName*   \_In\_z\_\
類型: WCHAR\*

新對應的名稱。

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

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

*AlignmentBytes*   \_In\_\
類型: UINT32

對應虛擬位址的對齊方式 (以位元組為單位)。指定 0 以使用預設對齊方式 `XG_GPU_PAGE_SIZE_BYTES`。

<a id="ID4EP" />

### 傳回值

類型: HRESULT

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

<a id="remarks" />

## 備註

以指定的名稱建立新的對應。將 AlignmentBytes 設為 0，即可使用預設對齊方式 `XG_GPU_PAGE_SIZE_BYTES` 作為對應的虛擬位址對齊方式。

此常數代表 XG GPU 頁面的大小 (以位元組為單位)。

此大小通常為 64 KB，可透過 [XGMemoryLayout::GetPageSizeBytes](/zh-TW/reference/graphics/xgmemory_NR/interfaces/XGMemoryLayout/methods/xgmemorylayout_getpagesizebytes) 方法確認。

新的對應會建立為指向 [XGMemoryLayoutMapping](/zh-TW/reference/graphics/xgmemory_NR/structs/xgmemorylayoutmapping) 結構的指標。此方法類似 [XGMemoryLayout::MapFromPattern](/zh-TW/reference/graphics/xgmemory_NR/interfaces/XGMemoryLayout/methods/xgmemorylayout_mapfrompattern) 方法，差別在於 `MapFromPattern` 會使用以位元組陣列傳遞的預先定義模式來對應頁面。

<a id="requirements" />

## 需求

**標頭:** xgmemory.h

<a id="ID4EWB" />

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

## 另請參閱

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


## Related topics

- [CopyTileMappings](/zh-CN/reference/graphics/d3d12/interfaces/id3d12commandqueue/methods/id3d12commandqueue_copytilemappings_public.md)
- [OpenExistingHeapFromFileMapping](/zh-CN/reference/graphics/d3d12/interfaces/id3d12device3/methods/id3d12device3_openexistingheapfromfilemapping_public.md)
- [D3D12_SHADER_COMPONENT_MAPPING](/zh-CN/reference/graphics/d3d12/enums/d3d12_shader_component_mapping_public.md)
- [D3D12_TILE_MAPPING_FLAGS](/zh-CN/reference/graphics/d3d12/enums/d3d12_tile_mapping_flags_public.md)
- [CreateFence](/zh-CN/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_createfence_public.md)
