hal/metal: fix storage binding size units

This commit is contained in:
Dzmitry Malyshau 2021-09-12 17:21:04 -04:00 committed by Dzmitry Malyshau
parent dc3736873d
commit 85bb70915b
2 changed files with 5 additions and 4 deletions

View File

@ -1,6 +1,7 @@
use super::{conv, AsNative};
use std::{mem, ops::Range};
// has to match `Temp::binding_sizes`
const WORD_SIZE: usize = 4;
impl Default for super::CommandState {
@ -63,15 +64,15 @@ impl super::CommandState {
fn make_sizes_buffer_update<'a>(
&self,
stage: naga::ShaderStage,
result_sizes: &'a mut Vec<wgt::BufferSize>,
) -> Option<(u32, &'a [wgt::BufferSize])> {
result_sizes: &'a mut Vec<u32>,
) -> 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);
result_sizes.push(size.get().min(!0u32 as u64) as u32);
}
Some((slot as _, result_sizes))
}

View File

@ -691,7 +691,7 @@ struct IndexState {
#[derive(Default)]
struct Temp {
binding_sizes: Vec<wgt::BufferSize>,
binding_sizes: Vec<u32>,
}
struct CommandState {