|
|
|
@ -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
|
|
|
|
|
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
|
|
|
|
|