38 lines
1.0 KiB
Markdown
38 lines
1.0 KiB
Markdown
|
|
# D3D12Common::CheckFormatSupport
|
|||
|
|
|
|||
|
|
```cpp
|
|||
|
|
inline bool CheckFormatSupport(
|
|||
|
|
ID3D12Device* device,
|
|||
|
|
DXGI_FORMAT format,
|
|||
|
|
D3D12_FORMAT_SUPPORT1 support1,
|
|||
|
|
D3D12_FORMAT_SUPPORT2 support2 = D3D12_FORMAT_SUPPORT2_NONE
|
|||
|
|
)
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
检查设备是否支持指定格式的特定功能。
|
|||
|
|
|
|||
|
|
**参数:**
|
|||
|
|
- `device` - D3D12 设备指针
|
|||
|
|
- `format` - 要检查的 DXGI 格式
|
|||
|
|
- `support1` - 主格式支持标志(`D3D12_FORMAT_SUPPORT1`)
|
|||
|
|
- `support2` - 扩展格式支持标志(`D3D12_FORMAT_SUPPORT2`),默认为 `D3D12_FORMAT_SUPPORT2_NONE`
|
|||
|
|
|
|||
|
|
**返回:** 如果格式支持指定功能返回 `true`,否则返回 `false`
|
|||
|
|
|
|||
|
|
**线程安全:** ✅(只读查询)
|
|||
|
|
|
|||
|
|
**示例:**
|
|||
|
|
|
|||
|
|
```cpp
|
|||
|
|
ID3D12Device* device = ...;
|
|||
|
|
if (CheckFormatSupport(device, DXGI_FORMAT_BC1_UNORM, D3D12_FORMAT_SUPPORT1_TEXTURE2D)) {
|
|||
|
|
// 支持 BC1 压缩格式
|
|||
|
|
}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
## 相关文档
|
|||
|
|
|
|||
|
|
- [D3D12Common 总览](common.md)
|
|||
|
|
- [IsRenderTargetFormatSupported](is-render-target-format-supported.md)
|
|||
|
|
- [IsTextureFormatSupported](is-texture-format-supported.md)
|