Files
XCEngine/docs/api/rhi/d3d12/command-allocator/command-allocator.md
2026-03-20 02:35:45 +08:00

1.2 KiB

D3D12CommandAllocator

命名空间: XCEngine::RHI

类型: class (standalone, does not inherit from base)

描述: DirectX 12 命令分配器的 D3D12 实现,用于管理 GPU 命令分配内存。

构造函数

方法 描述
D3D12CommandAllocator 默认构造函数

公共方法

方法 描述
Initialize 初始化命令分配器
Shutdown 关闭命令分配器
Reset 重置命令分配器
IsReady 检查是否就绪
GetCommandAllocator 获取 D3D12 命令分配器

析构函数

方法 描述
~D3D12CommandAllocator 析构函数,自动调用 Shutdown

使用示例

#include <XCEngine/RHI/D3D12/D3D12CommandAllocator.h>

using namespace XCEngine::RHI;

D3D12CommandAllocator allocator;
if (allocator.Initialize(device, CommandQueueType::Direct)) {
    allocator.Reset();
    if (allocator.IsReady()) {
        ID3D12CommandAllocator* native = allocator.GetCommandAllocator();
    }
    allocator.Shutdown();
}

相关文档