docs: update RHI API docs
This commit is contained in:
@@ -2,18 +2,49 @@
|
||||
|
||||
**命名空间**: `XCEngine::RHI`
|
||||
|
||||
**描述**: DirectX 12 命令分配器的 D3D12 实现。
|
||||
**类型**: `class` (standalone, does not inherit from base)
|
||||
|
||||
**描述**: DirectX 12 命令分配器的 D3D12 实现,用于管理 GPU 命令分配内存。
|
||||
|
||||
## 构造函数
|
||||
|
||||
| 方法 | 描述 |
|
||||
|------|------|
|
||||
| [`D3D12CommandAllocator`](constructor.md) | 默认构造函数 |
|
||||
|
||||
## 公共方法
|
||||
|
||||
| 方法 | 描述 |
|
||||
|------|------|
|
||||
| [`Initialize`](../../../threading/task-system/initialize.md) | 初始化命令分配器 |
|
||||
| [`Shutdown`](../../../threading/task-system/shutdown.md) | 关闭命令分配器 |
|
||||
| [`Reset`](../../command-list/reset.md) | 重置命令分配器 |
|
||||
| [`Initialize`](initialize.md) | 初始化命令分配器 |
|
||||
| [`Shutdown`](shutdown.md) | 关闭命令分配器 |
|
||||
| [`Reset`](reset.md) | 重置命令分配器 |
|
||||
| [`IsReady`](is-ready.md) | 检查是否就绪 |
|
||||
| [`GetCommandAllocator`](get-command-allocator.md) | 获取 D3D12 命令分配器 |
|
||||
|
||||
## 析构函数
|
||||
|
||||
| 方法 | 描述 |
|
||||
|------|------|
|
||||
| [`~D3D12CommandAllocator`](destructor.md) | 析构函数,自动调用 Shutdown |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/RHI/D3D12/D3D12CommandAllocator.h>
|
||||
|
||||
using namespace XCEngine::RHI;
|
||||
|
||||
D3D12CommandAllocator allocator;
|
||||
if (allocator.Initialize(device, CommandQueueType::Direct)) {
|
||||
allocator.Reset();
|
||||
if (allocator.IsReady()) {
|
||||
ID3D12CommandAllocator* native = allocator.GetCommandAllocator();
|
||||
}
|
||||
allocator.Shutdown();
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [D3D12 后端总览](../../opengl/overview.md)
|
||||
- [D3D12 后端总览](../../d3d12/d3d12.md)
|
||||
|
||||
20
docs/api/rhi/d3d12/command-allocator/constructor.md
Normal file
20
docs/api/rhi/d3d12/command-allocator/constructor.md
Normal file
@@ -0,0 +1,20 @@
|
||||
# D3D12CommandAllocator::D3D12CommandAllocator
|
||||
|
||||
```cpp
|
||||
D3D12CommandAllocator();
|
||||
```
|
||||
|
||||
默认构造函数,创建一个未初始化的命令分配器实例。创建后需要调用 [`Initialize`](initialize.md) 进行初始化。
|
||||
|
||||
## 示例
|
||||
|
||||
```cpp
|
||||
D3D12CommandAllocator allocator;
|
||||
// 此时 allocator 未初始化,需要调用 Initialize
|
||||
allocator.Initialize(device);
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [D3D12CommandAllocator 总览](command-allocator.md) - 返回类总览
|
||||
- [D3D12CommandAllocator::Initialize](initialize.md) - 初始化分配器
|
||||
22
docs/api/rhi/d3d12/command-allocator/destructor.md
Normal file
22
docs/api/rhi/d3d12/command-allocator/destructor.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# D3D12CommandAllocator::~D3D12CommandAllocator
|
||||
|
||||
```cpp
|
||||
~D3D12CommandAllocator();
|
||||
```
|
||||
|
||||
析构函数,自动调用 [`Shutdown`](shutdown.md) 释放底层 D3D12 资源。
|
||||
|
||||
## 示例
|
||||
|
||||
```cpp
|
||||
{
|
||||
D3D12CommandAllocator allocator;
|
||||
allocator.Initialize(device);
|
||||
// 使用分配器
|
||||
} // 离开作用域时析构函数自动调用 Shutdown
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [D3D12CommandAllocator 总览](command-allocator.md) - 返回类总览
|
||||
- [D3D12CommandAllocator::Shutdown](shutdown.md) - 关闭分配器
|
||||
@@ -6,6 +6,16 @@ ID3D12CommandAllocator* GetCommandAllocator() const { return m_commandAllocator.
|
||||
|
||||
获取底层的 D3D12 命令分配器接口。
|
||||
|
||||
## 示例
|
||||
|
||||
```cpp
|
||||
D3D12CommandAllocator allocator;
|
||||
if (allocator.Initialize(device)) {
|
||||
ID3D12CommandAllocator* native = allocator.GetCommandAllocator();
|
||||
// 使用原生 D3D12 接口
|
||||
}
|
||||
```
|
||||
|
||||
**返回:** `ID3D12CommandAllocator*`
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
37
docs/api/rhi/d3d12/command-allocator/initialize.md
Normal file
37
docs/api/rhi/d3d12/command-allocator/initialize.md
Normal file
@@ -0,0 +1,37 @@
|
||||
# D3D12CommandAllocator::Initialize
|
||||
|
||||
```cpp
|
||||
bool Initialize(ID3D12Device* device, CommandQueueType type = CommandQueueType::Direct);
|
||||
```
|
||||
|
||||
初始化 D3D12 命令分配器,创建指定类型的命令分配器。
|
||||
|
||||
## 参数
|
||||
|
||||
| 参数 | 类型 | 描述 |
|
||||
|------|------|------|
|
||||
| `device` | `ID3D12Device*` | D3D12 设备指针 |
|
||||
| `type` | `CommandQueueType` | 命令队列类型,默认值为 `Direct` |
|
||||
|
||||
## 返回值
|
||||
|
||||
`bool` - 初始化是否成功
|
||||
|
||||
## 示例
|
||||
|
||||
```cpp
|
||||
D3D12CommandAllocator allocator;
|
||||
if (allocator.Initialize(device, CommandQueueType::Direct)) {
|
||||
// 分配器初始化成功
|
||||
}
|
||||
```
|
||||
|
||||
## 复杂度
|
||||
|
||||
O(1)
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [D3D12CommandAllocator 总览](command-allocator.md) - 返回类总览
|
||||
- [D3D12CommandAllocator::Reset](reset.md) - 重置分配器
|
||||
- [D3D12CommandAllocator::Shutdown](shutdown.md) - 关闭分配器
|
||||
@@ -6,6 +6,17 @@ bool IsReady() const;
|
||||
|
||||
检查命令分配器是否准备就绪。
|
||||
|
||||
## 示例
|
||||
|
||||
```cpp
|
||||
D3D12CommandAllocator allocator;
|
||||
if (allocator.Initialize(device)) {
|
||||
if (allocator.IsReady()) {
|
||||
// 分配器就绪可以使用
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**返回:** 分配器是否准备就绪
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
25
docs/api/rhi/d3d12/command-allocator/reset.md
Normal file
25
docs/api/rhi/d3d12/command-allocator/reset.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# D3D12CommandAllocator::Reset
|
||||
|
||||
```cpp
|
||||
void Reset();
|
||||
```
|
||||
|
||||
重置命令分配器,将分配器重置为初始状态,使其可以重新使用。此方法必须在 GPU 完成所有使用该分配器的命令后才能调用。
|
||||
|
||||
## 示例
|
||||
|
||||
```cpp
|
||||
D3D12CommandAllocator allocator;
|
||||
if (allocator.Initialize(device)) {
|
||||
allocator.Reset(); // 重置以重新使用
|
||||
}
|
||||
```
|
||||
|
||||
## 复杂度
|
||||
|
||||
O(1)
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [D3D12CommandAllocator 总览](command-allocator.md) - 返回类总览
|
||||
- [D3D12CommandAllocator::Initialize](initialize.md) - 初始化分配器
|
||||
27
docs/api/rhi/d3d12/command-allocator/shutdown.md
Normal file
27
docs/api/rhi/d3d12/command-allocator/shutdown.md
Normal file
@@ -0,0 +1,27 @@
|
||||
# D3D12CommandAllocator::Shutdown
|
||||
|
||||
```cpp
|
||||
void Shutdown();
|
||||
```
|
||||
|
||||
关闭 D3D12 命令分配器,释放底层 D3D12 资源。此方法通常不需要显式调用,析构函数会自动执行。
|
||||
|
||||
## 示例
|
||||
|
||||
```cpp
|
||||
D3D12CommandAllocator allocator;
|
||||
if (allocator.Initialize(device)) {
|
||||
// 使用分配器
|
||||
allocator.Shutdown(); // 显式关闭
|
||||
}
|
||||
// 或者依靠析构函数自动关闭
|
||||
```
|
||||
|
||||
## 复杂度
|
||||
|
||||
O(1)
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [D3D12CommandAllocator 总览](command-allocator.md) - 返回类总览
|
||||
- [D3D12CommandAllocator::Initialize](initialize.md) - 初始化分配器
|
||||
Reference in New Issue
Block a user