Files
XCEngine/docs/api/rhi/d3d12/common/is-shader-resource-format-supported.md
2026-03-20 02:35:45 +08:00

674 B

D3D12Common::IsShaderResourceFormatSupported

inline bool IsShaderResourceFormatSupported(ID3D12Device* device, DXGI_FORMAT format)

检查指定格式是否支持作为着色器资源。

参数:

  • device - D3D12 设备指针
  • format - 要检查的 DXGI 格式

返回: 如果格式支持作为着色器资源返回 true

线程安全: (只读查询)

示例:

ID3D12Device* device = ...;
if (IsShaderResourceFormatSupported(device, DXGI_FORMAT_R32G32B32_FLOAT)) {
    // 可以在着色器中读取该格式
}

相关文档