Update API documentation and remove obsolete plan files

This commit is contained in:
2026-03-21 15:55:04 +08:00
parent 7a6cd412c8
commit 629455df07
75 changed files with 1075 additions and 1816 deletions

View File

@@ -0,0 +1,28 @@
# D3D12CommandList::ClearUnorderedAccessView
```cpp
void ClearUnorderedAccessView(
D3D12_GPU_DESCRIPTOR_HANDLE viewHandle,
D3D12_CPU_DESCRIPTOR_HANDLE resourceHandle,
ID3D12Resource* unorderedAccess,
const float values[4],
uint32_t rectCount = 0,
const D3D12_RECT* rects = nullptr
);
```
清除无序访问视图。
**参数:**
- `viewHandle` - GPU 描述符句柄
- `resourceHandle` - CPU 描述符句柄
- `unorderedAccess` - UAV 资源指针
- `values` - 清除值 [x, y, z, w]
- `rectCount` - 清除矩形数量
- `rects` - 清除矩形数组
**复杂度:** O(n) 其中 n 为 rectCount
## 相关文档
- [D3D12CommandList 总览](command-list.md) - 返回类总览

View File

@@ -21,8 +21,8 @@
| 方法 | 描述 |
|------|------|
| [`D3D12CommandList`](../../../threading/lambdatask/constructor.md) | 构造函数 |
| [`~D3D12CommandList`](../../../threading/readwritelock/destructor.md) | 析构函数 |
| [`D3D12CommandList`](constructor.md) | 构造函数 |
| [`~D3D12CommandList`](destructor.md) | 析构函数 |
| [`Initialize`](initialize.md) | 初始化命令列表 |
| [`Shutdown`](shutdown.md) | 关闭命令列表 |
| [`Reset`](reset.md) | 重置命令列表 |
@@ -51,6 +51,8 @@
| [`SetGraphicsRootDescriptorTable`](set-graphics-root-descriptor-table.md) | 设置图形根描述符表 |
| [`SetGraphicsRootShaderResourceView`](set-graphics-root-shader-resource-view.md) | 设置图形根着色器资源视图 |
| [`SetStencilRef`](set-stencil-ref.md) | 设置模板引用值 |
| [`SetDepthStencilState`](set-depth-stencil-state.md) | 设置深度模板状态 |
| [`SetBlendState`](set-blend-state.md) | 设置混合状态 |
| [`SetBlendFactor`](set-blend-factor.md) | 设置混合因子 |
| [`SetDepthBias`](set-depth-bias.md) | 设置深度偏移 |
| [`Draw`](draw.md) | 绘制 |
@@ -60,6 +62,7 @@
| [`Clear`](clear.md) | 清除 |
| [`ClearRenderTarget`](clear-render-target.md) | 清除渲染目标 |
| [`ClearDepthStencil`](clear-depth-stencil.md) | 清除深度模板 |
| [`ClearUnorderedAccessView`](clear-unordered-access-view.md) | 清除无序访问视图 |
| [`CopyResource`](copy-resource.md) | 复制资源 |
| [`CopyBuffer`](copy-buffer.md) | 复制缓冲区 |
| [`CopyTexture`](copy-texture.md) | 复制纹理 |

View File

@@ -0,0 +1,16 @@
# D3D12CommandList::SetBlendState
```cpp
void SetBlendState(const BlendState& state) override;
```
设置混合状态。
**参数:**
- `state` - 混合状态结构体
**复杂度:** O(1)
## 相关文档
- [D3D12CommandList 总览](command-list.md) - 返回类总览

View File

@@ -0,0 +1,16 @@
# D3D12CommandList::SetDepthStencilState
```cpp
void SetDepthStencilState(const DepthStencilState& state) override;
```
设置深度模板状态。
**参数:**
- `state` - 深度模板状态结构体
**复杂度:** O(1)
## 相关文档
- [D3D12CommandList 总览](command-list.md) - 返回类总览

View File

@@ -74,4 +74,4 @@
## 相关文档
- [../rhi/rhi.md](../rhi.md) - RHI 模块总览
- [OpenGL 后端](../opengl/overview.md)
- [OpenGL 后端](../opengl/opengl.md)

View File

@@ -0,0 +1,27 @@
# D3D12DepthStencilView::D3D12DepthStencilView
## 函数签名
```cpp
D3D12DepthStencilView()
```
## 描述
默认构造函数。创建空的深度模板视图实例,成员变量初始化为零值和空指针。
## 返回值
## 示例
```cpp
D3D12DepthStencilView dsv; // 创建空实例
```
## 相关文档
- [D3D12DepthStencilView](depth-stencil-view.md) - 类总览
- [D3D12DepthStencilView::Initialize](initialize.md) - 初始化方法
- [D3D12DepthStencilView::~D3D12DepthStencilView](destructor.md) - 析构函数

View File

@@ -4,6 +4,8 @@
**类型**: `class`
**头文件**: `XCEngine/RHI/D3D12/D3D12DepthStencilView.h`
**描述**: DirectX 12 深度模板视图的 D3D12 实现,用于渲染管线中的深度/模板测试。
## 概述
@@ -14,8 +16,8 @@
| 方法 | 描述 |
|------|------|
| [`D3D12DepthStencilView()`](initialize.md) | 构造函数 |
| [`~D3D12DepthStencilView()`](initialize.md) | 析构函数 |
| [`D3D12DepthStencilView()`](constructor.md) | 构造函数 |
| [`~D3D12DepthStencilView()`](destructor.md) | 析构函数 |
| [`Initialize`](initialize.md) | 初始化深度模板视图 |
| [`InitializeAt`](initialize-at.md) | 在指定位置初始化深度模板视图 |
| [`Shutdown`](shutdown.md) | 关闭深度模板视图 |

View File

@@ -0,0 +1,34 @@
# D3D12DepthStencilView::~D3D12DepthStencilView
## 函数签名
```cpp
~D3D12DepthStencilView()
```
## 描述
析构函数。自动调用 `Shutdown()` 释放内部资源。
## 返回值
## 注意事项
此析构函数不直接释放 D3D12 资源,仅清理类内部状态。实际资源释放由描述符堆管理。
## 示例
```cpp
{
D3D12DepthStencilView dsv;
dsv.Initialize(device, depthBuffer, nullptr);
// 使用 dsv...
} // dsv 析构时自动调用 Shutdown()
```
## 相关文档
- [D3D12DepthStencilView](depth-stencil-view.md) - 类总览
- [D3D12DepthStencilView::Shutdown](shutdown.md) - 关闭方法

View File

@@ -59,4 +59,4 @@ heap.Shutdown();
- [D3D12 后端总览](../d3d12.md)
- [RHIDescriptorPool](../../descriptor-pool/descriptor-pool.md) - 抽象描述符池接口
- [D3D12Enum](d3d12-enum.md) - D3D12 类型枚举映射
- [D3D12Enum](../enums/enums.md) - D3D12 类型枚举映射

View File

@@ -2,6 +2,10 @@
**命名空间**: `XCEngine::RHI`
**类型**: `class`
**头文件**: `XCEngine/RHI/D3D12/D3D12RenderTargetView.h`
**描述**: DirectX 12 渲染目标视图的 D3D12 实现,用于在渲染管线中作为渲染目标使用。
## 公共方法

View File

@@ -0,0 +1,27 @@
# D3D12RootSignature::D3D12RootSignature
## 函数签名
```cpp
D3D12RootSignature()
```
## 描述
默认构造函数。创建空的根签名实例,成员变量初始化为零值和空指针。
## 返回值
## 示例
```cpp
D3D12RootSignature rootSig; // 创建空实例
```
## 相关文档
- [D3D12RootSignature](root-signature.md) - 类总览
- [D3D12RootSignature::Initialize](initialize.md) - 初始化方法
- [D3D12RootSignature::~D3D12RootSignature](destructor.md) - 析构函数

View File

@@ -0,0 +1,34 @@
# D3D12RootSignature::~D3D12RootSignature
## 函数签名
```cpp
~D3D12RootSignature()
```
## 描述
析构函数。自动调用 `Shutdown()` 释放内部资源。
## 返回值
## 注意事项
此析构函数自动调用 Shutdown() 确保资源被正确释放。
## 示例
```cpp
{
D3D12RootSignature rootSig;
rootSig.Initialize(device, desc);
// 使用 rootSig...
} // rootSig 析构时自动调用 Shutdown()
```
## 相关文档
- [D3D12RootSignature](root-signature.md) - 类总览
- [D3D12RootSignature::Shutdown](shutdown.md) - 关闭方法

View File

@@ -4,12 +4,16 @@
**类型**: `class` (D3D12-specific, does not inherit from RHI)
**头文件**: `XCEngine/RHI/D3D12/D3D12RootSignature.h`
**描述**: DirectX 12 根签名的 D3D12 实现,提供根签名序列化、参数创建等功能。
## 公共方法
| 方法 | 描述 |
|------|------|
| [`D3D12RootSignature`](constructor.md) | 构造函数 |
| [`~D3D12RootSignature`](destructor.md) | 析构函数 |
| [`Initialize`](initialize.md) | 初始化根签名 |
| [`Shutdown`](shutdown.md) | 关闭根签名 |
| [`GetRootSignature`](get-root-signature.md) | 获取 D3D12 根签名 |
@@ -44,4 +48,4 @@ if (rootSig.Initialize(device, desc)) {
## 相关文档
- [D3D12 后端总览](../../opengl/overview.md)
- [D3D12 后端总览](../d3d12.md)

View File

@@ -13,4 +13,4 @@
## 相关文档
- [D3D12 后端总览](../../opengl/overview.md)
- [D3D12 后端总览](../d3d12.md)

View File

@@ -45,4 +45,4 @@ delete srv;
## 相关文档
- [D3D12 后端概览](../d3d12.md)
- [OpenGL 后端](../../opengl/overview.md)
- [OpenGL 后端](../../opengl/opengl.md)

View File

@@ -35,6 +35,8 @@
| [`CreateRenderWindow`](create-render-window.md) | 创建渲染窗口 |
| [`InitializeWithExistingWindow`](initialize-with-existing-window.md) | 使用现有窗口初始化 |
| [`GetWindow`](get-window.md) | 获取 GLFW 窗口指针 |
| [`GetDC`](get-dc.md) | 获取 Windows 设备上下文 |
| [`GetContext`](get-context.md) | 获取 OpenGL 渲染上下文 |
| [`GetDeviceInfoImpl`](get-device-info-impl.md) | 获取设备信息实现 |
| [`SwapBuffers`](swap-buffers.md) | 交换前后缓冲区 |
| [`PollEvents`](poll-events.md) | 处理窗口事件 |

View File

@@ -0,0 +1,31 @@
# OpenGLDevice::GetContext
获取 OpenGL 渲染上下文Rendering Context
```cpp
HGLRC GetContext() const;
```
返回 OpenGL 渲染上下文的句柄。
**参数:**
**返回:** `HGLRC` - OpenGL 渲染上下文句柄
**线程安全:**
**注意:** 此方法返回原生 OpenGL 渲染上下文句柄,可用于 `wglShareLists``wglMakeCurrent` 等原生 OpenGL 上下文操作。大多数情况下不需要直接使用此方法。
**示例:**
```cpp
HGLRC hglrc = device.GetContext();
// 可以使用 hglrc 进行原生 OpenGL 上下文操作
HGLRC currentContext = wglGetCurrentContext();
```
## 相关文档
- [OpenGLDevice 总览](device.md) - 返回类总览
- [GetDC](get-dc.md) - 获取 Windows 设备上下文
- [GetWindow](get-window.md) - 获取 GLFW 窗口指针

View File

@@ -0,0 +1,31 @@
# OpenGLDevice::GetDC
获取 OpenGL 设备的设备上下文Device Context
```cpp
HDC GetDC() const;
```
返回与 OpenGL 渲染上下文关联的 Windows 设备上下文句柄。
**参数:**
**返回:** `HDC` - Windows 设备上下文句柄
**线程安全:**
**注意:** 此方法返回原生 Windows HDC可用于低级 GDI 操作或与原生 Windows OpenGL 上下文交互。大多数情况下不需要直接使用此方法。
**示例:**
```cpp
HDC hdc = device.GetDC();
// 可以使用 hdc 进行原生 Windows OpenGL 操作
HDC currentDC = wglGetCurrentDC();
```
## 相关文档
- [OpenGLDevice 总览](device.md) - 返回类总览
- [GetContext](get-context.md) - 获取 OpenGL 渲染上下文
- [GetWindow](get-window.md) - 获取 GLFW 窗口指针

View File

@@ -0,0 +1,34 @@
# OpenGLShader::SetMat2
设置 2x2 矩阵 uniform 变量。
```cpp
void SetMat2(const char* name, const float* value);
```
通过名称查找并设置着色器中的 2x2 变换矩阵 uniform 变量。矩阵按列主序存储。
**参数:**
- `name` - uniform 变量名称
- `value` - 指向 4 个 float 元素的数组指针(列主序排列)
**返回:**
**线程安全:** ❌(需要在渲染线程调用)
**示例:**
```cpp
// 设置 2x2 旋转矩阵
float rotation[4] = {
cos(angle), sin(angle), // 第一列
-sin(angle), cos(angle) // 第二列
};
shader->SetMat2("u_rotation", rotation);
```
## 相关文档
- [OpenGLShader 总览](shader.md) - 返回类总览
- [SetMat3](set-mat3.md) - 设置 3x3 矩阵
- [SetMat4](../../shader/set-mat4.md) - 设置 4x4 矩阵

View File

@@ -0,0 +1,35 @@
# OpenGLShader::SetMat3
设置 3x3 矩阵 uniform 变量。
```cpp
void SetMat3(const char* name, const float* value);
```
通过名称查找并设置着色器中的 3x3 变换矩阵 uniform 变量。矩阵按列主序存储。常见用途包括设置法线矩阵、模型矩阵的 3x3 部分等。
**参数:**
- `name` - uniform 变量名称
- `value` - 指向 9 个 float 元素的数组指针(列主序排列)
**返回:**
**线程安全:** ❌(需要在渲染线程调用)
**示例:**
```cpp
// 设置 3x3 法线矩阵
float normalMatrix[9] = {
1.0f, 0.0f, 0.0f, // 第一列
0.0f, 1.0f, 0.0f, // 第二列
0.0f, 0.0f, 1.0f // 第三列
};
shader->SetMat3("u_normalMatrix", normalMatrix);
```
## 相关文档
- [OpenGLShader 总览](shader.md) - 返回类总览
- [SetMat2](set-mat2.md) - 设置 2x2 矩阵
- [SetMat4](../../shader/set-mat4.md) - 设置 4x4 矩阵

View File

@@ -0,0 +1,44 @@
# OpenGLShader::SetMat4Array
设置 4x4 矩阵数组 uniform 变量。
```cpp
void SetMat4Array(const char* name, const float* values, unsigned int count);
```
通过名称查找并设置着色器中的 4x4 矩阵数组 uniform 变量。矩阵按列主序存储。
**参数:**
- `name` - uniform 变量名称
- `values` - 指向 `count * 16` 个 float 元素的数组指针(列主序排列)
- `count` - 矩阵数量
**返回:**
**线程安全:** ❌(需要在渲染线程调用)
**示例:**
```cpp
// 设置多个变换矩阵(例如骨骼动画)
const unsigned int boneCount = 4;
float boneMatrices[4 * 16] = {
// 第一个矩阵
1.0f, 0.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f,
// 第二个矩阵
0.5f, 0.0f, 0.0f, 0.0f,
0.0f, 0.5f, 0.0f, 0.0f,
0.0f, 0.0f, 0.5f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f,
// ...更多矩阵
};
shader->SetMat4Array("u_boneMatrices", boneMatrices, boneCount);
```
## 相关文档
- [OpenGLShader 总览](shader.md) - 返回类总览
- [SetMat4 (single)](../../shader/set-mat4.md) - 设置单个 4x4 矩阵

View File

@@ -0,0 +1,35 @@
# OpenGLShader::SetVec3
设置三维向量 uniform 变量(数组重载版本)。
```cpp
void SetVec3(const char* name, const float* values);
```
通过名称查找并设置着色器中的三维向量 uniform 变量,使用浮点数数组作为输入。
**参数:**
- `name` - uniform 变量名称
- `values` - 指向 3 个 float 元素的数组指针
**返回:**
**线程安全:** ❌(需要在渲染线程调用)
**示例:**
```cpp
// 设置光照方向
float lightDir[3] = { 0.5f, 1.0f, 0.3f };
shader->SetVec3("u_lightDir", lightDir);
// 设置法线
float normal[3] = { 0.0f, 1.0f, 0.0f };
shader->SetVec3("u_normal", normal);
```
## 相关文档
- [OpenGLShader 总览](shader.md) - 返回类总览
- [SetVec3 (xyz)](../../shader/set-vec3.md) - xyz分量版本
- [SetVec4 (float*)](set-vec4-array.md) - 四维向量数组版本

View File

@@ -0,0 +1,35 @@
# OpenGLShader::SetVec4
设置四维向量 uniform 变量(数组重载版本)。
```cpp
void SetVec4(const char* name, const float* values);
```
通过名称查找并设置着色器中的四维向量 uniform 变量,使用浮点数数组作为输入。
**参数:**
- `name` - uniform 变量名称
- `values` - 指向 4 个 float 元素的数组指针
**返回:**
**线程安全:** ❌(需要在渲染线程调用)
**示例:**
```cpp
// 设置颜色
float color[4] = { 1.0f, 0.5f, 0.2f, 1.0f };
shader->SetVec4("u_color", color);
// 设置齐次坐标
float position[4] = { 10.0f, 20.0f, 30.0f, 1.0f };
shader->SetVec4("u_position", position);
```
## 相关文档
- [OpenGLShader 总览](shader.md) - 返回类总览
- [SetVec4 (xyzw)](../../shader/set-vec4.md) - xyzw分量版本
- [SetVec3 (float*)](set-vec3-array.md) - 三维向量数组版本

View File

@@ -6,6 +6,8 @@
## 公共方法
### 编译方法
| 方法 | 描述 |
|------|------|
| [`CompileFromFile`](compile-from-file-vs-fs.md) | 从文件编译顶点+片段着色器 |
@@ -13,16 +15,36 @@
| [`Compile`](compile-type.md) | 从源码编译单着色器 |
| [`CompileCompute`](compile-compute.md) | 编译计算着色器 |
| [`Shutdown`](../../shader/shutdown.md) | 关闭着色器 |
### 绑定方法
| 方法 | 描述 |
|------|------|
| [`Use`](use.md) | 使用着色器 |
| [`Bind`](../../shader/bind.md) | 绑定着色器 |
| [`Unbind`](../../shader/unbind.md) | 解绑着色器 |
### Uniform 设置方法
| 方法 | 描述 |
|------|------|
| [`SetInt`](../../shader/set-int.md) | 设置整数 uniform |
| [`SetIntArray`](set-int-array.md) | 设置整数数组 uniform |
| [`SetFloat`](../../shader/set-float.md) | 设置浮点数 uniform |
| [`SetFloatArray`](set-float-array.md) | 设置浮点数数组 uniform |
| [`SetVec3`](../../shader/set-vec3.md) | 设置 vec3 uniform |
| [`SetVec4`](../../shader/set-vec4.md) | 设置 vec4 uniform |
| [`SetVec3`](../../shader/set-vec3.md) | 设置 vec3 uniform (xyz分量) |
| [`SetVec3`](set-vec3-array.md) | 设置 vec3 uniform (数组) |
| [`SetVec4`](../../shader/set-vec4.md) | 设置 vec4 uniform (xyzw分量) |
| [`SetVec4`](set-vec4-array.md) | 设置 vec4 uniform (数组) |
| [`SetMat2`](set-mat2.md) | 设置 mat2 uniform |
| [`SetMat3`](set-mat3.md) | 设置 mat3 uniform |
| [`SetMat4`](../../shader/set-mat4.md) | 设置 mat4 uniform |
| [`SetMat4Array`](set-mat4-array.md) | 设置 mat4 数组 uniform |
### 查询方法
| 方法 | 描述 |
|------|------|
| [`GetUniformLocation`](get-uniform-location.md) | 获取 uniform 位置 |
| [`GetID`](get-id.md) | 获取着色器 ID |
| [`GetNativeHandle`](../../buffer/get-native-handle.md) | 获取原生句柄 |

View File

@@ -116,7 +116,7 @@ delete device;
## 后端文档
- [D3D12 后端](d3d12/d3d12.md) - DirectX 12 实现详情
- [OpenGL 后端](opengl/overview.md) - OpenGL 实现详情
- [OpenGL 后端](opengl/opengl.md) - OpenGL 实现详情
### D3D12 实现