From 168091408efd8e889a665d695232f7949e57225a Mon Sep 17 00:00:00 2001 From: Quaternions Date: Thu, 19 Oct 2023 20:17:54 -0700 Subject: [PATCH] shrink pollster onto the only future in the code --- src/framework.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/framework.rs b/src/framework.rs index 1478256..cdd8906 100644 --- a/src/framework.rs +++ b/src/framework.rs @@ -47,7 +47,7 @@ struct Setup { queue: wgpu::Queue, } -async fn setup(title: &str) -> Setup { +fn setup(title: &str) -> Setup { let event_loop = EventLoop::new(); let mut builder = winit::window::WindowBuilder::new(); builder = builder.with_title(title); @@ -131,7 +131,7 @@ async fn setup(title: &str) -> Setup { let needed_limits = E::required_limits().using_resolution(adapter.limits()); let trace_dir = std::env::var("WGPU_TRACE"); - let (device, queue) = adapter + let (device, queue) = pollster::block_on(adapter .request_device( &wgpu::DeviceDescriptor { label: None, @@ -139,8 +139,7 @@ async fn setup(title: &str) -> Setup { limits: needed_limits, }, trace_dir.ok().as_ref().map(std::path::Path::new), - ) - .await + )) .expect("Unable to find a suitable GPU adapter!"); Setup { @@ -275,6 +274,6 @@ fn start( } pub fn run(title: &str) { - let setup = pollster::block_on(setup::(title)); + let setup = setup::(title); start::(setup); }