Files
XCEngine/docs/api/rhi/pipeline-state/pipeline-state.md
ssdfasd d83ed56177 fix(rhi): Fix RHI abstraction layer API docs per api-skill.md template
- 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
2026-03-22 03:07:41 +08:00

1.9 KiB
Raw Blame History

RHIPipelineState

命名空间: XCEngine::RHI

类型: class (abstract)

头文件: XCEngine/RHI/RHIPipelineState.h

描述: 管线状态接口,管理渲染管线状态

概述

RHIPipelineState 是 XCEngine RHI 模块中的抽象基类,定义了渲染管线状态的统一接口。它提供了绑定、解绑定、获取原生句柄以及查询管线类型等基本操作。作为抽象基类,具体实现由各图形 APID3D12、OpenGL、Vulkan、Metal自行实现。

此接口的主要作用是:

  • 提供统一的管线状态管理抽象
  • 屏蔽不同图形 API 的底层差异
  • 支持图形管线、计算管线和光线追踪管线的管理

公共方法

方法 描述
RHIPipelineState 默认构造函数
~RHIPipelineState 虚析构函数
Shutdown 关闭并释放管线状态资源
Bind 将管线状态绑定到渲染上下文
Unbind 将管线状态从渲染上下文解绑
GetNativeHandle 获取底层图形 API 的原生句柄
GetType 获取管线类型(图形/计算/光线追踪)

使用示例

#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();
}

相关文档