Files
XCEngine/docs/api/rhi/factory/factory.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.4 KiB
Raw Blame History

RHIFactory

命名空间: XCEngine::RHI

类型: class (static methods only)

头文件: XCEngine/RHI/RHIFactory.h

描述: RHI 设备工厂,用于创建不同图形 API 后端的渲染设备。

概述

RHIFactory 是静态工厂类,提供统一的接口来创建不同后端的 RHIDevice 实例。通过 RHIType 枚举指定要创建的后端类型。

公共方法

方法 描述
~RHIFactory 虚析构函数
CreateRHIDevice(RHIType) 使用枚举类型创建 RHI 设备
CreateRHIDevice(std::string) 使用字符串创建 RHI 设备

类型映射

RHIType typeName 参数值
RHIType::D3D12 "D3D12"
RHIType::OpenGL "OpenGL"
RHIType::Vulkan "Vulkan"
RHIType::Metal "Metal"

使用示例

// 方法1使用枚举创建
RHIDevice* d3d12Device = RHIFactory::CreateRHIDevice(RHIType::D3D12);

// 方法2使用字符串创建
RHIDevice* glDevice = RHIFactory::CreateRHIDevice("OpenGL");

// 方法3根据配置选择
std::string backend = "D3D12";
RHIDevice* device = RHIFactory::CreateRHIDevice(backend);

相关文档