From 89a8867f9b3ae6dbbe8694890227a8ac0c9a6292 Mon Sep 17 00:00:00 2001 From: Connor Fitzgerald Date: Mon, 16 Dec 2024 10:47:19 -0500 Subject: [PATCH] Enable Partial Binding on DX12 (#6734) --- CHANGELOG.md | 6 ++++++ wgpu-hal/src/dx12/adapter.rs | 6 ++++++ wgpu-types/src/lib.rs | 4 ++++ 3 files changed, 16 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9bf86be289..40df590288 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,12 @@ By @cwfitzgerald in [#6619](https://github.com/gfx-rs/wgpu/pull/6619). A regression introduced in 23.0.0 caused lifetimes of render and compute passes to be incorrectly enforced. While this is not a soundness issue, the intent is to move an error from runtime to compile time. This issue has been fixed and restored to the 22.0.0 behavior. +### Bindless (`binding_array`) Grew More Capabilities + +- DX12 now supports `PARTIALLY_BOUND_BINDING_ARRAY` on Resource Binding Tier 3 Hardware. This is most D3D12 hardware [D3D12 Feature Table] for more information on what hardware supports this feature. By @cwfitzgerald in [#6734](https://github.com/gfx-rs/wgpu/pull/6734). + +[D3D12 Feature Table]: https://d3d12infodb.boolka.dev/FeatureTable.html + ### `Device::create_shader_module_unchecked` Renamed and Now Has Configuration Options `create_shader_module_unchecked` became `create_shader_module_trusted`. diff --git a/wgpu-hal/src/dx12/adapter.rs b/wgpu-hal/src/dx12/adapter.rs index f081febfdb..e9be55c1f8 100644 --- a/wgpu-hal/src/dx12/adapter.rs +++ b/wgpu-hal/src/dx12/adapter.rs @@ -344,6 +344,12 @@ impl super::Adapter { shader_model >= naga::back::hlsl::ShaderModel::V5_1, ); + // See note below the table https://learn.microsoft.com/en-us/windows/win32/direct3d12/hardware-support + features.set( + wgt::Features::PARTIALLY_BOUND_BINDING_ARRAY, + options.ResourceBindingTier.0 >= Direct3D12::D3D12_RESOURCE_BINDING_TIER_3.0, + ); + let bgra8unorm_storage_supported = { let mut bgra8unorm_info = Direct3D12::D3D12_FEATURE_DATA_FORMAT_SUPPORT { Format: Dxgi::Common::DXGI_FORMAT_B8G8R8A8_UNORM, diff --git a/wgpu-types/src/lib.rs b/wgpu-types/src/lib.rs index b486f5fe06..fa7dbe173c 100644 --- a/wgpu-types/src/lib.rs +++ b/wgpu-types/src/lib.rs @@ -628,6 +628,10 @@ bitflags::bitflags! { const UNIFORM_BUFFER_AND_STORAGE_TEXTURE_ARRAY_NON_UNIFORM_INDEXING = 1 << 31; /// Allows the user to create bind groups containing arrays with less bindings than the BindGroupLayout. /// + /// Supported platforms: + /// - Vulkan + /// - DX12 + /// /// This is a native only feature. const PARTIALLY_BOUND_BINDING_ARRAY = 1 << 32; /// Allows the user to call [`RenderPass::multi_draw_indirect`] and [`RenderPass::multi_draw_indexed_indirect`].