Files
XCSDD/docs/api/rhi/factory/create-rhi-device-string.md
ssdfasd 58a83f445a fix: improve doc link navigation and tree display
- Fix link resolution with proper relative/absolute path handling
- Improve link styling with underline decoration
- Hide leaf nodes from tree, only show directories
- Fix log file path for packaged app
2026-03-19 12:44:08 +08:00

680 B

RHIFactory::CreateRHIDevice (string)

static RHIDevice* CreateRHIDevice(const std::string& typeName);

根据字符串名称创建 RHI 设备。

参数:

  • typeName - 后端类型名称字符串(不区分大小写)

返回: 新创建的设备指针,失败返回 nullptr

复杂度: O(1)

支持的类型名称:

  • "D3D12" / "d3d12"
  • "OpenGL" / "opengl" / "GL"
  • Vulkan 和 Metal 暂不支持

示例:

// 从配置文件读取后端类型
std::string backendType = "D3D12";
RHIDevice* device = RHIFactory::CreateRHIDevice(backendType);

相关文档