From 5c33e23b6615048cd2e9ff9b547773d905a9b533 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Drago=C8=99=20Tiselice?= Date: Wed, 5 Oct 2022 20:44:51 +0000 Subject: [PATCH] Fixed buffer sizes encoding on Metal. (#3047) --- CHANGELOG.md | 1 + wgpu-hal/src/metal/command.rs | 13 ++++++------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 166524e6cc..fcf84b957a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -93,6 +93,7 @@ SurfaceConfiguration { - Add the missing `msg_send![view, retain]` call within `from_view` by @jinleili in [#2976](https://github.com/gfx-rs/wgpu/pull/2976) - Fix `max_buffer` `max_texture` and `max_vertex_buffers` limits by @jinleili in [#2978](https://github.com/gfx-rs/wgpu/pull/2978) - Remove PrivateCapabilities's `format_rgb10a2_unorm_surface` field by @jinleili in [#2981](https://github.com/gfx-rs/wgpu/pull/2981) +- Fix `_buffer_sizes` encoding by @dtiselice in [#3047](https://github.com/gfx-rs/wgpu/pull/3047) #### Vulkan - Fix `astc_hdr` formats support by @jinleili in [#2971]](https://github.com/gfx-rs/wgpu/pull/2971) diff --git a/wgpu-hal/src/metal/command.rs b/wgpu-hal/src/metal/command.rs index 33e282ac2f..958b3c4d31 100644 --- a/wgpu-hal/src/metal/command.rs +++ b/wgpu-hal/src/metal/command.rs @@ -76,13 +76,12 @@ impl super::CommandState { let slot = stage_info.sizes_slot?; result_sizes.clear(); - result_sizes.extend( - stage_info - .sized_bindings - .iter() - .filter_map(|br| self.storage_buffer_length_map.get(br)) - .map(|size| size.get().min(!0u32 as u64) as u32), - ); + result_sizes.extend(stage_info.sized_bindings.iter().map(|br| { + self.storage_buffer_length_map + .get(br) + .map(|size| u32::try_from(size.get()).unwrap_or(u32::MAX)) + .unwrap_or_default() + })); if !result_sizes.is_empty() { Some((slot as _, result_sizes))