# D3D12CommandAllocator **命名空间**: `XCEngine::RHI` **类型**: `class` (standalone, does not inherit from base) **描述**: DirectX 12 命令分配器的 D3D12 实现,用于管理 GPU 命令分配内存。 ## 构造函数 | 方法 | 描述 | |------|------| | [`D3D12CommandAllocator`](constructor.md) | 默认构造函数 | ## 公共方法 | 方法 | 描述 | |------|------| | [`Initialize`](initialize.md) | 初始化命令分配器 | | [`Shutdown`](shutdown.md) | 关闭命令分配器 | | [`Reset`](reset.md) | 重置命令分配器 | | [`IsReady`](is-ready.md) | 检查是否就绪 | | [`GetCommandAllocator`](get-command-allocator.md) | 获取 D3D12 命令分配器 | ## 析构函数 | 方法 | 描述 | |------|------| | [`~D3D12CommandAllocator`](destructor.md) | 析构函数,自动调用 Shutdown | ## 使用示例 ```cpp #include using namespace XCEngine::RHI; D3D12CommandAllocator allocator; if (allocator.Initialize(device, CommandQueueType::Direct)) { allocator.Reset(); if (allocator.IsReady()) { ID3D12CommandAllocator* native = allocator.GetCommandAllocator(); } allocator.Shutdown(); } ``` ## 相关文档 - [D3D12 后端总览](../../d3d12/d3d12.md)