mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-25 16:24:24 +00:00
hal/metal: fix storage binding size units
This commit is contained in:
parent
dc3736873d
commit
85bb70915b
@ -1,6 +1,7 @@
|
|||||||
use super::{conv, AsNative};
|
use super::{conv, AsNative};
|
||||||
use std::{mem, ops::Range};
|
use std::{mem, ops::Range};
|
||||||
|
|
||||||
|
// has to match `Temp::binding_sizes`
|
||||||
const WORD_SIZE: usize = 4;
|
const WORD_SIZE: usize = 4;
|
||||||
|
|
||||||
impl Default for super::CommandState {
|
impl Default for super::CommandState {
|
||||||
@ -63,15 +64,15 @@ impl super::CommandState {
|
|||||||
fn make_sizes_buffer_update<'a>(
|
fn make_sizes_buffer_update<'a>(
|
||||||
&self,
|
&self,
|
||||||
stage: naga::ShaderStage,
|
stage: naga::ShaderStage,
|
||||||
result_sizes: &'a mut Vec<wgt::BufferSize>,
|
result_sizes: &'a mut Vec<u32>,
|
||||||
) -> Option<(u32, &'a [wgt::BufferSize])> {
|
) -> Option<(u32, &'a [u32])> {
|
||||||
let stage_info = &self.stage_infos[stage];
|
let stage_info = &self.stage_infos[stage];
|
||||||
let slot = stage_info.sizes_slot?;
|
let slot = stage_info.sizes_slot?;
|
||||||
result_sizes.clear();
|
result_sizes.clear();
|
||||||
for br in stage_info.sized_bindings.iter() {
|
for br in stage_info.sized_bindings.iter() {
|
||||||
// If it's None, this isn't the right time to update the sizes
|
// If it's None, this isn't the right time to update the sizes
|
||||||
let size = self.storage_buffer_length_map.get(br)?;
|
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))
|
Some((slot as _, result_sizes))
|
||||||
}
|
}
|
||||||
|
@ -691,7 +691,7 @@ struct IndexState {
|
|||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
struct Temp {
|
struct Temp {
|
||||||
binding_sizes: Vec<wgt::BufferSize>,
|
binding_sizes: Vec<u32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct CommandState {
|
struct CommandState {
|
||||||
|
Loading…
Reference in New Issue
Block a user