- Rename texture/dtor.md to destructor.md per template spec - Remove duplicate non-hyphenated fence docs (getnativehandle.md, issignaled.md, getcompletedvalue.md) - Fix template field issues: - swap-chain, command-queue: 类型 now uses 'class (abstract)' - sampler: 头文件 now uses full path 'XCEngine/RHI/RHISampler.h' - types: 类型 fixed from 'structs' to 'struct' - enums: 类型 fixed from 'enums' to 'enum class' - Fix include paths in command-queue and pipeline-layout code examples - Create missing constructor/destructor docs for 11 classes: buffer, texture, shader, device, command-list, command-queue, fence, sampler, swap-chain, pipeline-state, pipeline-layout - Update class overview pages to include constructor/destructor entries
61 lines
1.9 KiB
Markdown
61 lines
1.9 KiB
Markdown
# RHIPipelineState
|
||
|
||
**命名空间**: `XCEngine::RHI`
|
||
|
||
**类型**: `class` (abstract)
|
||
|
||
**头文件**: `XCEngine/RHI/RHIPipelineState.h`
|
||
|
||
**描述**: 管线状态接口,管理渲染管线状态
|
||
|
||
## 概述
|
||
|
||
`RHIPipelineState` 是 XCEngine RHI 模块中的抽象基类,定义了渲染管线状态的统一接口。它提供了绑定、解绑定、获取原生句柄以及查询管线类型等基本操作。作为抽象基类,具体实现由各图形 API(D3D12、OpenGL、Vulkan、Metal)自行实现。
|
||
|
||
此接口的主要作用是:
|
||
- 提供统一的管线状态管理抽象
|
||
- 屏蔽不同图形 API 的底层差异
|
||
- 支持图形管线、计算管线和光线追踪管线的管理
|
||
|
||
## 公共方法
|
||
|
||
| 方法 | 描述 |
|
||
|------|------|
|
||
| [`RHIPipelineState`](constructor.md) | 默认构造函数 |
|
||
| [`~RHIPipelineState`](destructor.md) | 虚析构函数 |
|
||
| [`Shutdown`](shutdown.md) | 关闭并释放管线状态资源 |
|
||
| [`Bind`](bind.md) | 将管线状态绑定到渲染上下文 |
|
||
| [`Unbind`](unbind.md) | 将管线状态从渲染上下文解绑 |
|
||
| [`GetNativeHandle`](get-native-handle.md) | 获取底层图形 API 的原生句柄 |
|
||
| [`GetType`](get-type.md) | 获取管线类型(图形/计算/光线追踪) |
|
||
|
||
## 使用示例
|
||
|
||
```cpp
|
||
#include "XCEngine/RHI/RHIPipelineState.h"
|
||
#include "XCEngine/RHI/RHIEnums.h"
|
||
|
||
void ExampleUsage(RHIPipelineState* pipelineState) {
|
||
if (!pipelineState) {
|
||
return;
|
||
}
|
||
|
||
PipelineType type = pipelineState->GetType();
|
||
|
||
if (type == PipelineType::Graphics) {
|
||
pipelineState->Bind();
|
||
}
|
||
|
||
void* nativeHandle = pipelineState->GetNativeHandle();
|
||
|
||
pipelineState->Unbind();
|
||
pipelineState->Shutdown();
|
||
}
|
||
```
|
||
|
||
## 相关文档
|
||
|
||
- [RHIDevice](../device/device.md) - 设备接口,创建管线状态
|
||
- [RHIPipelineLayout](../pipeline-layout/pipeline-layout.md) - 管线布局
|
||
- [RHICommandList](../command-list/command-list.md) - 命令列表,执行绘制命令
|