30 lines
623 B
Markdown
30 lines
623 B
Markdown
|
|
# D3D12Common::IsTextureFormatSupported
|
||
|
|
|
||
|
|
```cpp
|
||
|
|
inline bool IsTextureFormatSupported(ID3D12Device* device, DXGI_FORMAT format)
|
||
|
|
```
|
||
|
|
|
||
|
|
检查指定格式是否支持作为纹理。
|
||
|
|
|
||
|
|
**参数:**
|
||
|
|
- `device` - D3D12 设备指针
|
||
|
|
- `format` - 要检查的 DXGI 格式
|
||
|
|
|
||
|
|
**返回:** 如果格式支持作为纹理返回 `true`
|
||
|
|
|
||
|
|
**线程安全:** ✅(只读查询)
|
||
|
|
|
||
|
|
**示例:**
|
||
|
|
|
||
|
|
```cpp
|
||
|
|
ID3D12Device* device = ...;
|
||
|
|
if (IsTextureFormatSupported(device, DXGI_FORMAT_BC1_UNORM)) {
|
||
|
|
// 可以创建该格式的纹理
|
||
|
|
}
|
||
|
|
```
|
||
|
|
|
||
|
|
## 相关文档
|
||
|
|
|
||
|
|
- [D3D12Common 总览](common.md)
|
||
|
|
- [CheckFormatSupport](check-format-support.md)
|