docs: 重构 API 文档结构并修正源码准确性

- 重组文档目录结构: 每个模块的概述页移动到模块子目录
- 重命名 index.md 为 main.md
- 修正所有模块文档中的错误:
  - math: FromEuler→FromEulerAngles, TransformDirection 包含缩放, Box 是 OBB, Color::ToRGBA 格式
  - containers: 新增 operator==/!= 文档, 补充 std::hash DJB 算法细节
  - core: 修复 types 链接错误
  - debug: LogLevelToString 返回大写, timestamp 是秒, Profiler 空实现标注, Windows API vs ANSI
  - memory: 修复头文件路径, malloc vs operator new, 新增方法文档
  - resources: 修复 Shader/Texture 链接错误
  - threading: TaskSystem::Wait 空实现标注, ReadWriteLock 重入描述, LambdaTask 链接
- 验证: fix_links.py 确认 0 个断裂引用
This commit is contained in:
2026-03-19 00:22:30 +08:00
parent d0e16962c8
commit dc850d7739
1012 changed files with 26673 additions and 9222 deletions

View File

@@ -12,44 +12,44 @@
## 公共方法
### 生命周期
| 方法 | 描述 |
|------|------|
| `virtual void Shutdown()` | 释放缓冲区资源 |
### 数据操作
| 方法 | 描述 |
| 方法 | 文档 |
|------|------|
| `virtual void* Map()` | 映射缓冲区内存到 CPU 可访问 |
| `virtual void Unmap()` | 取消内存映射 |
| `virtual void SetData(const void* data, size_t size, size_t offset = 0)` | 设置缓冲区数据 |
| `Map` | [详细文档](map.md) |
| `Unmap` | [详细文档](unmap.md) |
| `SetData` | [详细文档](set-data.md) |
### 属性访问
| 方法 | 描述 |
| 方法 | 文档 |
|------|------|
| `virtual uint64_t GetSize() const` | 获取缓冲区大小(字节) |
| `virtual BufferType GetBufferType() const` | 获取缓冲区类型 |
| `virtual void SetBufferType(BufferType type)` | 设置缓冲区类型 |
| `virtual uint32_t GetStride() const` | 获取单个元素的字节大小 |
| `virtual void SetStride(uint32_t stride)` | 设置元素字节大小 |
| `GetSize` | [详细文档](get-size.md) |
| `GetBufferType` | [详细文档](get-buffer-type.md) |
| `SetBufferType` | [详细文档](set-buffer-type.md) |
| `GetStride` | [详细文档](get-stride.md) |
| `SetStride` | [详细文档](set-stride.md) |
### 状态管理
| 方法 | 描述 |
| 方法 | 文档 |
|------|------|
| `virtual ResourceStates GetState() const` | 获取当前资源状态 |
| `virtual void SetState(ResourceStates state)` | 设置资源状态 |
| `GetState` | [详细文档](get-state.md) |
| `SetState` | [详细文档](set-state.md) |
### 生命周期
| 方法 | 文档 |
|------|------|
| `Shutdown` | [详细文档](../../threading/task-system/shutdown.md) |
### 其他
| 方法 | 描述 |
| 方法 | 文档 |
|------|------|
| `virtual void* GetNativeHandle()` | 获取原生 API 句柄 |
| `virtual const std::string& GetName() const` | 获取缓冲区名称 |
| `virtual void SetName(const std::string& name)` | 设置缓冲区名称(用于调试) |
| `GetNativeHandle` | [详细文档](get-native-handle.md) |
| `GetName` | [详细文档](get-name.md) |
| `SetName` | [详细文档](set-name.md) |
## 缓冲区类型 (BufferType)
@@ -81,7 +81,6 @@
## 使用示例
```cpp
// 创建设备后创建顶点缓冲
BufferDesc desc;
desc.size = sizeof(Vertex) * vertexCount;
desc.stride = sizeof(Vertex);
@@ -90,20 +89,17 @@ 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();
```
## 相关文档
- [RHIDevice](./rhi-device.md) - 创建设备
- [RHITexture](./rhi-texture.md) - 纹理资源
- [RHICommandList](./rhi-command-list.md) - 命令列表
- [../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

@@ -6,10 +6,6 @@
**描述**: GPU 设备能力结构体,描述了当前图形设备支持的各种功能和限制。
## 概述
`RHICapabilities` 存储了设备的能力信息,包括对各种图形特性的支持情况和资源尺寸限制。
## 公共成员
### 特性支持
@@ -44,18 +40,6 @@
| `maxAnisotropy` | `uint32_t` | 最大各向异性级别 |
| `maxColorAttachments` | `uint32_t` | 最大颜色附件数量 |
### 线/点渲染
| 成员 | 类型 | 描述 |
|------|------|------|
| `minSmoothedLineWidth` | `float` | 最小平滑线宽 |
| `maxSmoothedLineWidth` | `float` | 最大平滑线宽 |
| `minPointSize` | `float` | 最小点大小 |
| `maxPointSize` | `float` | 最大点大小 |
| `maxPointSizeAA` | `float` | 抗锯齿最大点大小 |
| `maxLineWidth` | `float` | 最大线宽 |
| `maxLineWidthAA` | `float` | 抗锯齿最大线宽 |
### 版本信息
| 成员 | 类型 | 描述 |
@@ -67,22 +51,20 @@
## 使用示例
```cpp
// 获取设备能力
const RHICapabilities& caps = device->GetCapabilities();
// 检查功能支持
if (caps.bSupportsRayTracing) {
// 启用光线追踪功能
}
if (caps.bSupportsComputeShaders) {
// 启用计算着色器功能
// 启用计算着色器
}
// 使用资源限制
uint32_t textureSize = std::min(requestedSize, caps.maxTexture2DSize);
```
## 相关文档
- [RHIDevice](./rhi-device.md) - 设备对象
- [../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,102 @@
# RHICommandList
**命名空间**: `XCEngine::RHI`
**类型**: `class` (abstract)
**描述**: GPU 命令列表抽象接口,用于录制和执行 GPU 命令。
## 公共方法
### 命令录制控制
| 方法 | 文档 |
|------|------|
| `Reset` | [详细文档](../../resources/resourcehandle/reset.md) |
| `Close` | [详细文档](../../core/filewriter/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` | [详细文档](../../memory/linear-allocator/clear.md) |
| `ClearRenderTarget` | [详细文档](clear-render-target.md) |
| `ClearDepthStencil` | [详细文档](clear-depth-stencil.md) |
### 资源复制
| 方法 | 文档 |
|------|------|
| `CopyResource` | [详细文档](copy-resource.md) |
### 计算着色器
| 方法 | 文档 |
|------|------|
| `Dispatch` | [详细文档](dispatch.md) |
### 生命周期
| 方法 | 文档 |
|------|------|
| `Shutdown` | [详细文档](../../threading/task-system/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,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,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,67 @@
# RHICommandQueue
**命名空间**: `XCEngine::RHI`
**类型**: `class` (abstract)
**描述**: GPU 命令队列抽象接口,负责提交和执行命令列表,以及 GPU/CPU 同步。
## 公共方法
### 生命周期
| 方法 | 文档 |
|------|------|
| `Shutdown` | [详细文档](../../threading/task-system/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` | [详细文档](../shader/get-type.md) |
| `GetTimestampFrequency` | [详细文档](get-timestamp-frequency.md) |
### 其他
| 方法 | 文档 |
|------|------|
| `GetNativeHandle` | [详细文档](../buffer/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,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,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,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,36 @@
# D3D12 后端组件
D3D12 后端已创建以下组件文件夹和文档:
- `device/` - D3D12Device
- `buffer/` - D3D12Buffer
- `texture/` - D3D12Texture
- `command-list/` - D3D12CommandList
- `command-queue/` - D3D12CommandQueue
- `swap-chain/` - D3D12SwapChain
- `fence/` - D3D12Fence
- `shader/` - D3D12Shader
- `pipeline-state/` - D3D12PipelineState
- `sampler/` - D3D12Sampler
- `root-signature/` - D3D12RootSignature
- `descriptor-heap/` - D3D12DescriptorHeap
- `render-target-view/` - D3D12RenderTargetView
- `depth-stencil-view/` - D3D12DepthStencilView
- `shader-resource-view/` - D3D12ShaderResourceView
- `unordered-access-view/` - D3D12UnorderedAccessView
- `constant-buffer-view/` - D3D12ConstantBufferView
- `command-allocator/` - D3D12CommandAllocator
- `query-heap/` - D3D12QueryHeap
- `screenshot/` - D3D12Screenshot
- `types/` - D3D12 类型转换
- `enums/` - D3D12 枚举转换
- `common/` - D3D12 公共工具
每个组件文件夹包含:
- `{component}.md` - 类总览
- `methods.md` - 方法详细文档
## 相关文档
- [D3D12 后端总览](overview.md)
- [RHI 抽象层](overview.md)

View File

@@ -0,0 +1,33 @@
# 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) |
| `GetDesc` | [详细文档](get-desc.md) |
| `GetGPUVirtualAddress` | [详细文档](get-gpu-virtual-address.md) |
| `GetGPUAddress` | [详细文档](get-gpu-address.md) |
| `GetSize` | [详细文档](get-size.md) |
| `GetState` / `SetState` | [详细文档](get-state.md) |
| `GetName` / `SetName` | [详细文档](get-name.md) |
| `GetStride` / `SetStride` | [详细文档](get-stride.md) |
| `GetBufferType` / `SetBufferType` | [详细文档](get-buffer-type.md) |
| `GetNativeHandle` | [详细文档](get-native-handle.md) |
## 相关文档
- [D3D12 后端总览](../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` | [详细文档](../../../resources/resourcehandle/reset.md) |
| `IsReady` | [详细文档](is-ready.md) |
| `GetCommandAllocator` | [详细文档](get-command-allocator.md) |
## 相关文档
- [D3D12 后端总览](../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,143 @@
# D3D12CommandList
**命名空间**: `XCEngine::RHI`
**描述**: DirectX 12 命令列表的 D3D12 实现,继承自 `RHICommandList`
## 方法列表
### 生命周期
| 方法 | 文档 |
|------|------|
| `Initialize` | [详细文档](../../../threading/task-system/initialize.md) |
| `Shutdown` | [详细文档](../../../threading/task-system/shutdown.md) |
| `Reset` | [详细文档](../../../resources/resourcehandle/reset.md) |
| `Close` | [详细文档](../../../core/filewriter/close.md) |
| `GetCommandList` | [详细文档](get-command-list.md) |
### 资源屏障
| 方法 | 文档 |
|------|------|
| `TransitionBarrier` | [详细文档](transition-barrier.md) |
| `TransitionBarrierInternal` | [详细文档](transition-barrier-internal.md) |
| `UAVBarrier` | [详细文档](uav-barrier.md) |
| `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) |
| `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` | [详细文档](../../../memory/linear-allocator/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) |
### Bundle
| 方法 | 文档 |
|------|------|
| `ExecuteBundle` | [详细文档](execute-bundle.md) |
### 状态管理
| 方法 | 文档 |
|------|------|
| `GetResourceState` | [详细文档](get-resource-state.md) |
| `TrackResource` | [详细文档](track-resource.md) |
## 相关文档
- [D3D12 后端总览](../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) - 返回类总览

View File

@@ -0,0 +1,19 @@
# D3D12CommandList::SetGraphicsRoot32BitConstants
```cpp
void SetGraphicsRoot32BitConstants(uint32_t rootParameterIndex, uint32_t num32BitValuesToSet, const void* pSrcData, uint32_t destOffsetIn32BitValues);
```
设置图形根 32 位常量。
**参数:**
- `rootParameterIndex` - 根参数索引
- `num32BitValuesToSet` - 要设置的 32 位值数量
- `pSrcData` - 源数据指针
- `destOffsetIn32BitValues` - 目标偏移量
**复杂度:** O(n)
## 相关文档
- [D3D12CommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,17 @@
# D3D12CommandList::SetGraphicsRootConstantBufferView
```cpp
void SetGraphicsRootConstantBufferView(uint32_t rootParameterIndex, D3D12_GPU_VIRTUAL_ADDRESS bufferLocation);
```
设置图形根常量缓冲区视图。
**参数:**
- `rootParameterIndex` - 根参数索引
- `bufferLocation` - GPU 虚拟地址
**复杂度:** O(1)
## 相关文档
- [D3D12CommandList 总览](command-list.md) - 返回类总览

View File

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

View File

@@ -0,0 +1,17 @@
# D3D12CommandList::SetGraphicsRootShaderResourceView
```cpp
void SetGraphicsRootShaderResourceView(uint32_t rootParameterIndex, D3D12_GPU_VIRTUAL_ADDRESS shaderResource);
```
设置图形根着色器资源视图。
**参数:**
- `rootParameterIndex` - 根参数索引
- `shaderResource` - GPU 虚拟地址
**复杂度:** O(1)
## 相关文档
- [D3D12CommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,18 @@
# D3D12CommandList::SetIndexBuffer
```cpp
void SetIndexBuffer(void* buffer, uint64_t offset, Format format) override;
```
设置索引缓冲区。
**参数:**
- `buffer` - 缓冲区指针
- `offset` - 缓冲区偏移
- `format` - 索引格式
**复杂度:** O(1)
## 相关文档
- [D3D12CommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,16 @@
# D3D12CommandList::SetPipelineState
```cpp
void SetPipelineState(void* pso) override;
```
设置图形管线状态对象。
**参数:**
- `pso` - 管线状态对象指针
**复杂度:** O(1)
## 相关文档
- [D3D12CommandList 总览](command-list.md) - 返回类总览

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