cleanup crimes
parent
5a18a63928
commit
b281836261
|
@ -65,7 +65,7 @@ impl<WT: 'static + Send + Sync> Instance<WT> {
|
|||
];
|
||||
|
||||
|
||||
let mut vulkanOpt: Option<Arc<vi::Instance>> = None;
|
||||
let mut vulkan_opt: Option<Arc<vi::Instance>> = None;
|
||||
for pref in layer_preferences {
|
||||
match vi::Instance::new(Some(&ai), &exts, pref.iter().cloned()) {
|
||||
Ok(res) => {
|
||||
|
@ -73,7 +73,7 @@ impl<WT: 'static + Send + Sync> Instance<WT> {
|
|||
if pref.len() == 0 {
|
||||
log::warn!("Did not load validation layers.");
|
||||
}
|
||||
vulkanOpt = Some(res);
|
||||
vulkan_opt = Some(res);
|
||||
}
|
||||
Err(err) => {
|
||||
log::warn!("Could not create vulkan instance with layers {}: {}", pref.join(", "), err);
|
||||
|
@ -81,7 +81,7 @@ impl<WT: 'static + Send + Sync> Instance<WT> {
|
|||
}
|
||||
};
|
||||
|
||||
let vulkan = vulkanOpt.expect("could not create a vulkan instance");
|
||||
let vulkan = vulkan_opt.expect("could not create a vulkan instance");
|
||||
let debug_callback = Self::init_debug_callback(&vulkan);
|
||||
|
||||
let workers = (0..4).map(|n| {
|
||||
|
@ -173,12 +173,7 @@ impl<WT: 'static + Send + Sync> Instance<WT> {
|
|||
w.render(device.clone(), queue.clone(), rp.clone(), pipeline.clone(), view.clone(), proj.clone(), c.to_vec())
|
||||
});
|
||||
|
||||
let start = time::Instant::now();
|
||||
let res = futures.map(|r| { r.recv().unwrap() }).collect();
|
||||
let took = time::Instant::now().duration_since(start);
|
||||
//log::info!("took {:?}", took);
|
||||
|
||||
res
|
||||
futures.map(|r| { r.recv().unwrap() }).collect()
|
||||
}
|
||||
|
||||
// (╯°□°)╯︵ ┻━┻
|
||||
|
|
|
@ -3,7 +3,6 @@ use log;
|
|||
use std::sync::Arc;
|
||||
use std::sync::mpsc;
|
||||
use std::thread;
|
||||
use std::time;
|
||||
|
||||
use cgmath as cgm;
|
||||
use vulkano::command_buffer as vc;
|
||||
|
@ -33,7 +32,7 @@ struct CommandRender {
|
|||
}
|
||||
|
||||
pub struct Worker {
|
||||
handle: thread::JoinHandle<()>,
|
||||
handle: Option<thread::JoinHandle<()>>,
|
||||
control: mpsc::Sender<Command>,
|
||||
}
|
||||
|
||||
|
@ -71,7 +70,8 @@ impl Worker {
|
|||
});
|
||||
|
||||
Worker {
|
||||
handle, control
|
||||
handle: Some(handle),
|
||||
control
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,6 @@ impl Worker {
|
|||
let mut builder = vc::AutoCommandBufferBuilder::secondary_graphics_one_time_submit(
|
||||
r.device, qf, vf::Subpass::from(r.render_pass, 0).unwrap()).unwrap();
|
||||
|
||||
let start = time::Instant::now();
|
||||
for d in r.data {
|
||||
let ubo = data::UniformBufferObject {
|
||||
model: r.matrix_p.clone() * r.matrix_v.clone() * d.get_transform(),
|
||||
|
@ -93,8 +92,6 @@ impl Worker {
|
|||
(),
|
||||
ubo).unwrap();
|
||||
}
|
||||
let took = time::Instant::now().duration_since(start);
|
||||
//log::info!("worker loop took {:?}", took);
|
||||
|
||||
let buffer = builder.build().unwrap();
|
||||
r.result.send(Box::new(buffer)).unwrap();
|
||||
|
@ -129,6 +126,6 @@ impl Worker {
|
|||
impl Drop for Worker {
|
||||
fn drop(&mut self) {
|
||||
self.control.send(Command::Exit).unwrap();
|
||||
//self.handle.join().unwrap();
|
||||
self.handle.take().unwrap().join().unwrap();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue