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

51 lines
1.4 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.
# RHIFactory
**命名空间**: `XCEngine::RHI`
**类型**: `class` (static methods only)
**头文件**: `XCEngine/RHI/RHIFactory.h`
**描述**: RHI 设备工厂,用于创建不同图形 API 后端的渲染设备。
## 概述
`RHIFactory` 是静态工厂类,提供统一的接口来创建不同后端的 `RHIDevice` 实例。通过 `RHIType` 枚举指定要创建的后端类型。
## 公共方法
| 方法 | 描述 |
|------|------|
| [`~RHIFactory`](destructor.md) | 虚析构函数 |
| [`CreateRHIDevice(RHIType)`](create-rhi-device-type.md) | 使用枚举类型创建 RHI 设备 |
| [`CreateRHIDevice(std::string)`](create-rhi-device-string.md) | 使用字符串创建 RHI 设备 |
## 类型映射
| RHIType | typeName 参数值 |
|----------|-----------------|
| `RHIType::D3D12` | `"D3D12"` |
| `RHIType::OpenGL` | `"OpenGL"` |
| `RHIType::Vulkan` | `"Vulkan"` |
| `RHIType::Metal` | `"Metal"` |
## 使用示例
```cpp
// 方法1使用枚举创建
RHIDevice* d3d12Device = RHIFactory::CreateRHIDevice(RHIType::D3D12);
// 方法2使用字符串创建
RHIDevice* glDevice = RHIFactory::CreateRHIDevice("OpenGL");
// 方法3根据配置选择
std::string backend = "D3D12";
RHIDevice* device = RHIFactory::CreateRHIDevice(backend);
```
## 相关文档
- [../rhi/rhi.md](../rhi.md) - RHI 模块总览
- [RHIDevice](../device/device.md) - 渲染设备
- [RHIEnums](../enums/enums.md) - RHIType 枚举定义