40 lines
1.2 KiB
Markdown
40 lines
1.2 KiB
Markdown
# RHICommandQueue::ExecuteCommandLists
|
|
|
|
```cpp
|
|
virtual void ExecuteCommandLists(uint32_t count, void** lists) = 0;
|
|
```
|
|
|
|
将一个或多个命令列表提交到 GPU 执行。命令列表会在 GPU 上异步执行,具体执行时机取决于底层图形 API 的调度策略。
|
|
|
|
**参数:**
|
|
- `count` - 命令列表数量,指定 `lists` 数组中的有效元素个数
|
|
- `lists` - 命令列表指针数组,每个元素必须是一个已完成的 `RHICommandList` 对象
|
|
|
|
**返回:** 无
|
|
|
|
**线程安全:** ❌ 非线程安全,应在渲染线程中调用
|
|
|
|
**复杂度:** O(n) - n 为命令列表中的命令数量
|
|
|
|
**示例:**
|
|
|
|
```cpp
|
|
#include "RHICommandQueue.h"
|
|
#include "RHICommandList.h"
|
|
|
|
void SubmitDrawCommands(RHICommandQueue* cmdQueue, RHICommandList* cmdList) {
|
|
RHICommandList* lists[1] = { cmdList };
|
|
cmdList->Begin();
|
|
cmdList->SetPipelineState(pipelineState);
|
|
cmdList->SetVertexBuffer(vertexBuffer);
|
|
cmdList->DrawInstanced(vertices, vertexCount, 0);
|
|
cmdList->End();
|
|
cmdQueue->ExecuteCommandLists(1, (void**)lists);
|
|
}
|
|
```
|
|
|
|
## 相关文档
|
|
|
|
- [RHICommandQueue 总览](command-queue.md) - 返回类总览
|
|
- [RHICommandList](../command-list/command-list.md) - 命令列表
|