docs: update RHI API docs
This commit is contained in:
@@ -6,10 +6,20 @@ virtual void* GetNativeHandle() = 0;
|
||||
|
||||
获取原生 API 句柄。
|
||||
|
||||
**返回:** 原生管线布局句柄
|
||||
**参数:** 无
|
||||
|
||||
**返回:** 原生管线布局句柄(类型为 `void*`,需要根据实际图形API进行类型转换)
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
## 示例代码
|
||||
|
||||
```cpp
|
||||
// 获取 D3D12 管线布局句柄
|
||||
void* nativeHandle = pipelineLayout->GetNativeHandle();
|
||||
// D3D12PipelineLayout* d3d12Layout = static_cast<D3D12PipelineLayout*>(nativeHandle);
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [RHIPipelineLayout 总览](pipeline-layout.md) - 返回类总览
|
||||
|
||||
@@ -7,12 +7,32 @@ virtual bool Initialize(const RHIPipelineLayoutDesc& desc) = 0;
|
||||
初始化管线布局。
|
||||
|
||||
**参数:**
|
||||
- `desc` - 管线布局描述符
|
||||
- `desc` - 管线布局描述符,包含以下成员:
|
||||
- `constantBufferCount` - 常量缓冲区数量
|
||||
- `textureCount` - 纹理数量
|
||||
- `samplerCount` - 采样器数量
|
||||
- `uavCount` - 无序访问视图数量
|
||||
|
||||
**返回:** 成功返回 `true`,失败返回 `false`
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
## 示例代码
|
||||
|
||||
```cpp
|
||||
RHIPipelineLayoutDesc desc;
|
||||
desc.constantBufferCount = 2;
|
||||
desc.textureCount = 4;
|
||||
desc.samplerCount = 2;
|
||||
desc.uavCount = 1;
|
||||
|
||||
if (pipelineLayout->Initialize(desc)) {
|
||||
// 初始化成功,可以继续使用
|
||||
} else {
|
||||
// 初始化失败,处理错误
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [RHIPipelineLayout 总览](pipeline-layout.md) - 返回类总览
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
# RHIPipelineLayout 方法
|
||||
|
||||
## Initialize
|
||||
|
||||
```cpp
|
||||
virtual bool Initialize(const RHIPipelineLayoutDesc& desc) = 0;
|
||||
```
|
||||
|
||||
初始化管线布局。
|
||||
|
||||
## Shutdown
|
||||
|
||||
```cpp
|
||||
virtual void Shutdown() = 0;
|
||||
```
|
||||
|
||||
释放管线布局资源。
|
||||
|
||||
## GetNativeHandle
|
||||
|
||||
```cpp
|
||||
virtual void* GetNativeHandle() = 0;
|
||||
```
|
||||
|
||||
获取原生 API 句柄。
|
||||
@@ -4,8 +4,14 @@
|
||||
|
||||
**类型**: `class` (abstract)
|
||||
|
||||
**头文件**: `XCEngine/RHI/RHIPipelineLayout.h`
|
||||
|
||||
**描述**: GPU 渲染管线布局抽象接口,用于定义着色器资源的绑定布局。
|
||||
|
||||
## 概述
|
||||
|
||||
`RHIPipelineLayout` 是 RHI(Rendering Hardware Interface)模块的核心类之一,负责描述GPU渲染管线中着色器资源的绑定布局。它定义了管线中使用的常量缓冲区、纹理采样器和无序访问视图的数量和配置。作为抽象基类,`RHIPipelineLayout` 需要由具体的图形API实现(如 D3D12、OpenGL)提供具体实现。
|
||||
|
||||
## 公共方法
|
||||
|
||||
| 方法 | 描述 |
|
||||
@@ -14,7 +20,32 @@
|
||||
| [`Shutdown`](shutdown.md) | 关闭并释放资源 |
|
||||
| [`GetNativeHandle`](get-native-handle.md) | 获取原生句柄 |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include "RHI/RHIPipelineLayout.h"
|
||||
#include "RHI/RHIDevice.h"
|
||||
|
||||
// 创建设备后创建管线布局
|
||||
RHIPipelineLayoutDesc layoutDesc;
|
||||
layoutDesc.constantBufferCount = 2;
|
||||
layoutDesc.textureCount = 4;
|
||||
layoutDesc.samplerCount = 2;
|
||||
layoutDesc.uavCount = 1;
|
||||
|
||||
RHIPipelineLayout* pipelineLayout = device->CreatePipelineLayout(layoutDesc);
|
||||
if (pipelineLayout->Initialize(layoutDesc)) {
|
||||
// 管线布局初始化成功
|
||||
void* nativeHandle = pipelineLayout->GetNativeHandle();
|
||||
|
||||
// 使用原生句柄进行绑定...
|
||||
|
||||
pipelineLayout->Shutdown();
|
||||
}
|
||||
delete pipelineLayout;
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [../rhi/rhi.md](../rhi.md) - RHI 模块总览
|
||||
- [../rhi.md](../rhi.md) - RHI 模块总览
|
||||
- [RHIDevice](../device/device.md) - 创建设备
|
||||
|
||||
@@ -6,8 +6,19 @@ virtual void Shutdown() = 0;
|
||||
|
||||
释放管线布局资源。
|
||||
|
||||
**参数:** 无
|
||||
|
||||
**返回:** 无
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
## 示例代码
|
||||
|
||||
```cpp
|
||||
// 使用完毕后释放资源
|
||||
pipelineLayout->Shutdown();
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [RHIPipelineLayout 总览](pipeline-layout.md) - 返回类总览
|
||||
|
||||
Reference in New Issue
Block a user