master
mitchellhansen 4 years ago
parent 36945597c5
commit f44f8201b9

@ -1,13 +1,10 @@
extern crate tobj; extern crate tobj;
extern crate winit; extern crate winit;
use std::{iter, mem, num::NonZeroU32, ops::Range, rc::Rc};
#[cfg(not(target_arch = "wasm32"))] #[cfg(not(target_arch = "wasm32"))]
use std::time::{Duration, Instant}; use std::time::{Duration, Instant};
use bytemuck::{Pod, Zeroable};
use futures::task::LocalSpawn; use futures::task::LocalSpawn;
use wgpu::util::DeviceExt;
use wgpu_subscriber; use wgpu_subscriber;
use winit::{ use winit::{
event::{self, WindowEvent}, event::{self, WindowEvent},
@ -87,7 +84,7 @@ pub enum ShaderStage {
queue: wgpu::Queue, queue: wgpu::Queue,
*/ */
fn main() { async fn main() {
// #[cfg(not(target_arch = "wasm32"))] // #[cfg(not(target_arch = "wasm32"))]
// { // {
@ -102,7 +99,7 @@ fn main() {
let event_loop = EventLoop::new(); let event_loop = EventLoop::new();
let mut builder = winit::window::WindowBuilder::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 // I don't know what they are doing here
#[cfg(windows_OFF)] // TODO #[cfg(windows_OFF)] // TODO
@ -122,23 +119,24 @@ fn main() {
let surface = instance.create_surface(&window); let surface = instance.create_surface(&window);
(size, surface) (size, surface)
}; };
let adapter = async {
let adapter = instance instance
.request_adapter(&wgpu::RequestAdapterOptions { .request_adapter(&wgpu::RequestAdapterOptions {
power_preference: wgpu::PowerPreference::HighPerformance, power_preference: wgpu::PowerPreference::HighPerformance,
compatible_surface: Some(&surface), compatible_surface: Some(&surface),
}) })
.unwrap(); .await
.unwrap();
};
let optional_features = Renderer::optional_features(); let optional_features = Renderer::optional_features();
let required_features = Renderer::required_features(); let required_features = Renderer::required_features();
let adapter_features = adapter.features(); let adapter_features = adapter.features();
assert!( // assert!(
adapter_features.contains(required_features), // adapter_features.contains(required_features),
"Adapter does not support required features for this example: {:?}", // "Adapter does not support required features for this example: {:?}",
required_features - adapter_features // required_features - adapter_features
); // );
let needed_limits = wgpu::Limits::default();//Renderer::required_limits(); let needed_limits = wgpu::Limits::default();//Renderer::required_limits();
@ -224,7 +222,7 @@ fn main() {
log::info!("Entering render loop..."); 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 // This is just an winit event loop

Loading…
Cancel
Save