From f44f8201b963898ab425f90bd82c40672ecec3ff Mon Sep 17 00:00:00 2001 From: mitchellhansen Date: Sun, 31 Jan 2021 00:03:14 -0800 Subject: [PATCH] hacking --- src/main.rs | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/src/main.rs b/src/main.rs index 81bf574..1edbd99 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,13 +1,10 @@ extern crate tobj; extern crate winit; -use std::{iter, mem, num::NonZeroU32, ops::Range, rc::Rc}; + #[cfg(not(target_arch = "wasm32"))] use std::time::{Duration, Instant}; - -use bytemuck::{Pod, Zeroable}; use futures::task::LocalSpawn; -use wgpu::util::DeviceExt; use wgpu_subscriber; use winit::{ event::{self, WindowEvent}, @@ -87,7 +84,7 @@ pub enum ShaderStage { queue: wgpu::Queue, */ -fn main() { +async fn main() { // #[cfg(not(target_arch = "wasm32"))] // { @@ -102,7 +99,7 @@ fn main() { let event_loop = EventLoop::new(); let mut builder = winit::window::WindowBuilder::new(); - builder = builder.with_title(title); + builder = builder.with_title("title"); // I don't know what they are doing here #[cfg(windows_OFF)] // TODO @@ -122,23 +119,24 @@ fn main() { let surface = instance.create_surface(&window); (size, surface) }; - - let adapter = instance - .request_adapter(&wgpu::RequestAdapterOptions { - power_preference: wgpu::PowerPreference::HighPerformance, - compatible_surface: Some(&surface), - }) - .unwrap(); - + let adapter = async { + instance + .request_adapter(&wgpu::RequestAdapterOptions { + power_preference: wgpu::PowerPreference::HighPerformance, + compatible_surface: Some(&surface), + }) + .await + .unwrap(); + }; let optional_features = Renderer::optional_features(); let required_features = Renderer::required_features(); let adapter_features = adapter.features(); - assert!( - adapter_features.contains(required_features), - "Adapter does not support required features for this example: {:?}", - required_features - adapter_features - ); + // assert!( + // adapter_features.contains(required_features), + // "Adapter does not support required features for this example: {:?}", + // required_features - adapter_features + // ); let needed_limits = wgpu::Limits::default();//Renderer::required_limits(); @@ -224,7 +222,7 @@ fn main() { log::info!("Entering render loop..."); - let mut renderer = render::Renderer::init(&device, &sd_desc); + let mut renderer = render::Renderer::init(&device, &sc_desc); // This is just an winit event loop