Files
XCEngine/docs/api/rhi/pipeline-layout/pipeline-layout.md
2026-03-20 02:35:45 +08:00

52 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# RHIPipelineLayout
**命名空间**: `XCEngine::RHI`
**类型**: `class` (abstract)
**头文件**: `XCEngine/RHI/RHIPipelineLayout.h`
**描述**: GPU 渲染管线布局抽象接口,用于定义着色器资源的绑定布局。
## 概述
`RHIPipelineLayout` 是 RHIRendering Hardware Interface模块的核心类之一负责描述GPU渲染管线中着色器资源的绑定布局。它定义了管线中使用的常量缓冲区、纹理采样器和无序访问视图的数量和配置。作为抽象基类`RHIPipelineLayout` 需要由具体的图形API实现如 D3D12、OpenGL提供具体实现。
## 公共方法
| 方法 | 描述 |
|------|------|
| [`Initialize`](initialize.md) | 初始化管线布局 |
| [`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.md](../rhi.md) - RHI 模块总览
- [RHIDevice](../device/device.md) - 创建设备