51 lines
1.6 KiB
Markdown
51 lines
1.6 KiB
Markdown
|
|
# RHICommandQueue
|
||
|
|
|
||
|
|
**命名空间**: `XCEngine::RHI`
|
||
|
|
|
||
|
|
**类型**: `class` (abstract)
|
||
|
|
|
||
|
|
**描述**: GPU 命令队列抽象接口,负责提交和执行命令列表,以及 GPU/CPU 同步。
|
||
|
|
|
||
|
|
## 公共方法
|
||
|
|
|
||
|
|
| 方法 | 描述 |
|
||
|
|
|------|------|
|
||
|
|
| [`Shutdown`](shutdown.md) | 关闭并释放资源 |
|
||
|
|
| [`ExecuteCommandLists`](execute-command-lists.md) | 执行命令列表 |
|
||
|
|
| [`Signal`](signal.md) | 信号栅栏 |
|
||
|
|
| [`Wait`](../../threading/task-group/wait.md) | 等待栅栏 |
|
||
|
|
| [`GetCompletedValue`](get-completed-value.md) | 获取完成值 |
|
||
|
|
| [`WaitForIdle`](wait-for-idle.md) | 等待空闲 |
|
||
|
|
| [`GetType`](get-type.md) | 获取队列类型 |
|
||
|
|
| [`GetTimestampFrequency`](get-timestamp-frequency.md) | 获取时间戳频率 |
|
||
|
|
| [`GetNativeHandle`](get-native-handle.md) | 获取原生句柄 |
|
||
|
|
|
||
|
|
## 命令队列类型 (CommandQueueType)
|
||
|
|
|
||
|
|
| 枚举值 | 描述 |
|
||
|
|
|--------|------|
|
||
|
|
| `Direct` | 直接队列,用于图形和计算命令 |
|
||
|
|
| `Compute` | 计算队列,专门用于计算着色器 |
|
||
|
|
| `Copy` | 复制队列,专门用于资源复制 |
|
||
|
|
|
||
|
|
## 使用示例
|
||
|
|
|
||
|
|
```cpp
|
||
|
|
CommandQueueDesc queueDesc;
|
||
|
|
queueDesc.queueType = (uint32_t)CommandQueueType::Direct;
|
||
|
|
RHICommandQueue* commandQueue = device->CreateCommandQueue(queueDesc);
|
||
|
|
|
||
|
|
FenceDesc fenceDesc;
|
||
|
|
RHIFence* fence = device->CreateFence(fenceDesc);
|
||
|
|
|
||
|
|
commandQueue->ExecuteCommandLists(1, (void**)&commandList);
|
||
|
|
commandQueue->Signal(fence, 1);
|
||
|
|
fence->Wait(1);
|
||
|
|
```
|
||
|
|
|
||
|
|
## 相关文档
|
||
|
|
|
||
|
|
- [../rhi/rhi.md](../rhi.md) - RHI 模块总览
|
||
|
|
- [RHICommandList](../command-list/command-list.md) - 命令列表
|
||
|
|
- [RHIFence](../fence/fence.md) - 同步栅栏
|