spirv/gpu.rs: don't hard-code Vec3<f32> size

in the future this may become parameterized
This commit is contained in:
2022-07-25 12:36:50 -07:00
parent 38a47a0054
commit d1765554fc

View File

@@ -59,7 +59,7 @@ where
pub(super) fn step_spirv<S: AbstractStimulus>(&mut self, num_steps: u32, stim: &S) {
let size = self.size();
let (stim_cpu_e, stim_cpu_h) = self.eval_stimulus(stim);
let field_bytes = size.product_sum() * 12;
let field_bytes = size.product_sum() as usize * std::mem::size_of::<Vec3<f32>>();
let sim_meta = [self.meta.clone()];
@@ -202,7 +202,7 @@ where
0,
&e_readback_buffer,
0,
field_bytes as _,
field_bytes as u64,
);
encoder.copy_buffer_to_buffer(
@@ -210,7 +210,7 @@ where
0,
&h_readback_buffer,
0,
field_bytes as _,
field_bytes as u64,
);
encoder.copy_buffer_to_buffer(
@@ -218,7 +218,7 @@ where
0,
&m_readback_buffer,
0,
field_bytes as _,
field_bytes as u64,
);
queue.submit(Some(encoder.finish()));