spirv: instantiate the backend in mod.rs, not gpu.rs

This commit is contained in:
2022-07-25 12:47:39 -07:00
parent bd066331de
commit 5b8978f0ec
2 changed files with 4 additions and 4 deletions

View File

@@ -2,7 +2,6 @@ use futures::FutureExt as _;
use log::{info, warn};
use std::borrow::Cow;
use std::num::NonZeroU64;
use std::sync::Arc;
use wgpu;
use wgpu::util::DeviceExt as _;
@@ -73,9 +72,6 @@ where
let sim_meta = [self.meta.clone()];
self.wgpu.get_or_insert_with(
|| Arc::new(WgpuData::new::<M>(size.volume()))
);
let wgpu = &**self.wgpu.as_ref().unwrap();
let device = &wgpu.device;
let queue = &wgpu.queue;

View File

@@ -93,6 +93,10 @@ where
M: Send + Sync + Material<f32> + 'static
{
fn step_multiple<S: AbstractStimulus>(&mut self, num_steps: u32, s: &S) {
let vol = self.size().volume();
self.wgpu.get_or_insert_with(
|| Arc::new(WgpuData::new::<M>(vol))
);
self.step_spirv(num_steps, s);
self.step_no += num_steps as u64;
}