Files
XCEngine/docs/api/rhi/rhi-descriptor-pool.md

52 lines
1.5 KiB
Markdown
Raw Normal View History

# RHIDescriptorPool
**命名空间**: `XCEngine::RHI`
**类型**: `class` (abstract)
**描述**: GPU 描述符堆池抽象接口,用于管理 GPU 描述符的分配和回收。
## 概述
`RHIDescriptorPool` 封装了描述符堆Descriptor Heap的操作。描述符堆用于存储各种 GPU 描述符如常量缓冲视图CBV、着色器资源视图SRV、无序访问视图UAV和采样器等。
## 公共方法
### 生命周期
| 方法 | 描述 |
|------|------|
| `virtual bool Initialize(const DescriptorPoolDesc& desc)` | 初始化描述符池 |
| `virtual void Shutdown()` | 释放描述符池资源 |
### 属性访问
| 方法 | 描述 |
|------|------|
| `virtual void* GetNativeHandle()` | 获取原生 API 句柄 |
| `virtual uint32_t GetDescriptorCount() const` | 获取描述符数量 |
| `virtual DescriptorHeapType GetType() const` | 获取堆类型 |
## 描述符池描述 (DescriptorPoolDesc)
| 成员 | 类型 | 描述 |
|------|------|------|
| `device` | `void*` | 关联的设备指针 |
| `type` | `DescriptorHeapType` | 堆类型 |
| `descriptorCount` | `uint32_t` | 描述符数量 |
| `shaderVisible` | `bool` | 是否对着色器可见 |
## 描述符堆类型 (DescriptorHeapType)
| 枚举值 | 描述 |
|--------|------|
| `CBV_SRV_UAV` | 常量缓冲/着色器资源/无序访问视图 |
| `Sampler` | 采样器 |
| `RTV` | 渲染目标视图 |
| `DSV` | 深度模板视图 |
## 相关文档
- [RHIDevice](./rhi-device.md) - 创建设备
- [RHICapabilities](./rhi-capabilities.md) - 设备能力