From f8320c9df59c6fcdadefab2332139a906791c834 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Thu, 19 Oct 2023 20:02:40 -0700 Subject: [PATCH] why did they do it like that --- src/framework.rs | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/src/framework.rs b/src/framework.rs index 1d0a985..8eeacaf 100644 --- a/src/framework.rs +++ b/src/framework.rs @@ -138,26 +138,23 @@ async fn setup(title: &str) -> Setup { backends, dx12_shader_compiler, }); - let (size, surface) = unsafe { - let size = window.inner_size(); - #[cfg(any(not(target_arch = "wasm32"), target_os = "emscripten"))] - let surface = instance.create_surface(&window).unwrap(); - #[cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))] - let surface = { - if let Some(offscreen_canvas_setup) = &offscreen_canvas_setup { - log::info!("Creating surface from OffscreenCanvas"); - instance.create_surface_from_offscreen_canvas( - offscreen_canvas_setup.offscreen_canvas.clone(), - ) - } else { - instance.create_surface(&window) - } + let size = window.inner_size(); + + #[cfg(any(not(target_arch = "wasm32"), target_os = "emscripten"))] + let surface=unsafe{instance.create_surface(&window)}.unwrap(); + #[cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))] + let surface={ + if let Some(offscreen_canvas_setup) = &offscreen_canvas_setup { + log::info!("Creating surface from OffscreenCanvas"); + instance.create_surface_from_offscreen_canvas( + offscreen_canvas_setup.offscreen_canvas.clone(), + ) + } else { + instance.create_surface(&window) } - .unwrap(); - - (size, surface) - }; + } + .unwrap(); let adapter;