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

# AllocateFromCommandAllocatorX

> AllocateFromCommandAllocatorX 的參考資料，這是 XBOX Series 主機 Direct3D 12 圖形 API 中的方法。在 XBOX 上為保留或未使用；如需詳細資訊，請參閱備註。

配置與相關聯命令清單具有相同存留期的記憶體。這可用於在 CPU 時間軸上準備要在 GPU 時間軸上讀取的資料，例如動態著色器輸入。

## 語法

```cpp theme={null}
void* AllocateFromCommandAllocatorX(  
         UINT sizeBytes,  
         UINT alignmentBytes  
)  
```

### 參數

*sizeBytes*   \_In\_\
類型：UINT

配置的大小 (以位元組為單位)。

*alignmentBytes*   \_In\_\
類型：UINT

配置的最小對齊 (以位元組為單位)。

### 傳回值

類型：void\*

已配置記憶體的位址。這是有效的 GPU 指標，可以轉換為 D3D12\_GPU\_VIRTUAL\_ADDRESS。

如果記憶體無法使用，將會傳回 nullptr。

注意：記憶體可能是寫入合併且未經 CPU 快取的。應避免 CPU 讀取。

## 需求

**標頭：** d3d12\_xs.h

**程式庫：** d3d12\_xs.lib

**支援的平台：** XBOX Series 主機

## 另請參閱

[ID3D12GraphicsCommandList8](/zh-TW/reference/graphics/d3d12_xs/interfaces/ID3D12GraphicsCommandList8/id3d12graphicscommandlist8)


## Related topics

- [CreateCommandAllocator](/zh-TW/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_createcommandallocator_public.md)
- [ID3D12CommandAllocator::Reset](/zh-TW/reference/graphics/d3d12/interfaces/id3d12commandallocator/methods/id3d12commandallocator_reset_public.md)
- [XALLOC_ALLOCATOR_IDS](/zh-TW/reference/system/xmem/enums/xalloc_allocator_ids.md)
- [CreateCommandList](/zh-TW/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_createcommandlist_public.md)
- [game_chat_allocate_memory_callback](/zh-TW/reference/chat/gamechat2/functions/game_chat_allocate_memory_callback.md)
