docs: update RHI API docs
This commit is contained in:
@@ -2,16 +2,36 @@
|
||||
|
||||
**命名空间**: `XCEngine::RHI`
|
||||
|
||||
**描述**: DirectX 12 常量缓冲区视图的 D3D12 实现。
|
||||
**类型**: 类
|
||||
|
||||
**描述**: DirectX 12 常量缓冲区视图的 D3D12 实现,提供与 D3D12 API 的直接交互接口。
|
||||
|
||||
**概述**: `D3D12ConstantBufferView` 是对 D3D12 常量缓冲区视图(Constant Buffer View)的封装类。它管理一个 CPU 可见的描述符句柄,用于在渲染命令中绑定常量缓冲区。内部持有对 D3D12 资源的引用,资源生命周期由外部管理。
|
||||
|
||||
## 公共方法
|
||||
|
||||
| 方法 | 描述 |
|
||||
|------|------|
|
||||
| [`Initialize`](../../../threading/task-system/initialize.md) | 初始化常量缓冲区视图 |
|
||||
| [`Shutdown`](../../../threading/task-system/shutdown.md) | 关闭常量缓冲区视图 |
|
||||
| [`D3D12ConstantBufferView`](constructor.md) | 构造函数 |
|
||||
| [`~D3D12ConstantBufferView`](destructor.md) | 析构函数 |
|
||||
| [`Initialize`](initialize.md) | 初始化常量缓冲区视图 |
|
||||
| [`Shutdown`](shutdown.md) | 关闭常量缓冲区视图 |
|
||||
| [`GetCPUDescriptorHandle`](get-cpu-descriptor-handle.md) | 获取 CPU 描述符句柄 |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
ID3D12Device* device;
|
||||
ID3D12Resource* buffer;
|
||||
|
||||
XCEngine::RHI::D3D12ConstantBufferView cbv;
|
||||
cbv.Initialize(device, buffer);
|
||||
|
||||
// 使用 cbv.GetCPUDescriptorHandle() 绑定到命令列表
|
||||
|
||||
cbv.Shutdown();
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [D3D12 后端总览](../../opengl/overview.md)
|
||||
- [D3D12 后端总览](../d3d12.md)
|
||||
|
||||
16
docs/api/rhi/d3d12/constant-buffer-view/constructor.md
Normal file
16
docs/api/rhi/d3d12/constant-buffer-view/constructor.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# D3D12ConstantBufferView::D3D12ConstantBufferView
|
||||
|
||||
```cpp
|
||||
D3D12ConstantBufferView();
|
||||
```
|
||||
|
||||
构造一个空的 D3D12ConstantBufferView 实例。
|
||||
|
||||
## 复杂度
|
||||
|
||||
O(1)
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [D3D12ConstantBufferView 总览](constant-buffer-view.md)
|
||||
- [~D3D12ConstantBufferView](destructor.md)
|
||||
16
docs/api/rhi/d3d12/constant-buffer-view/destructor.md
Normal file
16
docs/api/rhi/d3d12/constant-buffer-view/destructor.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# D3D12ConstantBufferView::~D3D12ConstantBufferView
|
||||
|
||||
```cpp
|
||||
~D3D12ConstantBufferView();
|
||||
```
|
||||
|
||||
析构函数,自动调用 Shutdown 清理资源。
|
||||
|
||||
## 复杂度
|
||||
|
||||
O(1)
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [D3D12ConstantBufferView 总览](constant-buffer-view.md)
|
||||
- [D3D12ConstantBufferView](constructor.md)
|
||||
@@ -1,15 +1,21 @@
|
||||
# D3D12ConstantBufferView::GetCPUDescriptorHandle
|
||||
|
||||
```cpp
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE GetCPUDescriptorHandle() const { return m_handle; }
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE GetCPUDescriptorHandle() const;
|
||||
```
|
||||
|
||||
获取 CPU 描述符句柄。
|
||||
获取 CPU 描述符句柄,用于绑定到命令列表。
|
||||
|
||||
**返回:** CPU 描述符句柄
|
||||
## 返回值
|
||||
|
||||
**复杂度:** O(1)
|
||||
| 类型 | 描述 |
|
||||
|------|------|
|
||||
| `D3D12_CPU_DESCRIPTOR_HANDLE` | CPU 侧描述符句柄,可用于设置命令列表 |
|
||||
|
||||
## 复杂度
|
||||
|
||||
O(1)
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [D3D12ConstantBufferView 总览](constant-buffer-view.md) - 返回类总览
|
||||
- [D3D12ConstantBufferView 总览](constant-buffer-view.md)
|
||||
|
||||
26
docs/api/rhi/d3d12/constant-buffer-view/initialize.md
Normal file
26
docs/api/rhi/d3d12/constant-buffer-view/initialize.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# D3D12ConstantBufferView::Initialize
|
||||
|
||||
```cpp
|
||||
void Initialize(ID3D12Device* device, ID3D12Resource* buffer, const D3D12_CONSTANT_BUFFER_VIEW_DESC* desc = nullptr);
|
||||
```
|
||||
|
||||
初始化常量缓冲区视图。
|
||||
|
||||
当 `desc` 参数为 `nullptr` 时,方法会自动根据 `buffer` 的属性创建视图描述:设置 `BufferLocation` 为缓冲区的 GPU 虚拟地址,`SizeInBytes` 为缓冲区的宽度。
|
||||
|
||||
## 参数
|
||||
|
||||
| 参数 | 类型 | 描述 |
|
||||
|------|------|------|
|
||||
| `device` | `ID3D12Device*` | D3D12 设备指针 |
|
||||
| `buffer` | `ID3D12Resource*` | D3D12 资源指针,必须是常量缓冲区 |
|
||||
| `desc` | `const D3D12_CONSTANT_BUFFER_VIEW_DESC*` | 可选的视图描述,如果为 `nullptr` 则自动创建 |
|
||||
|
||||
## 复杂度
|
||||
|
||||
O(1)
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [D3D12ConstantBufferView 总览](constant-buffer-view.md)
|
||||
- [Shutdown](shutdown.md)
|
||||
16
docs/api/rhi/d3d12/constant-buffer-view/shutdown.md
Normal file
16
docs/api/rhi/d3d12/constant-buffer-view/shutdown.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# D3D12ConstantBufferView::Shutdown
|
||||
|
||||
```cpp
|
||||
void Shutdown();
|
||||
```
|
||||
|
||||
关闭常量缓冲区视图,重置内部状态。此方法仅重置描述符句柄和资源指针,**不会**释放底层 D3D12 资源,资源生命周期由外部管理。
|
||||
|
||||
## 复杂度
|
||||
|
||||
O(1)
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [D3D12ConstantBufferView 总览](constant-buffer-view.md)
|
||||
- [Initialize](initialize.md)
|
||||
Reference in New Issue
Block a user