Files
XCEngine/docs/api/rhi/rhi-capabilities.md

89 lines
2.9 KiB
Markdown
Raw Normal View History

# RHICapabilities
**命名空间**: `XCEngine::RHI`
**类型**: `struct`
**描述**: GPU 设备能力结构体,描述了当前图形设备支持的各种功能和限制。
## 概述
`RHICapabilities` 存储了设备的能力信息,包括对各种图形特性的支持情况和资源尺寸限制。
## 公共成员
### 特性支持
| 成员 | 类型 | 描述 |
|------|------|------|
| `bSupportsRayTracing` | `bool` | 支持光线追踪 |
| `bSupportsMeshShaders` | `bool` | 支持 Mesh 着色器 |
| `bSupportsExplicitMultiThreading` | `bool` | 支持显式多线程 |
| `bSupportsGeometryShaders` | `bool` | 支持几何着色器 |
| `bSupportsTessellation` | `bool` | 支持曲面细分 |
| `bSupportsComputeShaders` | `bool` | 支持计算着色器 |
| `bSupportsDepthBoundsTest` | `bool` | 支持深度范围测试 |
| `bSupportsAlphaToCoverage` | `bool` | 支持 Alpha 到覆盖 |
| `bSupportsIndependentBlend` | `bool` | 支持独立混合 |
| `bSupportsLogicOps` | `bool` | 支持逻辑操作 |
| `bSupportsMultiViewport` | `bool` | 支持多视口 |
| `bSupportsConservativeRasterization` | `bool` | 支持保守光栅化 |
| `bSupportsProgrammableSamplePositions` | `bool` | 支持可编程采样位置 |
### 资源限制
| 成员 | 类型 | 描述 |
|------|------|------|
| `maxTexture2DSize` | `uint32_t` | 最大 2D 纹理尺寸 |
| `maxTexture3DSize` | `uint32_t` | 最大 3D 纹理尺寸 |
| `maxTextureCubeSize` | `uint32_t` | 最大立方体贴图尺寸 |
| `maxRenderTargets` | `uint32_t` | 最大渲染目标数量 |
| `maxViewports` | `uint32_t` | 最大视口数量 |
| `maxVertexAttribs` | `uint32_t` | 最大顶点属性数量 |
| `maxConstantBufferSize` | `uint32_t` | 最大常量缓冲大小 |
| `maxAnisotropy` | `uint32_t` | 最大各向异性级别 |
| `maxColorAttachments` | `uint32_t` | 最大颜色附件数量 |
### 线/点渲染
| 成员 | 类型 | 描述 |
|------|------|------|
| `minSmoothedLineWidth` | `float` | 最小平滑线宽 |
| `maxSmoothedLineWidth` | `float` | 最大平滑线宽 |
| `minPointSize` | `float` | 最小点大小 |
| `maxPointSize` | `float` | 最大点大小 |
| `maxPointSizeAA` | `float` | 抗锯齿最大点大小 |
| `maxLineWidth` | `float` | 最大线宽 |
| `maxLineWidthAA` | `float` | 抗锯齿最大线宽 |
### 版本信息
| 成员 | 类型 | 描述 |
|------|------|------|
| `majorVersion` | `int` | 主版本号 |
| `minorVersion` | `int` | 次版本号 |
| `shaderModel` | `std::string` | 着色器模型版本 |
## 使用示例
```cpp
// 获取设备能力
const RHICapabilities& caps = device->GetCapabilities();
// 检查功能支持
if (caps.bSupportsRayTracing) {
// 启用光线追踪功能
}
if (caps.bSupportsComputeShaders) {
// 启用计算着色器功能
}
// 使用资源限制
uint32_t textureSize = std::min(requestedSize, caps.maxTexture2DSize);
```
## 相关文档
- [RHIDevice](./rhi-device.md) - 设备对象