Fixed buffer sizes encoding on Metal.
@@ -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))
