docs: update RHI API docs
This commit is contained in:
@@ -4,19 +4,49 @@
|
||||
|
||||
**类型**: `class` (abstract)
|
||||
|
||||
**头文件**: `XCEngine/RHI/RHIDescriptorPool.h`
|
||||
|
||||
**描述**: GPU 描述符堆池抽象接口,用于管理 GPU 描述符的分配和回收。
|
||||
|
||||
## 概述
|
||||
|
||||
`RHIDescriptorPool` 是 RHI 模块中的抽象类,提供 GPU 描述符堆的统一接口。描述符堆用于存储 GPU 资源视图(如常量缓冲区视图、着色器资源视图、采样器等)。该类管理描述符的分配和回收,支持着色器可见性配置。
|
||||
|
||||
## 公共方法
|
||||
|
||||
| 方法 | 描述 |
|
||||
|------|------|
|
||||
| [`Initialize`](../../threading/task-system/initialize.md) | 初始化描述符池 |
|
||||
| [`Shutdown`](../../threading/task-system/shutdown.md) | 关闭并释放资源 |
|
||||
| [`GetNativeHandle`](../buffer/get-native-handle.md) | 获取原生句柄 |
|
||||
| [`~RHIDescriptorPool`](destructor.md) | 虚析构函数 |
|
||||
| [`Initialize`](initialize.md) | 初始化描述符池 |
|
||||
| [`Shutdown`](shutdown.md) | 关闭并释放资源 |
|
||||
| [`GetNativeHandle`](get-native-handle.md) | 获取原生句柄 |
|
||||
| [`GetDescriptorCount`](get-descriptor-count.md) | 获取描述符数量 |
|
||||
| [`GetType`](../command-queue/get-type.md) | 获取描述符类型 |
|
||||
| [`GetType`](get-type.md) | 获取描述符类型 |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
// 创建描述符池
|
||||
DescriptorPoolDesc desc;
|
||||
desc.device = device;
|
||||
desc.type = DescriptorHeapType::CBV_SRV_UAV;
|
||||
desc.descriptorCount = 256;
|
||||
desc.shaderVisible = true;
|
||||
|
||||
RHIDescriptorPool* pool = yourFactory->CreateDescriptorPool();
|
||||
if (pool->Initialize(desc)) {
|
||||
// 获取描述符数量
|
||||
uint32_t count = pool->GetDescriptorCount();
|
||||
|
||||
// 获取原生句柄
|
||||
void* handle = pool->GetNativeHandle();
|
||||
|
||||
// 使用完后关闭
|
||||
pool->Shutdown();
|
||||
}
|
||||
delete pool;
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [../rhi/rhi.md](../rhi.md) - RHI 模块总览
|
||||
- [RHIDevice](../device/device.md) - 创建设备
|
||||
- [RHI 模块总览](../rhi.md) - RHI 模块总览
|
||||
|
||||
Reference in New Issue
Block a user