- Rename texture/dtor.md to destructor.md per template spec - Remove duplicate non-hyphenated fence docs (getnativehandle.md, issignaled.md, getcompletedvalue.md) - Fix template field issues: - swap-chain, command-queue: 类型 now uses 'class (abstract)' - sampler: 头文件 now uses full path 'XCEngine/RHI/RHISampler.h' - types: 类型 fixed from 'structs' to 'struct' - enums: 类型 fixed from 'enums' to 'enum class' - Fix include paths in command-queue and pipeline-layout code examples - Create missing constructor/destructor docs for 11 classes: buffer, texture, shader, device, command-list, command-queue, fence, sampler, swap-chain, pipeline-state, pipeline-layout - Update class overview pages to include constructor/destructor entries
2.9 KiB
2.9 KiB
RHICommandList
命名空间: XCEngine::RHI
类型: class (abstract)
头文件: XCEngine/RHI/RHICommandList.h
描述: GPU 命令列表抽象接口,用于录制和执行 GPU 渲染命令
概述
RHICommandList 是渲染硬件接口(RHI)层提供的抽象命令列表类,用于录制 GPU 命令并提交执行。该类是纯虚接口,具体实现由各图形 API(D3D12、Vulkan 等)提供。
主要功能包括:
- 状态设置(管线、视口、裁剪、渲染目标等)
- 资源绑定(顶点缓冲、索引缓冲等)
- 绘制调用(Draw、DrawIndexed)
- 资源操作(复制、转换状态)
- 计算着色器分发
公共方法
| 方法 | 描述 |
|---|---|
RHICommandList |
默认构造函数 |
~RHICommandList |
虚析构函数 |
Shutdown |
关闭命令列表并释放资源 |
Reset |
重置命令列表 |
Close |
关闭命令列表 |
TransitionBarrier |
资源状态转换 |
SetPipelineState |
设置管线状态 |
SetPrimitiveTopology |
设置图元拓扑 |
SetViewport |
设置视口 |
SetViewports |
设置多个视口 |
SetScissorRect |
设置裁剪矩形 |
SetScissorRects |
设置多个裁剪矩形 |
SetRenderTargets |
设置渲染目标 |
SetDepthStencilState |
设置深度模板状态 |
SetStencilRef |
设置模板参考值 |
SetBlendState |
设置混合状态 |
SetBlendFactor |
设置混合因子 |
SetVertexBuffer |
设置顶点缓冲 |
SetVertexBuffers |
设置多个顶点缓冲 |
SetIndexBuffer |
设置索引缓冲 |
Draw |
绘制 |
DrawIndexed |
索引绘制 |
Clear |
清除 |
ClearRenderTarget |
清除渲染目标 |
ClearDepthStencil |
清除深度模板 |
CopyResource |
复制资源 |
Dispatch |
分发计算任务 |
使用示例
commandList->Reset();
commandList->SetPipelineState(pipelineState);
commandList->SetPrimitiveTopology(PrimitiveTopology::TriangleList);
commandList->SetViewport(viewport);
commandList->SetRenderTargets(1, &renderTarget, depthStencil);
commandList->DrawIndexed(indexCount, 1, 0, 0, 0);
commandList->Close();
commandQueue->ExecuteCommandLists(1, (void**)&commandList);
相关文档
- RHI 模块总览 - RHI 模块总览
- RHICommandQueue - 命令队列