From 59d640a10777bae6dffaee838486f81166dc56b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Drago=C8=99=20Tiselice?= Date: Thu, 21 Apr 2022 21:49:33 +0200 Subject: [PATCH] metal: Don't skip incomplete binding resources. (#2622) --- wgpu-hal/src/metal/command.rs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/wgpu-hal/src/metal/command.rs b/wgpu-hal/src/metal/command.rs index 77f3cbfb1..7eaf97b65 100644 --- a/wgpu-hal/src/metal/command.rs +++ b/wgpu-hal/src/metal/command.rs @@ -74,13 +74,21 @@ impl super::CommandState { ) -> Option<(u32, &'a [u32])> { let stage_info = &self.stage_infos[stage]; let slot = stage_info.sizes_slot?; + result_sizes.clear(); - for br in stage_info.sized_bindings.iter() { - // If it's None, this isn't the right time to update the sizes - let size = self.storage_buffer_length_map.get(br)?; - result_sizes.push(size.get().min(!0u32 as u64) as u32); + 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), + ); + + if !result_sizes.is_empty() { + Some((slot as _, result_sizes)) + } else { + None } - Some((slot as _, result_sizes)) } }