检查硬件功能支持

本部分介绍如何使用 API 调用检查 Direct3D 功能级别硬件的格式支持。

对于 D3D11,请使用 ID3D11Device::CheckFormatSupport 以编程方式验证前面部分中的信息。 对于 D3D12,请使用 ID3D12::CheckFeatureSupport

设置目标格式 D3D12 D3D11
Buffer D3D12_FORMAT_SUPPORT1_BUFFER (D3D12_FORMAT_SUPPORT1) D3D11_FORMAT_SUPPORT_BUFFER (D3D11_FORMAT_SUPPORT)
输入装配器顶点缓冲区 D3D12_FORMAT_SUPPORT1_IA_VERTEX_BUFFER (D3D12_FORMAT_SUPPORT1) D3D11_FORMAT_SUPPORT_IA_VERTEX_BUFFER (D3D11_FORMAT_SUPPORT)
输入汇编程序索引缓冲区 D3D12_FORMAT_SUPPORT1_IA_INDEX_BUFFER (D3D12_FORMAT_SUPPORT1) D3D11_FORMAT_SUPPORT_IA_INDEX_BUFFER (D3D11_FORMAT_SUPPORT)
流输出缓冲区 D3D12_FORMAT_SUPPORT1_SO_BUFFER (D3D12_FORMAT_SUPPORT1) D3D11_FORMAT_SUPPORT_SO_BUFFER (D3D11_FORMAT_SUPPORT)
Texture1D D3D12_FORMAT_SUPPORT1_TEXTURE1D (D3D12_FORMAT_SUPPORT1) D3D11_FORMAT_SUPPORT_TEXTURE1D (D3D11_FORMAT_SUPPORT)
Texture2D D3D12_FORMAT_SUPPORT1_TEXTURE2D (D3D12_FORMAT_SUPPORT1) D3D11_FORMAT_SUPPORT_TEXTURE2D (D3D11_FORMAT_SUPPORT)
Texture3D D3D12_FORMAT_SUPPORT1_TEXTURE3D (D3D12_FORMAT_SUPPORT1) D3D11_FORMAT_SUPPORT_TEXTURE3D (D3D11_FORMAT_SUPPORT)
TextureCube D3D12_FORMAT_SUPPORT1_TEXTURECUBE (D3D12_FORMAT_SUPPORT1) D3D11_FORMAT_SUPPORT_TEXTURECUBE (D3D11_FORMAT_SUPPORT)
着色器 ld D3D12_FORMAT_SUPPORT1_SHADER_LOAD (D3D12_FORMAT_SUPPORT1) D3D11_FORMAT_SUPPORT_SHADER_LOAD (D3D11_FORMAT_SUPPORT)
(任何筛选器) 着色器示例 D3D12_FORMAT_SUPPORT1_SHADER_SAMPLE (D3D12_FORMAT_SUPPORT1) D3D11_FORMAT_SUPPORT_SHADER_SAMPLE (D3D11_FORMAT_SUPPORT)
着色器sample_c (比较筛选器) D3D12_FORMAT_SUPPORT1_SHADER_SAMPLE_COMPARISON (D3D12_FORMAT_SUPPORT1) D3D11_FORMAT_SUPPORT_SHADER_SAMPLE_COMPARISON (D3D11_FORMAT_SUPPORT)
单声道1_bit_filter) (着色器示例 D3D12_FORMAT_SUPPORT1_SHADER_SAMPLE_MONO_TEXT (D3D12_FORMAT_SUPPORT1) D3D11_FORMAT_SUPPORT_SHADER_SAMPLE_MONO_TEXT (D3D11_FORMAT_SUPPORT)
着色器集合4 D3D12_FORMAT_SUPPORT1_SHADER_GATHER (D3D12_FORMAT_SUPPORT1) D3D11_FORMAT_SUPPORT_SHADER_GATHER (D3D11_FORMAT_SUPPORT)
着色器gather4_c D3D12_FORMAT_SUPPORT1_SHADER_GATHER_COMPARISON (D3D12_FORMAT_SUPPORT1) D3D11_FORMAT_SUPPORT_SHADER_GATHER_COMPARISON (D3D11_FORMAT_SUPPORT)
Mipmap D3D12_FORMAT_SUPPORT1_MIP (D3D12_FORMAT_SUPPORT1) D3D11_FORMAT_SUPPORT_MIP (D3D11_FORMAT_SUPPORT)
Mipmap 自动生成 注意:
D3D12 不再具有专用 mipmap 生成功能。 应用程序必须使用着色器自行实现它。


D3D11_FORMAT_SUPPORT_MIP_AUTOGEN (D3D11_FORMAT_SUPPORT)
RenderTarget D3D12_FORMAT_SUPPORT1_RENDER_TARGET (D3D12_FORMAT_SUPPORT1) D3D11_FORMAT_SUPPORT_RENDER_TARGET (D3D11_FORMAT_SUPPORT)
可混合的 RenderTarget D3D12_FORMAT_SUPPORT1_BLENDABLE (D3D12_FORMAT_SUPPORT1) D3D11_FORMAT_SUPPORT_BLENDABLE (D3D11_FORMAT_SUPPORT)
输出合并逻辑操作 D3D12_FORMAT_SUPPORT2_OUTPUT_MERGER_LOGIC_OP D3D11_FORMAT_SUPPORT2_OUTPUT_MERGER_LOGIC_OP (D3D11_FORMAT_SUPPORT2)
深度/模具目标 D3D12_FORMAT_SUPPORT1_DEPTH_STENCIL (D3D12_FORMAT_SUPPORT1) D3D11_FORMAT_SUPPORT_DEPTH_STENCIL (D3D11_FORMAT_SUPPORT)
原始 UAV 和 SRV
结构化 UAV 和 SRV
类型化 UAV D3D12_FORMAT_SUPPORT1_TYPED_UNORDERED_ACCESS_VIEW (D3D12_FORMAT_SUPPORT1) D3D11_FORMAT_SUPPORT_TYPED_UNORDERED_ACCESS_VIEW (D3D11_FORMAT_SUPPORT)
UAV 类型化存储 D3D12_FORMAT_SUPPORT2_UAV_TYPED_STORE (D3D12_FORMAT_SUPPORT2) D3D11_FORMAT_SUPPORT2_UAV_TYPED_STORE (D3D11_FORMAT_SUPPORT2)
UAV 类型化负载 D3D12_FORMAT_SUPPORT2_UAV_TYPED_LOAD (D3D12_FORMAT_SUPPORT2) D3D11_FORMAT_SUPPORT2_UAV_TYPED_LOAD (D3D11_FORMAT_SUPPORT2)
UAV Atomic Add D3D12_FORMAT_SUPPORT2_UAV_ATOMIC_ADD (D3D12_FORMAT_SUPPORT2) D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_ADD (D3D11_FORMAT_SUPPORT2)
UAV 原子按位操作 D3D12_FORMAT_SUPPORT2_UAV_ATOMIC_BITWISE_OPS (D3D12_FORMAT_SUPPORT2) D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_BITWISE_OPS (D3D11_FORMAT_SUPPORT2)
UAV Atomic Cmp&Store/ Cmp&Exch D3D12_FORMAT_SUPPORT2_UAV_ATOMIC_COMPARE_STORE_OR_COMPARE_EXCHANGE (D3D12_FORMAT_SUPPORT2) D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_COMPARE_STORE_OR_COMPARE_EXCHANGE (D3D11_FORMAT_SUPPORT2)
UAV 原子交换 D3D12_FORMAT_SUPPORT2_UAV_ATOMIC_EXCHANGE (D3D12_FORMAT_SUPPORT2) D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_EXCHANGE (D3D11_FORMAT_SUPPORT2)
UAV 原子签名最小值/最大值 D3D12_FORMAT_SUPPORT2_UAV_ATOMIC_SIGNED_MIN_OR_MAX (D3D12_FORMAT_SUPPORT2) D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_SIGNED_MIN_OR_MAX (D3D11_FORMAT_SUPPORT2)
UAV 原子无符号最小值/最大值 D3D12_FORMAT_SUPPORT2_UAV_ATOMIC_UNSIGNED_MIN_OR_MAX (D3D12_FORMAT_SUPPORT2) D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_UNSIGNED_MIN_OR_MAX (D3D11_FORMAT_SUPPORT2)
CPU 可锁定 注意:
只有一种格式会阻止 cpu 访问 (420_OPAQUE) 。


D3D11_FORMAT_SUPPORT_CPU_LOCKABLE (D3D11_FORMAT_SUPPORT)
4x 多重采样 RenderTarget D3D12_FORMAT_SUPPORT1_MULTISAMPLE_RENDERTARGET (D3D12_FORMAT_SUPPORT1) D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET (D3D11_FORMAT_SUPPORT)
8x 多重采样 RenderTarget D3D12_FORMAT_SUPPORT1_MULTISAMPLE_RENDERTARGET (D3D12_FORMAT_SUPPORT1) D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET (D3D11_FORMAT_SUPPORT)
其他多重采样计数 RT D3D12_FORMAT_SUPPORT1_MULTISAMPLE_RENDERTARGET (D3D12_FORMAT_SUPPORT1) D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET (D3D11_FORMAT_SUPPORT)
多重采样解析 D3D12_FORMAT_SUPPORT1_MULTISAMPLE_RESOLVE (D3D12_FORMAT_SUPPORT1) D3D11_FORMAT_SUPPORT_MULTISAMPLE_RESOLVE (D3D11_FORMAT_SUPPORT)
多重采样负载 D3D12_FORMAT_SUPPORT1_MULTISAMPLE_LOAD (D3D12_FORMAT_SUPPORT1) D3D11_FORMAT_SUPPORT_MULTISAMPLE_LOAD (D3D11_FORMAT_SUPPORT)
显示 Scan-Out D3D12_FORMAT_SUPPORT1_DISPLAY (D3D12_FORMAT_SUPPORT1) D3D11_FORMAT_SUPPORT_DISPLAY (D3D11_FORMAT_SUPPORT)
位布局中的强制转换 D3D12_FORMAT_SUPPORT1_CAST_WITHIN_BIT_LAYOUT (D3D12_FORMAT_SUPPORT1) D3D11_FORMAT_SUPPORT_CAST_WITHIN_BIT_LAYOUT (D3D11_FORMAT_SUPPORT)
视频解码器支持 D3D12_FORMAT_SUPPORT1_DECODER_OUTPUT (D3D12_FORMAT_SUPPORT1) D3D11_FORMAT_SUPPORT_DECODER_OUTPUT (D3D11_FORMAT_SUPPORT)
视频处理器输入 D3D12_FORMAT_SUPPORT1_VIDEO_PROCESSOR_INPUT (D3D12_FORMAT_SUPPORT1) D3D11_FORMAT_SUPPORT_VIDEO_PROCESSOR_INPUT (D3D11_FORMAT_SUPPORT)
视频处理器输出 D3D12_FORMAT_SUPPORT1_VIDEO_PROCESSOR_OUTPUT (D3D12_FORMAT_SUPPORT1) D3D11_FORMAT_SUPPORT_VIDEO_PROCESSOR_OUTPUT (D3D11_FORMAT_SUPPORT)
共享资源 注意:
所有格式的纹理都可以共享提交资源,也可以放置在共享堆中。


D3D11_FORMAT_SUPPORT2_SHAREABLE (D3D11_FORMAT_SUPPORT2)
BackBuffer 可强制转换甚至完全类型化 D3D12_FORMAT_SUPPORT1_BACK_BUFFER_CAST (D3D12_FORMAT_SUPPORT1) 注意:
没有可用的 API。


平铺资源 D3D12_FORMAT_SUPPORT2_TILED (D3D12_FORMAT_SUPPORT2) D3D11_FORMAT_SUPPORT2_TILED (D3D11_FORMAT_SUPPORT2)
视频编码器 D3D12_FORMAT_SUPPORT1_VIDEO_ENCODER (D3D12_FORMAT_SUPPORT1) D3D11_FORMAT_SUPPORT_VIDEO_ENCODER (D3D11_FORMAT_SUPPORT)
多平面覆盖层 D3D12_FORMAT_SUPPORT2_MULTIPLANE_OVERLAY (D3D12_FORMAT_SUPPORT2) D3D11_FORMAT_SUPPORT2_MULTIPLANE_OVERLAY (D3D11_FORMAT_SUPPORT2)

D3D12 硬件功能级别

DXGI_FORMAT

D3D11_FORMAT_SUPPORT

D3D11_FORMAT_SUPPORT2

DXGI 编程指南