fix: improve doc link navigation and tree display

- Fix link resolution with proper relative/absolute path handling
- Improve link styling with underline decoration
- Hide leaf nodes from tree, only show directories
- Fix log file path for packaged app
This commit is contained in:
2026-03-19 12:44:08 +08:00
parent e003fe6513
commit 58a83f445a
1012 changed files with 56880 additions and 22 deletions

View File

@@ -0,0 +1,86 @@
# RHIBuffer
**命名空间**: `XCEngine::RHI`
**类型**: `class` (abstract)
**描述**: GPU 缓冲区资源抽象接口,用于管理顶点缓冲、索引缓冲、常量缓冲等 GPU 内存资源。
## 概述
`RHIBuffer` 封装了 GPU 缓冲区的创建、数据上传、状态管理等操作。支持多种缓冲区类型,包括顶点缓冲、索引缓冲、常量缓冲等。
## 公共方法
| 方法 | 描述 |
|------|------|
| [`Map`](map.md) | 映射缓冲区到 CPU 可访问内存 |
| [`Unmap`](unmap.md) | 取消映射 |
| [`SetData`](set-data.md) | 设置缓冲区数据 |
| [`GetSize`](get-size.md) | 获取缓冲区大小 |
| [`GetBufferType`](get-buffer-type.md) | 获取缓冲区类型 |
| [`SetBufferType`](set-buffer-type.md) | 设置缓冲区类型 |
| [`GetStride`](get-stride.md) | 获取缓冲区步长 |
| [`SetStride`](set-stride.md) | 设置缓冲区步长 |
| [`GetState`](get-state.md) | 获取资源状态 |
| [`SetState`](set-state.md) | 设置资源状态 |
| [`Shutdown`](shutdown.md) | 关闭并释放资源 |
| [`GetNativeHandle`](get-native-handle.md) | 获取原生句柄 |
| [`GetName`](get-name.md) | 获取资源名称 |
| [`SetName`](set-name.md) | 设置资源名称 |
## 缓冲区类型 (BufferType)
| 枚举值 | 描述 |
|--------|------|
| `BufferType::Vertex` | 顶点缓冲 |
| `BufferType::Index` | 索引缓冲 |
| `BufferType::Constant` | 常量缓冲 (Constant Buffer) |
| `BufferType::ReadBack` | 回读缓冲(用于 CPU 读取 GPU 数据) |
| `BufferType::Indirect` | 间接执行缓冲 |
| `BufferType::RaytracingAccelerationStructure` | 光线追踪加速结构 |
| `BufferType::ShaderBindingTable` | 光线追踪着色器绑定表 |
## 资源状态 (ResourceStates)
| 状态 | 描述 |
|------|------|
| `Common` | 默认状态 |
| `VertexAndConstantBuffer` | 顶点/常量缓冲 |
| `IndexBuffer` | 索引缓冲 |
| `RenderTarget` | 渲染目标 |
| `UnorderedAccess` | 无序访问 |
| `DepthWrite` | 深度写入 |
| `DepthRead` | 深度读取 |
| `NonPixelShaderResource` | 非像素着色器资源 |
| `PixelShaderResource` | 像素着色器资源 |
| `CopySrc` | 复制源 |
| `CopyDst` | 复制目标 |
| `Present` | 呈现状态 |
| `GenericRead` | 通用读取 |
## 使用示例
```cpp
BufferDesc desc;
desc.size = sizeof(Vertex) * vertexCount;
desc.stride = sizeof(Vertex);
desc.bufferType = (uint32_t)BufferType::Vertex;
desc.flags = 0;
RHIBuffer* vertexBuffer = device->CreateBuffer(desc);
void* mapped = vertexBuffer->Map();
memcpy(mapped, vertexData, desc.size);
vertexBuffer->Unmap();
vertexBuffer->SetState(ResourceStates::VertexAndConstantBuffer);
vertexBuffer->Shutdown();
```
## 相关文档
- [../rhi/rhi.md](../rhi.md) - RHI 模块总览
- [RHIDevice](../device/device.md) - 创建设备
- [RHITexture](../texture/texture.md) - 纹理资源
- [RHICommandList](../command-list/command-list.md) - 命令列表

View File

@@ -0,0 +1,15 @@
# RHIBuffer::GetBufferType
```cpp
virtual BufferType GetBufferType() const = 0;
```
获取缓冲区类型。
**返回:** 缓冲区类型枚举值
**复杂度:** O(1)
## 相关文档
- [RHIBuffer 总览](buffer.md) - 返回类总览

View File

@@ -0,0 +1,15 @@
# RHIBuffer::GetName
```cpp
virtual const std::string& GetName() const = 0;
```
获取缓冲区名称(用于调试)。
**返回:** 缓冲区名称
**复杂度:** O(1)
## 相关文档
- [RHIBuffer 总览](buffer.md) - 返回类总览

View File

@@ -0,0 +1,17 @@
# RHIBuffer::GetNativeHandle
```cpp
virtual void* GetNativeHandle() = 0;
```
获取原生 API 句柄。
**返回:**
- D3D12: `ID3D12Resource*`
- OpenGL: `GLuint` 指针
**复杂度:** O(1)
## 相关文档
- [RHIBuffer 总览](buffer.md) - 返回类总览

View File

@@ -0,0 +1,15 @@
# RHIBuffer::GetSize
```cpp
virtual uint64_t GetSize() const = 0;
```
获取缓冲区大小(字节)。
**返回:** 缓冲区大小
**复杂度:** O(1)
## 相关文档
- [RHIBuffer 总览](buffer.md) - 返回类总览

View File

@@ -0,0 +1,15 @@
# RHIBuffer::GetState
```cpp
virtual ResourceStates GetState() const = 0;
```
获取当前资源状态。
**返回:** 资源状态枚举值
**复杂度:** O(1)
## 相关文档
- [RHIBuffer 总览](buffer.md) - 返回类总览

View File

@@ -0,0 +1,15 @@
# RHIBuffer::GetStride
```cpp
virtual uint32_t GetStride() const = 0;
```
获取单个元素的字节大小。
**返回:** 元素步长(字节)
**复杂度:** O(1)
## 相关文档
- [RHIBuffer 总览](buffer.md) - 返回类总览

View File

@@ -0,0 +1,25 @@
# RHIBuffer::Map
```cpp
virtual void* Map() = 0;
```
映射缓冲区内存到 CPU 可访问空间。
**返回:** 指向缓冲区数据的指针
**复杂度:** O(1)
**示例:**
```cpp
void* data = buffer->Map();
if (data) {
memcpy(data, vertexData, bufferSize);
buffer->Unmap();
}
```
## 相关文档
- [RHIBuffer 总览](buffer.md) - 返回类总览

View File

@@ -0,0 +1,16 @@
# RHIBuffer::SetBufferType
```cpp
virtual void SetBufferType(BufferType type) = 0;
```
设置缓冲区类型。
**参数:**
- `type` - 新的缓冲区类型
**复杂度:** O(1)
## 相关文档
- [RHIBuffer 总览](buffer.md) - 返回类总览

View File

@@ -0,0 +1,29 @@
# RHIBuffer::SetData
```cpp
virtual void SetData(const void* data, size_t size, size_t offset = 0) = 0;
```
设置缓冲区数据。
**参数:**
- `data` - 源数据指针
- `size` - 数据大小(字节)
- `offset` - 缓冲区内的偏移量
**复杂度:** O(n)
**示例:**
```cpp
Vertex vertices[] = {
{0.0f, 0.5f, 0.0f},
{0.5f, -0.5f, 0.0f},
{-0.5f, -0.5f, 0.0f}
};
buffer->SetData(vertices, sizeof(vertices), 0);
```
## 相关文档
- [RHIBuffer 总览](buffer.md) - 返回类总览

View File

@@ -0,0 +1,22 @@
# RHIBuffer::SetName
```cpp
virtual void SetName(const std::string& name) = 0;
```
设置缓冲区名称(用于调试)。
**参数:**
- `name` - 新名称
**复杂度:** O(1)
**示例:**
```cpp
buffer->SetName("VertexBuffer_Main");
```
## 相关文档
- [RHIBuffer 总览](buffer.md) - 返回类总览

View File

@@ -0,0 +1,22 @@
# RHIBuffer::SetState
```cpp
virtual void SetState(ResourceStates state) = 0;
```
设置资源状态。
**参数:**
- `state` - 新的资源状态
**复杂度:** O(1)
**示例:**
```cpp
buffer->SetState(ResourceStates::VertexAndConstantBuffer);
```
## 相关文档
- [RHIBuffer 总览](buffer.md) - 返回类总览

View File

@@ -0,0 +1,16 @@
# RHIBuffer::SetStride
```cpp
virtual void SetStride(uint32_t stride) = 0;
```
设置元素字节大小。
**参数:**
- `stride` - 新的步长值
**复杂度:** O(1)
## 相关文档
- [RHIBuffer 总览](buffer.md) - 返回类总览

View File

@@ -0,0 +1,13 @@
# RHIBuffer::Shutdown
```cpp
virtual void Shutdown() = 0;
```
释放缓冲区资源。
**复杂度:** O(1)
## 相关文档
- [RHIBuffer 总览](buffer.md) - 返回类总览

View File

@@ -0,0 +1,21 @@
# RHIBuffer::Unmap
```cpp
virtual void Unmap() = 0;
```
取消内存映射。
**复杂度:** O(1)
**示例:**
```cpp
buffer->Map();
memcpy(mappedData, sourceData, size);
buffer->Unmap();
```
## 相关文档
- [RHIBuffer 总览](buffer.md) - 返回类总览

View File

@@ -0,0 +1,82 @@
# RHICapabilities
**命名空间**: `XCEngine::RHI`
**类型**: `struct`
**描述**: GPU 设备能力结构体,描述了当前图形设备支持的各种功能和限制。
## 公共成员
### 特性支持
| 成员 | 类型 | 描述 |
|------|------|------|
| `bSupportsRayTracing` | `bool` | 支持光线追踪 |
| `bSupportsMeshShaders` | `bool` | 支持 Mesh 着色器 |
| `bSupportsExplicitMultiThreading` | `bool` | 支持显式多线程 |
| `bSupportsGeometryShaders` | `bool` | 支持几何着色器 |
| `bSupportsTessellation` | `bool` | 支持曲面细分 |
| `bSupportsComputeShaders` | `bool` | 支持计算着色器 |
| `bSupportsDepthBoundsTest` | `bool` | 支持深度范围测试 |
| `bSupportsAlphaToCoverage` | `bool` | 支持 Alpha 到覆盖 |
| `bSupportsIndependentBlend` | `bool` | 支持独立混合 |
| `bSupportsLogicOps` | `bool` | 支持逻辑操作 |
| `bSupportsMultiViewport` | `bool` | 支持多视口 |
| `bSupportsConservativeRasterization` | `bool` | 支持保守光栅化 |
| `bSupportsProgrammableSamplePositions` | `bool` | 支持可编程采样位置 |
### 资源限制
| 成员 | 类型 | 描述 |
|------|------|------|
| `maxTexture2DSize` | `uint32_t` | 最大 2D 纹理尺寸 |
| `maxTexture3DSize` | `uint32_t` | 最大 3D 纹理尺寸 |
| `maxTextureCubeSize` | `uint32_t` | 最大立方体贴图尺寸 |
| `maxRenderTargets` | `uint32_t` | 最大渲染目标数量 |
| `maxViewports` | `uint32_t` | 最大视口数量 |
| `maxVertexAttribs` | `uint32_t` | 最大顶点属性数量 |
| `maxConstantBufferSize` | `uint32_t` | 最大常量缓冲大小 |
| `maxAnisotropy` | `uint32_t` | 最大各向异性级别 |
| `maxColorAttachments` | `uint32_t` | 最大颜色附件数量 |
### 线宽和点大小
| 成员 | 类型 | 描述 |
|------|------|------|
| `minSmoothedLineWidth` | `float` | 最小平滑线宽 |
| `maxSmoothedLineWidth` | `float` | 最大平滑线宽 |
| `minPointSize` | `float` | 最小点大小 |
| `maxPointSize` | `float` | 最大点大小 |
| `maxPointSizeAA` | `float` | 抗锯齿最大点大小 |
| `maxLineWidth` | `float` | 最大线宽 |
| `maxLineWidthAA` | `float` | 抗锯齿最大线宽 |
### 版本信息
| 成员 | 类型 | 描述 |
|------|------|------|
| `majorVersion` | `int` | 主版本号 |
| `minorVersion` | `int` | 次版本号 |
| `shaderModel` | `std::string` | 着色器模型版本 |
## 使用示例
```cpp
const RHICapabilities& caps = device->GetCapabilities();
if (caps.bSupportsRayTracing) {
// 启用光线追踪功能
}
if (caps.bSupportsComputeShaders) {
// 启用计算着色器
}
uint32_t textureSize = std::min(requestedSize, caps.maxTexture2DSize);
```
## 相关文档
- [../rhi/rhi.md](../rhi.md) - RHI 模块总览
- [RHIDevice](../device/device.md) - 设备对象

View File

@@ -0,0 +1,22 @@
# RHICommandList::ClearDepthStencil
```cpp
virtual void ClearDepthStencil(void* depthStencil, float depth, uint8_t stencil) = 0;
```
清除深度模板缓冲区。
**参数:**
- `depthStencil` - 深度模板缓冲区指针
- `depth` - 深度值
- `stencil` - 模板值
**示例:**
```cpp
cmdList->ClearDepthStencil(depthStencil, 1.0f, 0);
```
## 相关文档
- [RHICommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,22 @@
# RHICommandList::ClearRenderTarget
```cpp
virtual void ClearRenderTarget(void* renderTarget, const float color[4]) = 0;
```
清除渲染目标。
**参数:**
- `renderTarget` - 渲染目标指针
- `color` - 清除颜色 [r, g, b, a]
**示例:**
```cpp
float color[4] = {0.0f, 0.0f, 0.0f, 1.0f};
cmdList->ClearRenderTarget(renderTarget, color);
```
## 相关文档
- [RHICommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,20 @@
# RHICommandList::Clear
```cpp
virtual void Clear(float r, float g, float b, float a, uint32_t buffers) = 0;
```
清除渲染目标。
**参数:**
- `r` - 红色分量
- `g` - 绿色分量
- `b` - 蓝色分量
- `a` - Alpha 分量
- `buffers` - 要清除的缓冲区标志
**复杂度:** O(1)
## 相关文档
- [RHICommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,13 @@
# RHICommandList::Close
```cpp
virtual void Close() = 0;
```
关闭命令列表以执行。
**复杂度:** O(1)
## 相关文档
- [RHICommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,55 @@
# RHICommandList
**命名空间**: `XCEngine::RHI`
**类型**: `class` (abstract)
**描述**: GPU 命令列表抽象接口,用于录制和执行 GPU 命令。
## 公共方法
| 方法 | 描述 |
|------|------|
| [`Reset`](reset.md) | 重置命令列表 |
| [`Close`](close.md) | 关闭命令列表 |
| [`TransitionBarrier`](transition-barrier.md) | 资源状态转换 |
| [`SetPipelineState`](set-pipeline-state.md) | 设置管线状态 |
| [`SetPrimitiveTopology`](set-primitive-topology.md) | 设置图元拓扑 |
| [`SetViewport`](set-viewport.md) | 设置视口 |
| [`SetViewports`](set-viewports.md) | 设置多个视口 |
| [`SetScissorRect`](set-scissor-rect.md) | 设置裁剪矩形 |
| [`SetScissorRects`](set-scissor-rects.md) | 设置多个裁剪矩形 |
| [`SetRenderTargets`](set-render-targets.md) | 设置渲染目标 |
| [`SetDepthStencilState`](set-depth-stencil-state.md) | 设置深度模板状态 |
| [`SetStencilRef`](set-stencil-ref.md) | 设置模板引用值 |
| [`SetBlendState`](set-blend-state.md) | 设置混合状态 |
| [`SetBlendFactor`](set-blend-factor.md) | 设置混合因子 |
| [`SetVertexBuffer`](set-vertex-buffer.md) | 设置顶点缓冲 |
| [`SetVertexBuffers`](set-vertex-buffers.md) | 设置多个顶点缓冲 |
| [`SetIndexBuffer`](set-index-buffer.md) | 设置索引缓冲 |
| [`Draw`](draw.md) | 绘制 |
| [`DrawIndexed`](draw-indexed.md) | 索引绘制 |
| [`Clear`](clear.md) | 清除 |
| [`ClearRenderTarget`](clear-render-target.md) | 清除渲染目标 |
| [`ClearDepthStencil`](clear-depth-stencil.md) | 清除深度模板 |
| [`CopyResource`](copy-resource.md) | 复制资源 |
| [`Dispatch`](dispatch.md) | 分发计算任务 |
| [`Shutdown`](shutdown.md) | 关闭并释放资源 |
## 使用示例
```cpp
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.md](../rhi.md) - RHI 模块总览
- [RHICommandQueue](../command-queue/command-queue.md) - 命令队列

View File

@@ -0,0 +1,21 @@
# RHICommandList::CopyResource
```cpp
virtual void CopyResource(void* dst, void* src) = 0;
```
复制资源。
**参数:**
- `dst` - 目标资源
- `src` - 源资源
**示例:**
```cpp
cmdList->CopyResource(dstTexture, srcTexture);
```
## 相关文档
- [RHICommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,22 @@
# RHICommandList::Dispatch
```cpp
virtual void Dispatch(uint32_t x, uint32_t y, uint32_t z) = 0;
```
分发计算着色器。
**参数:**
- `x` - X 方向线程组数量
- `y` - Y 方向线程组数量
- `z` - Z 方向线程组数量
**示例:**
```cpp
cmdList->Dispatch(8, 8, 1); // 分发 8x8x1 线程组
```
## 相关文档
- [RHICommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,24 @@
# RHICommandList::DrawIndexed
```cpp
virtual void DrawIndexed(uint32_t indexCount, uint32_t instanceCount = 1, uint32_t startIndex = 0, int32_t baseVertex = 0, uint32_t startInstance = 0) = 0;
```
绘制索引图元。
**参数:**
- `indexCount` - 索引数量
- `instanceCount` - 实例数量默认1
- `startIndex` - 起始索引
- `baseVertex` - 基础顶点索引
- `startInstance` - 起始实例索引
**示例:**
```cpp
cmdList->DrawIndexed(36); // 绘制36个索引
```
## 相关文档
- [RHICommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,23 @@
# RHICommandList::Draw
```cpp
virtual void Draw(uint32_t vertexCount, uint32_t instanceCount = 1, uint32_t startVertex = 0, uint32_t startInstance = 0) = 0;
```
绘制调用。
**参数:**
- `vertexCount` - 顶点数量
- `instanceCount` - 实例数量默认1
- `startVertex` - 起始顶点索引
- `startInstance` - 起始实例索引
**示例:**
```cpp
cmdList->Draw(36); // 绘制36个顶点
```
## 相关文档
- [RHICommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,201 @@
# RHICommandList 方法
## Reset
```cpp
virtual void Reset() = 0;
```
重置命令列表,开始新的录制。
## Close
```cpp
virtual void Close() = 0;
```
关闭命令列表,结束录制。
## TransitionBarrier
```cpp
virtual void TransitionBarrier(void* resource, ResourceStates stateBefore, ResourceStates stateAfter) = 0;
```
资源状态转换屏障。
## SetPipelineState
```cpp
virtual void SetPipelineState(void* pso) = 0;
```
设置管线状态对象。
## SetPrimitiveTopology
```cpp
virtual void SetPrimitiveTopology(PrimitiveTopology topology) = 0;
```
设置图元拓扑。
## SetViewport
```cpp
virtual void SetViewport(const Viewport& viewport) = 0;
```
设置视口。
## SetViewports
```cpp
virtual void SetViewports(uint32_t count, const Viewport* viewports) = 0;
```
设置多个视口。
## SetScissorRect
```cpp
virtual void SetScissorRect(const Rect& rect) = 0;
```
设置裁剪矩形。
## SetScissorRects
```cpp
virtual void SetScissorRects(uint32_t count, const Rect* rects) = 0;
```
设置多个裁剪矩形。
## SetRenderTargets
```cpp
virtual void SetRenderTargets(uint32_t count, void** renderTargets, void* depthStencil = nullptr) = 0;
```
设置渲染目标。
## SetDepthStencilState
```cpp
virtual void SetDepthStencilState(const DepthStencilState& state) = 0;
```
设置深度模板状态。
## SetStencilRef
```cpp
virtual void SetStencilRef(uint8_t ref) = 0;
```
设置模板参考值。
## SetBlendState
```cpp
virtual void SetBlendState(const BlendState& state) = 0;
```
设置混合状态。
## SetBlendFactor
```cpp
virtual void SetBlendFactor(const float factor[4]) = 0;
```
设置混合因子。
## SetVertexBuffer
```cpp
virtual void SetVertexBuffer(uint32_t slot, void* buffer, uint64_t offset, uint32_t stride) = 0;
```
设置顶点缓冲。
## SetVertexBuffers
```cpp
virtual void SetVertexBuffers(uint32_t startSlot, uint32_t count, const uint64_t* buffers, const uint64_t* offsets, const uint32_t* strides) = 0;
```
设置多个顶点缓冲。
## SetIndexBuffer
```cpp
virtual void SetIndexBuffer(void* buffer, uint64_t offset, Format format) = 0;
```
设置索引缓冲。
## Draw
```cpp
virtual void Draw(uint32_t vertexCount, uint32_t instanceCount = 1, uint32_t startVertex = 0, uint32_t startInstance = 0) = 0;
```
绘制调用。
## DrawIndexed
```cpp
virtual void DrawIndexed(uint32_t indexCount, uint32_t instanceCount = 1, uint32_t startIndex = 0, int32_t baseVertex = 0, uint32_t startInstance = 0) = 0;
```
索引绘制调用。
## Clear
```cpp
virtual void Clear(float r, float g, float b, float a, uint32_t buffers) = 0;
```
清除缓冲。
## ClearRenderTarget
```cpp
virtual void ClearRenderTarget(void* renderTarget, const float color[4]) = 0;
```
清除渲染目标。
## ClearDepthStencil
```cpp
virtual void ClearDepthStencil(void* depthStencil, float depth, uint8_t stencil) = 0;
```
清除深度模板。
## CopyResource
```cpp
virtual void CopyResource(void* dst, void* src) = 0;
```
复制资源。
## Dispatch
```cpp
virtual void Dispatch(uint32_t x, uint32_t y, uint32_t z) = 0;
```
分发计算着色器。
## Shutdown
```cpp
virtual void Shutdown() = 0;
```
释放命令列表资源。

View File

@@ -0,0 +1,13 @@
# RHICommandList::Reset
```cpp
virtual void Reset() = 0;
```
重置命令列表以重新录制。
**复杂度:** O(1)
## 相关文档
- [RHICommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,21 @@
# RHICommandList::SetBlendFactor
```cpp
virtual void SetBlendFactor(const float factor[4]) = 0;
```
设置混合因子。
**参数:**
- `factor` - 混合因子数组 [r, g, b, a]
**示例:**
```cpp
float factor[4] = {0.5f, 0.5f, 0.5f, 1.0f};
cmdList->SetBlendFactor(factor);
```
## 相关文档
- [RHICommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,23 @@
# RHICommandList::SetBlendState
```cpp
virtual void SetBlendState(const BlendState& state) = 0;
```
设置混合状态。
**参数:**
- `state` - 混合状态结构体
**示例:**
```cpp
BlendState blendState;
blendState.alphaToCoverageEnable = false;
blendState.independentBlendEnable = false;
cmdList->SetBlendState(blendState);
```
## 相关文档
- [RHICommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,24 @@
# RHICommandList::SetDepthStencilState
```cpp
virtual void SetDepthStencilState(const DepthStencilState& state) = 0;
```
设置深度模板状态。
**参数:**
- `state` - 深度模板状态结构体
**示例:**
```cpp
DepthStencilState dsState;
dsState.depthEnable = true;
dsState.depthWriteMask = true;
dsState.depthFunc = ComparisonFunc::Less;
cmdList->SetDepthStencilState(dsState);
```
## 相关文档
- [RHICommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,22 @@
# RHICommandList::SetIndexBuffer
```cpp
virtual void SetIndexBuffer(void* buffer, uint64_t offset, Format format) = 0;
```
设置索引缓冲区。
**参数:**
- `buffer` - 索引缓冲区指针
- `offset` - 数据偏移量
- `format` - 索引格式R16_UINT 或 R32_UINT
**示例:**
```cpp
cmdList->SetIndexBuffer(indexBuffer, 0, Format::R16_UINT);
```
## 相关文档
- [RHICommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,20 @@
# RHICommandList::SetPipelineState
```cpp
virtual void SetPipelineState(void* pso) = 0;
```
设置渲染管线状态对象。
**参数:**
- `pso` - 管线状态对象指针
**示例:**
```cpp
cmdList->SetPipelineState(pipelineState);
```
## 相关文档
- [RHICommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,20 @@
# RHICommandList::SetPrimitiveTopology
```cpp
virtual void SetPrimitiveTopology(PrimitiveTopology topology) = 0;
```
设置图元拓扑类型。
**参数:**
- `topology` - 图元拓扑类型(点、线、三角形等)
**示例:**
```cpp
cmdList->SetPrimitiveTopology(PrimitiveTopology::TriangleList);
```
## 相关文档
- [RHICommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,23 @@
# RHICommandList::SetRenderTargets
```cpp
virtual void SetRenderTargets(uint32_t count, void** renderTargets, void* depthStencil = nullptr) = 0;
```
设置渲染目标和深度模板缓冲区。
**参数:**
- `count` - 渲染目标数量
- `renderTargets` - 渲染目标数组
- `depthStencil` - 深度模板缓冲区(可选)
**示例:**
```cpp
void* targets[1] = {renderTarget};
cmdList->SetRenderTargets(1, targets, depthStencil);
```
## 相关文档
- [RHICommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,25 @@
# RHICommandList::SetScissorRect
```cpp
virtual void SetScissorRect(const Rect& rect) = 0;
```
设置裁剪矩形。
**参数:**
- `rect` - 裁剪矩形结构体
**示例:**
```cpp
Rect rect;
rect.left = 0;
rect.top = 0;
rect.right = 640;
rect.bottom = 480;
cmdList->SetScissorRect(rect);
```
## 相关文档
- [RHICommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,24 @@
# RHICommandList::SetScissorRects
```cpp
virtual void SetScissorRects(uint32_t count, const Rect* rects) = 0;
```
设置多个裁剪矩形。
**参数:**
- `count` - 裁剪矩形数量
- `rects` - 裁剪矩形数组指针
**示例:**
```cpp
Rect rects[2];
rects[0] = {0, 0, 640, 480};
rects[1] = {640, 0, 640, 480};
cmdList->SetScissorRects(2, rects);
```
## 相关文档
- [RHICommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,20 @@
# RHICommandList::SetStencilRef
```cpp
virtual void SetStencilRef(uint8_t ref) = 0;
```
设置模板参考值。
**参数:**
- `ref` - 模板参考值
**示例:**
```cpp
cmdList->SetStencilRef(0xFF);
```
## 相关文档
- [RHICommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,23 @@
# RHICommandList::SetVertexBuffer
```cpp
virtual void SetVertexBuffer(uint32_t slot, void* buffer, uint64_t offset, uint32_t stride) = 0;
```
设置顶点缓冲区。
**参数:**
- `slot` - 顶点缓冲区槽位
- `buffer` - 顶点缓冲区指针
- `offset` - 数据偏移量
- `stride` - 顶点步长
**示例:**
```cpp
cmdList->SetVertexBuffer(0, vertexBuffer, 0, sizeof(Vertex));
```
## 相关文档
- [RHICommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,27 @@
# RHICommandList::SetVertexBuffers
```cpp
virtual void SetVertexBuffers(uint32_t startSlot, uint32_t count, const uint64_t* buffers, const uint64_t* offsets, const uint32_t* strides) = 0;
```
设置多个顶点缓冲区。
**参数:**
- `startSlot` - 起始槽位
- `count` - 缓冲区数量
- `buffers` - 缓冲区指针数组
- `offsets` - 偏移量数组
- `strides` - 步长数组
**示例:**
```cpp
uint64_t buffers[2] = {(uint64_t)vb1, (uint64_t)vb2};
uint64_t offsets[2] = {0, 0};
uint32_t strides[2] = {sizeof(Vertex), sizeof(Vertex)};
cmdList->SetVertexBuffers(0, 2, buffers, offsets, strides);
```
## 相关文档
- [RHICommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,27 @@
# RHICommandList::SetViewport
```cpp
virtual void SetViewport(const Viewport& viewport) = 0;
```
设置视口。
**参数:**
- `viewport` - 视口结构体
**示例:**
```cpp
Viewport vp;
vp.topLeftX = 0;
vp.topLeftY = 0;
vp.width = 1280;
vp.height = 720;
vp.minDepth = 0.0f;
vp.maxDepth = 1.0f;
cmdList->SetViewport(vp);
```
## 相关文档
- [RHICommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,24 @@
# RHICommandList::SetViewports
```cpp
virtual void SetViewports(uint32_t count, const Viewport* viewports) = 0;
```
设置多个视口。
**参数:**
- `count` - 视口数量
- `viewports` - 视口数组指针
**示例:**
```cpp
Viewport viewports[2];
viewports[0] = {0, 0, 640, 720, 0.0f, 1.0f};
viewports[1] = {640, 0, 640, 720, 0.0f, 1.0f};
cmdList->SetViewports(2, viewports);
```
## 相关文档
- [RHICommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,13 @@
# RHICommandList::Shutdown
```cpp
virtual void Shutdown() = 0;
```
关闭命令列表,释放所有相关资源。
**复杂度:** O(n) - 取决于管理的命令数量
## 相关文档
- [RHICommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,23 @@
# RHICommandList::TransitionBarrier
```cpp
virtual void TransitionBarrier(void* resource, ResourceStates stateBefore, ResourceStates stateAfter) = 0;
```
设置资源状态转换屏障,确保 GPU 资源在状态转换前完成所有操作。
**参数:**
- `resource` - 目标资源指针
- `stateBefore` - 转换前的资源状态
- `stateAfter` - 转换后的资源状态
**示例:**
```cpp
// 将纹理从渲染目标状态转换到着色器读取状态
cmdList->TransitionBarrier(texture, ResourceStates::RenderTarget, ResourceStates::ShaderResource);
```
## 相关文档
- [RHICommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,50 @@
# 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) - 同步栅栏

View File

@@ -0,0 +1,22 @@
# RHICommandQueue::ExecuteCommandLists
```cpp
virtual void ExecuteCommandLists(uint32_t count, void** lists) = 0;
```
执行命令列表。
**参数:**
- `count` - 命令列表数量
- `lists` - 命令列表指针数组
**示例:**
```cpp
void* lists[1] = {cmdList};
cmdQueue->ExecuteCommandLists(1, lists);
```
## 相关文档
- [RHICommandQueue 总览](command-queue.md) - 返回类总览

View File

@@ -0,0 +1,19 @@
# RHICommandQueue::GetCompletedValue
```cpp
virtual uint64_t GetCompletedValue() = 0;
```
获取栅栏已完成值。
**返回:** 已完成的信号值
**示例:**
```cpp
uint64_t value = cmdQueue->GetCompletedValue();
```
## 相关文档
- [RHICommandQueue 总览](command-queue.md) - 返回类总览

View File

@@ -0,0 +1,15 @@
# RHICommandQueue::GetNativeHandle
```cpp
virtual void* GetNativeHandle() = 0;
```
获取原生 API 句柄。
**返回:** 原生命令队列句柄
**复杂度:** O(1)
## 相关文档
- [RHICommandQueue 总览](command-queue.md) - 返回类总览

View File

@@ -0,0 +1,19 @@
# RHICommandQueue::GetTimestampFrequency
```cpp
virtual uint64_t GetTimestampFrequency() const = 0;
```
获取时间戳频率。
**返回:** 时间戳频率(每秒计数)
**示例:**
```cpp
uint64_t freq = cmdQueue->GetTimestampFrequency();
```
## 相关文档
- [RHICommandQueue 总览](command-queue.md) - 返回类总览

View File

@@ -0,0 +1,15 @@
# RHICommandQueue::GetType
```cpp
virtual CommandQueueType GetType() const = 0;
```
获取命令队列类型。
**返回:** 命令队列类型枚举值
**复杂度:** O(1)
## 相关文档
- [RHICommandQueue 总览](command-queue.md) - 返回类总览

View File

@@ -0,0 +1,73 @@
# RHICommandQueue 方法
## Shutdown
```cpp
virtual void Shutdown() = 0;
```
关闭命令队列。
## ExecuteCommandLists
```cpp
virtual void ExecuteCommandLists(uint32_t count, void** lists) = 0;
```
执行命令列表。
## Signal
```cpp
virtual void Signal(RHIFence* fence, uint64_t value) = 0;
```
信号通知栅栏。
## Wait
```cpp
virtual void Wait(RHIFence* fence, uint64_t value) = 0;
```
等待栅栏。
## GetCompletedValue
```cpp
virtual uint64_t GetCompletedValue() = 0;
```
获取已完成的值。
## WaitForIdle
```cpp
virtual void WaitForIdle() = 0;
```
等待队列空闲。
## GetType
```cpp
virtual CommandQueueType GetType() const = 0;
```
获取队列类型。
## GetTimestampFrequency
```cpp
virtual uint64_t GetTimestampFrequency() const = 0;
```
获取时间戳频率。
## GetNativeHandle
```cpp
virtual void* GetNativeHandle() = 0;
```
获取原生 API 句柄。

View File

@@ -0,0 +1,13 @@
# RHICommandQueue::Shutdown
```cpp
virtual void Shutdown() = 0;
```
关闭命令队列,释放所有相关资源。
**复杂度:** O(n) - 取决于管理的命令列表数量
## 相关文档
- [RHICommandQueue 总览](command-queue.md) - 返回类总览

View File

@@ -0,0 +1,21 @@
# RHICommandQueue::Signal
```cpp
virtual void Signal(RHIFence* fence, uint64_t value) = 0;
```
向栅栏发送信号。
**参数:**
- `fence` - 目标栅栏
- `value` - 信号值
**示例:**
```cpp
cmdQueue->Signal(fence, 1);
```
## 相关文档
- [RHICommandQueue 总览](command-queue.md) - 返回类总览

View File

@@ -0,0 +1,17 @@
# RHICommandQueue::WaitForIdle
```cpp
virtual void WaitForIdle() = 0;
```
等待命令队列完成所有操作。
**示例:**
```cpp
cmdQueue->WaitForIdle();
```
## 相关文档
- [RHICommandQueue 总览](command-queue.md) - 返回类总览

View File

@@ -0,0 +1,37 @@
# D3D12Buffer
**命名空间**: `XCEngine::RHI`
**描述**: DirectX 12 缓冲区的 D3D12 实现,继承自 `RHIBuffer`
## 公共方法
| 方法 | 描述 |
|------|------|
| [`Initialize`](initialize.md) | 初始化缓冲区 |
| [`InitializeFromExisting`](initialize-from-existing.md) | 从现有资源初始化 |
| [`InitializeWithData`](initialize-with-data.md) | 初始化并写入数据 |
| [`Shutdown`](shutdown.md) | 关闭缓冲区 |
| [`UpdateData`](update-data.md) | 更新数据 |
| [`Map`](map.md) | 映射缓冲区 |
| [`Unmap`](unmap.md) | 取消映射 |
| [`SetData`](set-data.md) | 设置数据 |
| [`GetResource`](get-resource.md) | 获取 D3D12 资源 |
| [`GetDesc`](get-desc.md) | 获取描述符 |
| [`GetGPUVirtualAddress`](get-gpu-virtual-address.md) | 获取 GPU 虚拟地址 |
| [`GetGPUAddress`](get-gpu-address.md) | 获取 GPU 地址 |
| [`GetSize`](get-size.md) | 获取缓冲区大小 |
| [`GetState`](get-state.md) | 获取资源状态 |
| [`SetState`](../../buffer/set-state.md) | 设置资源状态 |
| [`GetName`](get-name.md) | 获取资源名称 |
| [`SetName`](../../buffer/set-name.md) | 设置资源名称 |
| [`GetStride`](get-stride.md) | 获取步长 |
| [`SetStride`](../../buffer/set-stride.md) | 设置步长 |
| [`GetBufferType`](get-buffer-type.md) | 获取缓冲区类型 |
| [`SetBufferType`](../../buffer/set-buffer-type.md) | 设置缓冲区类型 |
| [`GetNativeHandle`](get-native-handle.md) | 获取原生句柄 |
## 相关文档
- [D3D12 后端总览](../../opengl/overview.md)
- [RHIBuffer](../../buffer/buffer.md) - 抽象缓冲区接口

View File

@@ -0,0 +1,16 @@
# D3D12Buffer::GetBufferType / SetBufferType
## 函数签名
```cpp
BufferType GetBufferType() const override
void SetBufferType(BufferType type) override
```
## 中文描述
获取和设置缓冲区类型Vertex / Index / Constant 等)。
## 复杂度
O(1)

View File

@@ -0,0 +1,19 @@
# D3D12Buffer::GetDesc
## 函数签名
```cpp
D3D12_RESOURCE_DESC GetDesc() const
```
## 中文描述
获取 D3D12 资源描述结构。
## 返回值
`D3D12_RESOURCE_DESC` - 资源描述
## 复杂度
O(1)

View File

@@ -0,0 +1,19 @@
# D3D12Buffer::GetGPUAddress
## 函数签名
```cpp
uint64_t GetGPUAddress() const
```
## 中文描述
获取 GPU 地址(等同于 `GetGPUVirtualAddress`)。
## 返回值
`uint64_t` - GPU 地址
## 复杂度
O(1)

View File

@@ -0,0 +1,19 @@
# D3D12Buffer::GetGPUVirtualAddress
## 函数签名
```cpp
D3D12_GPU_VIRTUAL_ADDRESS GetGPUVirtualAddress() const
```
## 中文描述
获取 GPU 虚拟地址,用于根签名绑定。
## 返回值
`D3D12_GPU_VIRTUAL_ADDRESS` - GPU 虚拟地址
## 复杂度
O(1)

View File

@@ -0,0 +1,16 @@
# D3D12Buffer::GetName / SetName
## 函数签名
```cpp
const std::string& GetName() const override
void SetName(const std::string& name) override
```
## 中文描述
获取和设置对象名称(用于调试)。
## 复杂度
O(1)

View File

@@ -0,0 +1,19 @@
# D3D12Buffer::GetNativeHandle
## 函数签名
```cpp
void* GetNativeHandle() override
```
## 中文描述
返回原生句柄,即 `ID3D12Resource*`
## 返回值
`void*` - 原生句柄
## 复杂度
O(1)

View File

@@ -0,0 +1,19 @@
# D3D12Buffer::GetResource
## 函数签名
```cpp
ID3D12Resource* GetResource() const
```
## 中文描述
获取底层 `ID3D12Resource` 指针。
## 返回值
`ID3D12Resource*` - D3D12 资源指针
## 复杂度
O(1)

View File

@@ -0,0 +1,19 @@
# D3D12Buffer::GetSize
## 函数签名
```cpp
uint64_t GetSize() const override
```
## 中文描述
获取缓冲区大小(字节)。
## 返回值
`uint64_t` - 缓冲区大小
## 复杂度
O(1)

View File

@@ -0,0 +1,16 @@
# D3D12Buffer::GetState / SetState
## 函数签名
```cpp
ResourceStates GetState() const
void SetState(ResourceStates state)
```
## 中文描述
获取和设置当前资源状态。用于状态跟踪和屏障生成。
## 复杂度
O(1)

View File

@@ -0,0 +1,16 @@
# D3D12Buffer::GetStride / SetStride
## 函数签名
```cpp
uint32_t GetStride() const override
void SetStride(uint32_t stride) override
```
## 中文描述
获取和设置顶点缓冲区步长(字节)。
## 复杂度
O(1)

View File

@@ -0,0 +1,35 @@
# D3D12Buffer::InitializeFromExisting
## 函数签名
```cpp
bool InitializeFromExisting(ID3D12Resource* resource)
```
## 中文描述
从已存在的 D3D12 资源对象初始化缓冲区包装类,不分配新资源。
## 参数
| 参数 | 类型 | 描述 |
|------|------|------|
| `resource` | `ID3D12Resource*` | 已存在的 D3D12 资源指针 |
## 返回值
`bool` - 初始化是否成功
## 复杂度
O(1)
## 示例
```cpp
ComPtr<ID3D12Resource> existingResource;
device->CreateReservedResource(&desc, state, nullptr, IID_PPV_ARGS(&existingResource));
D3D12Buffer buffer;
buffer.InitializeFromExisting(existingResource.Get());
```

View File

@@ -0,0 +1,42 @@
# D3D12Buffer::InitializeWithData
## 函数签名
```cpp
bool InitializeWithData(ID3D12Device* device, ID3D12GraphicsCommandList* commandList, const void* data, uint64_t size, D3D12_RESOURCE_STATES finalState)
```
## 中文描述
创建缓冲区并通过命令列表从内存数据初始化内容。内部会自动创建上传堆、复制数据、转换状态。
## 参数
| 参数 | 类型 | 描述 |
|------|------|------|
| `device` | `ID3D12Device*` | D3D12 设备指针 |
| `commandList` | `ID3D12GraphicsCommandList*` | 命令列表(用于复制操作) |
| `data` | `const void*` | 初始数据指针 |
| `size` | `uint64_t` | 数据大小(字节) |
| `finalState` | `D3D12_RESOURCE_STATES` | 数据复制完成后的目标状态 |
## 返回值
`bool` - 初始化是否成功
## 复杂度
O(n) - 取决于数据大小,内部创建临时上传堆
## 示例
```cpp
uint16_t indices[] = { 0, 1, 2, 1, 3, 2 };
D3D12Buffer indexBuffer;
D3D12Buffer::InitializeWithData(
device->GetDevice(),
cmdList->GetCommandList(),
indices,
sizeof(indices),
D3D12_RESOURCE_STATE_INDEX_BUFFER);
```

View File

@@ -0,0 +1,39 @@
# D3D12Buffer::Initialize
## 函数签名
```cpp
bool Initialize(ID3D12Device* device, uint64_t size, D3D12_RESOURCE_STATES initialState = D3D12_RESOURCE_STATE_COMMON, D3D12_HEAP_TYPE heapType = D3D12_HEAP_TYPE_DEFAULT)
```
## 中文描述
创建新缓冲区,分配 D3D12 显存资源。
## 参数
| 参数 | 类型 | 描述 |
|------|------|------|
| `device` | `ID3D12Device*` | D3D12 设备指针 |
| `size` | `uint64_t` | 缓冲区大小(字节) |
| `initialState` | `D3D12_RESOURCE_STATES` | 初始资源状态(默认 COMMON |
| `heapType` | `D3D12_HEAP_TYPE` | 堆类型DEFAULT默认、UPLOAD上传、READBACK回读 |
## 返回值
`bool` - 初始化是否成功
## 复杂度
O(n) - 取决于缓冲区大小
## 示例
```cpp
D3D12Buffer vertexBuffer;
vertexBuffer.Initialize(
device->GetDevice(),
sizeof(Vertex) * vertexCount,
D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER,
D3D12_HEAP_TYPE_DEFAULT);
```

View File

@@ -0,0 +1,27 @@
# D3D12Buffer::Map
## 函数签名
```cpp
void* Map() override
```
## 中文描述
将缓冲区内存映射到 CPU 可访问地址。仅对 UPLOAD 或 READBACK 堆有效。
## 返回值
`void*` - 映射的内存指针
## 复杂度
O(1)
## 示例
```cpp
void* mapped = uploadBuffer.Map();
memcpy(mapped, vertexData, sizeof(vertexData));
buffer.Unmap();
```

View File

@@ -0,0 +1,23 @@
# D3D12Buffer::SetData
## 函数签名
```cpp
void SetData(const void* data, size_t size, size_t offset = 0) override
```
## 中文描述
设置缓冲区数据。通过 Map/Unmap 实现。
## 参数
| 参数 | 类型 | 描述 |
|------|------|------|
| `data` | `const void*` | 数据指针 |
| `size` | `size_t` | 数据大小 |
| `offset` | `size_t` | 缓冲区内的偏移量 |
## 复杂度
O(n)

View File

@@ -0,0 +1,15 @@
# D3D12Buffer::Shutdown
## 函数签名
```cpp
void Shutdown() override
```
## 中文描述
释放 D3D12 缓冲区资源,将成员变量置为空。
## 复杂度
O(1)

View File

@@ -0,0 +1,15 @@
# D3D12Buffer::Unmap
## 函数签名
```cpp
void Unmap() override
```
## 中文描述
解除缓冲区内存映射。
## 复杂度
O(1)

View File

@@ -0,0 +1,28 @@
# D3D12Buffer::UpdateData
## 函数签名
```cpp
void UpdateData(const void* data, uint64_t size)
```
## 中文描述
更新缓冲区数据。要求缓冲区使用 UPLOAD 堆类型,否则行为未定义。
## 参数
| 参数 | 类型 | 描述 |
|------|------|------|
| `data` | `const void*` | 新数据指针 |
| `size` | `uint64_t` | 数据大小 |
## 复杂度
O(n)
## 示例
```cpp
uploadBuffer.UpdateData(newData, dataSize);
```

View File

@@ -0,0 +1,19 @@
# D3D12CommandAllocator
**命名空间**: `XCEngine::RHI`
**描述**: DirectX 12 命令分配器的 D3D12 实现。
## 公共方法
| 方法 | 描述 |
|------|------|
| [`Initialize`](../../../threading/task-system/initialize.md) | 初始化命令分配器 |
| [`Shutdown`](../../../threading/task-system/shutdown.md) | 关闭命令分配器 |
| [`Reset`](../../command-list/reset.md) | 重置命令分配器 |
| [`IsReady`](is-ready.md) | 检查是否就绪 |
| [`GetCommandAllocator`](get-command-allocator.md) | 获取 D3D12 命令分配器 |
## 相关文档
- [D3D12 后端总览](../../opengl/overview.md)

View File

@@ -0,0 +1,15 @@
# D3D12CommandAllocator::GetCommandAllocator
```cpp
ID3D12CommandAllocator* GetCommandAllocator() const { return m_commandAllocator.Get(); }
```
获取底层的 D3D12 命令分配器接口。
**返回:** `ID3D12CommandAllocator*`
**复杂度:** O(1)
## 相关文档
- [D3D12CommandAllocator 总览](command-allocator.md) - 返回类总览

View File

@@ -0,0 +1,15 @@
# D3D12CommandAllocator::IsReady
```cpp
bool IsReady() const;
```
检查命令分配器是否准备就绪。
**返回:** 分配器是否准备就绪
**复杂度:** O(1)
## 相关文档
- [D3D12CommandAllocator 总览](command-allocator.md) - 返回类总览

View File

@@ -0,0 +1,17 @@
# D3D12CommandList::AliasBarrier
```cpp
void AliasBarrier(void* beforeResource = nullptr, void* afterResource = nullptr);
```
添加资源别名屏障。
**参数:**
- `beforeResource` - 别名切换前的资源
- `afterResource` - 别名切换后的资源
**复杂度:** O(1)
## 相关文档
- [D3D12CommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,18 @@
# D3D12CommandList::BeginQuery
```cpp
void BeginQuery(ID3D12QueryHeap* queryHeap, QueryType type, uint32_t index);
```
开始查询。
**参数:**
- `queryHeap` - 查询堆
- `type` - 查询类型
- `index` - 查询索引
**复杂度:** O(1)
## 相关文档
- [D3D12CommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,18 @@
# D3D12CommandList::ClearDepthStencil
```cpp
void ClearDepthStencil(void* depthStencil, float depth, uint8_t stencil) override;
```
清除深度模板。
**参数:**
- `depthStencil` - 深度模板指针
- `depth` - 深度值
- `stencil` - 模板值
**复杂度:** O(1)
## 相关文档
- [D3D12CommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,17 @@
# D3D12CommandList::ClearRenderTarget
```cpp
void ClearRenderTarget(void* renderTarget, const float color[4]) override;
```
清除渲染目标。
**参数:**
- `renderTarget` - 渲染目标指针
- `color` - 清除颜色 [r, g, b, a]
**复杂度:** O(1)
## 相关文档
- [D3D12CommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,65 @@
# D3D12CommandList
**命名空间**: `XCEngine::RHI`
**描述**: DirectX 12 命令列表的 D3D12 实现,继承自 `RHICommandList`
## 公共方法
| 方法 | 描述 |
|------|------|
| [`Shutdown`](../../../threading/task-system/shutdown.md) | 关闭命令列表 |
| [`Reset`](../../command-list/reset.md) | 重置命令列表 |
| [`Close`](../../command-list/close.md) | 关闭命令列表 |
| [`GetCommandList`](get-command-list.md) | 获取 D3D12 命令列表 |
| [`TransitionBarrier`](transition-barrier.md) | 资源状态转换 |
| [`TransitionBarrierInternal`](transition-barrier-internal.md) | 内部资源状态转换 |
| [`UAVBarrier`](uav-barrier.md) | UAV 屏障 |
| [`AliasBarrier`](alias-barrier.md) | 别名屏障 |
| [`SetPipelineState`](set-pipeline-state.md) | 设置管线状态 |
| [`SetRootSignature`](set-root-signature.md) | 设置根签名 |
| [`SetPrimitiveTopology`](set-primitive-topology.md) | 设置图元拓扑 |
| [`SetViewport`](set-viewport.md) | 设置视口 |
| [`SetViewports`](set-viewports.md) | 设置多个视口 |
| [`SetScissorRect`](set-scissor-rect.md) | 设置裁剪矩形 |
| [`SetScissorRects`](set-scissor-rects.md) | 设置多个裁剪矩形 |
| [`SetRenderTargets`](set-render-targets.md) | 设置渲染目标 |
| [`SetRenderTargetsInternal`](set-render-targets-internal.md) | 内部渲染目标设置 |
| [`SetRenderTargetsHandle`](set-render-targets-handle.md) | 句柄渲染目标设置 |
| [`SetVertexBuffer`](set-vertex-buffer.md) | 设置顶点缓冲 |
| [`SetVertexBuffers`](set-vertex-buffers.md) | 设置多个顶点缓冲 |
| [`SetIndexBuffer`](set-index-buffer.md) | 设置索引缓冲 |
| [`SetDescriptorHeap`](set-descriptor-heap.md) | 设置描述符堆 |
| [`SetDescriptorHeaps`](set-descriptor-heaps.md) | 设置多个描述符堆 |
| [`SetGraphicsDescriptorTable`](set-graphics-descriptor-table.md) | 设置图形描述符表 |
| [`SetComputeDescriptorTable`](set-compute-descriptor-table.md) | 设置计算描述符表 |
| [`SetGraphicsRootConstantBufferView`](set-graphics-root-constant-buffer-view.md) | 设置图形根常量缓冲视图 |
| [`SetGraphicsRoot32BitConstants`](set-graphics-root-32bit-constants.md) | 设置图形根 32 位常量 |
| [`SetGraphicsRootDescriptorTable`](set-graphics-root-descriptor-table.md) | 设置图形根描述符表 |
| [`SetGraphicsRootShaderResourceView`](set-graphics-root-shader-resource-view.md) | 设置图形根着色器资源视图 |
| [`SetStencilRef`](set-stencil-ref.md) | 设置模板引用值 |
| [`SetBlendFactor`](set-blend-factor.md) | 设置混合因子 |
| [`SetDepthBias`](set-depth-bias.md) | 设置深度偏移 |
| [`Draw`](draw.md) | 绘制 |
| [`DrawIndexed`](draw-indexed.md) | 索引绘制 |
| [`DrawInstancedIndirect`](draw-instanced-indirect.md) | 实例化间接绘制 |
| [`DrawIndexedInstancedIndirect`](draw-indexed-instanced-indirect.md) | 索引实例化间接绘制 |
| [`Clear`](../../command-list/clear.md) | 清除 |
| [`ClearRenderTarget`](clear-render-target.md) | 清除渲染目标 |
| [`ClearDepthStencil`](clear-depth-stencil.md) | 清除深度模板 |
| [`CopyResource`](copy-resource.md) | 复制资源 |
| [`CopyBuffer`](copy-buffer.md) | 复制缓冲区 |
| [`CopyTexture`](copy-texture.md) | 复制纹理 |
| [`BeginQuery`](begin-query.md) | 开始查询 |
| [`EndQuery`](end-query.md) | 结束查询 |
| [`ResolveQueryData`](resolve-query-data.md) | 解析查询数据 |
| [`Dispatch`](dispatch.md) | 分发计算任务 |
| [`DispatchIndirect`](dispatch-indirect.md) | 间接分发计算任务 |
| [`ExecuteBundle`](execute-bundle.md) | 执行 Bundle |
| [`GetResourceState`](get-resource-state.md) | 获取资源状态 |
| [`TrackResource`](track-resource.md) | 跟踪资源 |
## 相关文档
- [D3D12 后端总览](../../opengl/overview.md)
- [RHICommandList](../../command-list/command-list.md) - 抽象命令列表接口

View File

@@ -0,0 +1,20 @@
# D3D12CommandList::CopyBuffer
```cpp
void CopyBuffer(ID3D12Resource* dst, uint64_t dstOffset, ID3D12Resource* src, uint64_t srcOffset, uint64_t size);
```
复制缓冲区。
**参数:**
- `dst` - 目标缓冲区
- `dstOffset` - 目标偏移
- `src` - 源缓冲区
- `srcOffset` - 源偏移
- `size` - 复制大小
**复杂度:** O(n)
## 相关文档
- [D3D12CommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,17 @@
# D3D12CommandList::CopyResource
```cpp
void CopyResource(void* dst, void* src) override;
```
复制资源。
**参数:**
- `dst` - 目标资源指针
- `src` - 源资源指针
**复杂度:** O(n)
## 相关文档
- [D3D12CommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,19 @@
# D3D12CommandList::CopyTexture
```cpp
void CopyTexture(ID3D12Resource* dst, const D3D12_TEXTURE_COPY_LOCATION& dstLocation, ID3D12Resource* src, const D3D12_TEXTURE_COPY_LOCATION& srcLocation);
```
复制纹理。
**参数:**
- `dst` - 目标纹理
- `dstLocation` - 目标位置
- `src` - 源纹理
- `srcLocation` - 源位置
**复杂度:** O(n)
## 相关文档
- [D3D12CommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,17 @@
# D3D12CommandList::DispatchIndirect
```cpp
void DispatchIndirect(void* argBuffer, uint64_t alignedByteOffset);
```
间接分发计算命令。
**参数:**
- `argBuffer` - 参数缓冲区
- `alignedByteOffset` - 字节偏移
**复杂度:** O(1)
## 相关文档
- [D3D12CommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,18 @@
# D3D12CommandList::Dispatch
```cpp
void Dispatch(uint32_t x, uint32_t y, uint32_t z) override;
```
分发计算命令。
**参数:**
- `x` - X 维度线程组数量
- `y` - Y 维度线程组数量
- `z` - Z 维度线程组数量
**复杂度:** O(1)
## 相关文档
- [D3D12CommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,17 @@
# D3D12CommandList::DrawIndexedInstancedIndirect
```cpp
void DrawIndexedInstancedIndirect(void* argBuffer, uint64_t alignedByteOffset);
```
间接绘制索引实例。
**参数:**
- `argBuffer` - 参数缓冲区
- `alignedByteOffset` - 字节偏移
**复杂度:** O(1)
## 相关文档
- [D3D12CommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,20 @@
# D3D12CommandList::DrawIndexed
```cpp
void DrawIndexed(uint32_t indexCount, uint32_t instanceCount = 1, uint32_t startIndex = 0, int32_t baseVertex = 0, uint32_t startInstance = 0) override;
```
绘制索引调用。
**参数:**
- `indexCount` - 索引数量
- `instanceCount` - 实例数量
- `startIndex` - 起始索引
- `baseVertex` - 基础顶点偏移
- `startInstance` - 起始实例索引
**复杂度:** O(1)
## 相关文档
- [D3D12CommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,17 @@
# D3D12CommandList::DrawInstancedIndirect
```cpp
void DrawInstancedIndirect(void* argBuffer, uint64_t alignedByteOffset);
```
间接绘制实例。
**参数:**
- `argBuffer` - 参数缓冲区
- `alignedByteOffset` - 字节偏移
**复杂度:** O(1)
## 相关文档
- [D3D12CommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,19 @@
# D3D12CommandList::Draw
```cpp
void Draw(uint32_t vertexCount, uint32_t instanceCount = 1, uint32_t startVertex = 0, uint32_t startInstance = 0) override;
```
绘制调用。
**参数:**
- `vertexCount` - 顶点数量
- `instanceCount` - 实例数量
- `startVertex` - 起始顶点索引
- `startInstance` - 起始实例索引
**复杂度:** O(1)
## 相关文档
- [D3D12CommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,18 @@
# D3D12CommandList::EndQuery
```cpp
void EndQuery(ID3D12QueryHeap* queryHeap, QueryType type, uint32_t index);
```
结束查询。
**参数:**
- `queryHeap` - 查询堆
- `type` - 查询类型
- `index` - 查询索引
**复杂度:** O(1)
## 相关文档
- [D3D12CommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,16 @@
# D3D12CommandList::ExecuteBundle
```cpp
void ExecuteBundle(ID3D12GraphicsCommandList* bundle);
```
执行 Bundle。
**参数:**
- `bundle` - Bundle 命令列表
**复杂度:** O(1)
## 相关文档
- [D3D12CommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,15 @@
# D3D12CommandList::GetCommandList
```cpp
ID3D12GraphicsCommandList* GetCommandList() const { return m_commandList.Get(); }
```
获取底层的 D3D12 图形命令列表接口。
**返回:** `ID3D12GraphicsCommandList*`
**复杂度:** O(1)
## 相关文档
- [D3D12CommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,18 @@
# D3D12CommandList::GetResourceState
```cpp
ResourceStates GetResourceState(ID3D12Resource* resource) const;
```
获取资源状态。
**参数:**
- `resource` - D3D12 资源指针
**返回:** 资源当前状态
**复杂度:** O(1)
## 相关文档
- [D3D12CommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,21 @@
# D3D12CommandList::ResolveQueryData
```cpp
void ResolveQueryData(ID3D12QueryHeap* queryHeap, QueryType type, uint32_t startIndex, uint32_t count, ID3D12Resource* resultBuffer, uint64_t resultOffset);
```
解析查询数据。
**参数:**
- `queryHeap` - 查询堆
- `type` - 查询类型
- `startIndex` - 起始索引
- `count` - 查询数量
- `resultBuffer` - 结果缓冲区
- `resultOffset` - 结果偏移
**复杂度:** O(n)
## 相关文档
- [D3D12CommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,16 @@
# D3D12CommandList::SetBlendFactor
```cpp
void SetBlendFactor(const float blendFactor[4]);
```
设置混合因子。
**参数:**
- `blendFactor` - 混合因子数组 [r, g, b, a]
**复杂度:** O(1)
## 相关文档
- [D3D12CommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,17 @@
# D3D12CommandList::SetComputeDescriptorTable
```cpp
void SetComputeDescriptorTable(uint32_t rootParameterIndex, D3D12_GPU_DESCRIPTOR_HANDLE baseHandle);
```
设置计算描述符表。
**参数:**
- `rootParameterIndex` - 根参数索引
- `baseHandle` - GPU 描述符句柄
**复杂度:** O(1)
## 相关文档
- [D3D12CommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,18 @@
# D3D12CommandList::SetDepthBias
```cpp
void SetDepthBias(float depthBias, float slopeScaledDepthBias, float depthBiasClamp);
```
设置深度偏移。
**参数:**
- `depthBias` - 基础深度偏移
- `slopeScaledDepthBias` - 斜率缩放深度偏移
- `depthBiasClamp` - 深度偏移上限
**复杂度:** O(1)
## 相关文档
- [D3D12CommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,16 @@
# D3D12CommandList::SetDescriptorHeap
```cpp
void SetDescriptorHeap(ID3D12DescriptorHeap* heap);
```
设置描述符堆。
**参数:**
- `heap` - D3D12 描述符堆指针
**复杂度:** O(1)
## 相关文档
- [D3D12CommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,17 @@
# D3D12CommandList::SetDescriptorHeaps
```cpp
void SetDescriptorHeaps(uint32_t count, ID3D12DescriptorHeap** heaps);
```
设置多个描述符堆。
**参数:**
- `count` - 描述符堆数量
- `heaps` - 描述符堆指针数组
**复杂度:** O(n)
## 相关文档
- [D3D12CommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,17 @@
# D3D12CommandList::SetGraphicsDescriptorTable
```cpp
void SetGraphicsDescriptorTable(uint32_t rootParameterIndex, D3D12_GPU_DESCRIPTOR_HANDLE baseHandle);
```
设置图形描述符表。
**参数:**
- `rootParameterIndex` - 根参数索引
- `baseHandle` - GPU 描述符句柄
**复杂度:** O(1)
## 相关文档
- [D3D12CommandList 总览](command-list.md) - 返回类总览

Some files were not shown because too many files have changed in this diff Show More