From be5847f627dfe5ea2029da43c10ef1d29c40a47c Mon Sep 17 00:00:00 2001 From: Nicolas Silva Date: Wed, 9 Aug 2023 18:31:38 +0200 Subject: [PATCH 1/2] Use i32::MAX as the max buffer size for Dx12 This is also the limit used in Dawn. --- wgpu-hal/src/dx12/adapter.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wgpu-hal/src/dx12/adapter.rs b/wgpu-hal/src/dx12/adapter.rs index 27e8e8e05f..3771aa79c8 100644 --- a/wgpu-hal/src/dx12/adapter.rs +++ b/wgpu-hal/src/dx12/adapter.rs @@ -355,7 +355,10 @@ impl super::Adapter { max_compute_workgroup_size_z: d3d12_ty::D3D12_CS_THREAD_GROUP_MAX_Z, max_compute_workgroups_per_dimension: d3d12_ty::D3D12_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION, - max_buffer_size: u64::MAX, + // Dx12 does not expose a maximum buffer size in the API. + // This limit is chosen to avoid potential issues with drivers should they internally + // store buffer sizes using 32 bit ints (a situation we have already encountered with vulkan). + max_buffer_size: i32::MAX as u64, }, alignments: crate::Alignments { buffer_copy_offset: wgt::BufferSize::new( From 16afa64231d4e612e6d02c93b6c3bfe39a0077c7 Mon Sep 17 00:00:00 2001 From: Nicolas Silva Date: Wed, 9 Aug 2023 18:41:42 +0200 Subject: [PATCH 2/2] Changelog entry. --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8514eb4c52..cc4b0f0b0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -166,6 +166,7 @@ By @fornwall in [#3904](https://github.com/gfx-rs/wgpu/pull/3904) and [#3905](ht #### DX12 - Disable suballocation on Intel Iris(R) Xe. By @xiaopengli89 in [#3668](https://github.com/gfx-rs/wgpu/pull/3668) +- Change the `max_buffer_size` limit from `u64::MAX` to `i32::MAX`. By @nical in [#4020](https://github.com/gfx-rs/wgpu/pull/4020) #### WebGPU