Compare commits

..

No commits in common. '202012b76d047216c9e5f7d9a94e652695e62b68' and '6325590051299d6c8f37c3adbca3cd68c3e72186' have entirely different histories.

@ -13,7 +13,7 @@ pub fn run() {
cfg_if::cfg_if! {
if #[cfg(target_arch = "wasm32")] {
std::panic::set_hook(Box::new(console_error_panic_hook::hook));
console_log::init_with_level(log::Level::Debug).expect("Couldn't initialize logger");
console_log::init_with_level(log::Level::Warn).expect("Couldn't initialize logger");
} else {
env_logger::init();
}
@ -27,7 +27,7 @@ pub fn run() {
// Winit prevents sizing with CSS, so we have to set
// the size manually when on web.
use winit::dpi::PhysicalSize;
let _ = window.request_inner_size(PhysicalSize::new(450, 400));
window.request_inner_size(PhysicalSize::new(450, 400)).unwrap();
use winit::platform::web::WindowExtWebSys;
web_sys::window()
@ -43,9 +43,6 @@ pub fn run() {
event_loop
.run(move |event, control_flow| match event {
Event::Resumed => {
log::debug!("Resumed");
}
Event::WindowEvent {
ref event,
window_id,

@ -28,7 +28,7 @@ impl<'a> State<'a> {
// The instance is a handle to our GPU
// BackendBit::PRIMARY => Vulkan + Metal + DX12 + Browser WebGPU
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
backends: wgpu::Backends::PRIMARY,
backends: wgpu::Backends::all(),
..Default::default()
});
@ -85,6 +85,7 @@ impl<'a> State<'a> {
desired_maximum_frame_latency: 2,
view_formats: vec![],
};
surface.configure(&device, &config);
let clear_color = wgpu::Color::BLACK;

@ -29,7 +29,7 @@ impl<'a> State<'a> {
// The instance is a handle to our GPU
// BackendBit::PRIMARY => Vulkan + Metal + DX12 + Browser WebGPU
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
backends: wgpu::Backends::PRIMARY,
backends: wgpu::Backends::all(),
..Default::default()
});
@ -83,6 +83,7 @@ impl<'a> State<'a> {
desired_maximum_frame_latency: 2,
view_formats: vec![],
};
surface.configure(&device, &config);
Self {
surface,
@ -160,7 +161,7 @@ pub async fn run() {
cfg_if::cfg_if! {
if #[cfg(target_arch = "wasm32")] {
std::panic::set_hook(Box::new(console_error_panic_hook::hook));
console_log::init_with_level(log::Level::Info).expect("Couldn't initialize logger");
console_log::init_with_level(log::Level::Warn).expect("Couldn't initialize logger");
} else {
env_logger::init();
}
@ -174,6 +175,7 @@ pub async fn run() {
// Winit prevents sizing with CSS, so we have to set
// the size manually when on web.
use winit::dpi::PhysicalSize;
//window.request_inner_size(PhysicalSize::new(450, 400)).unwrap();
use winit::platform::web::WindowExtWebSys;
web_sys::window()
@ -185,8 +187,6 @@ pub async fn run() {
Some(())
})
.expect("Couldn't append canvas to document body.");
let _ = window.request_inner_size(PhysicalSize::new(450, 400));
}
// State::new uses async code, so we're going to wait for it to finish
@ -213,7 +213,6 @@ pub async fn run() {
..
} => control_flow.exit(),
WindowEvent::Resized(physical_size) => {
log::info!("physical_size: {physical_size:?}");
state.resize(*physical_size);
}
WindowEvent::RedrawRequested => {

@ -26,7 +26,7 @@ impl<'a> State<'a> {
// The instance is a handle to our GPU
// BackendBit::PRIMARY => Vulkan + Metal + DX12 + Browser WebGPU
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
backends: wgpu::Backends::PRIMARY,
backends: wgpu::Backends::all(),
..Default::default()
});
@ -79,6 +79,7 @@ impl<'a> State<'a> {
view_formats: vec![],
desired_maximum_frame_latency: 2,
};
surface.configure(&device, &config);
let shader = device.create_shader_module(wgpu::ShaderModuleDescriptor {
label: Some("Shader"),

@ -28,7 +28,7 @@ impl<'a> State<'a> {
// The instance is a handle to our GPU
// BackendBit::PRIMARY => Vulkan + Metal + DX12 + Browser WebGPU
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
backends: wgpu::Backends::PRIMARY,
backends: wgpu::Backends::all(),
..Default::default()
});
@ -81,6 +81,7 @@ impl<'a> State<'a> {
view_formats: vec![],
desired_maximum_frame_latency: 2,
};
surface.configure(&device, &config);
let shader = device.create_shader_module(wgpu::ShaderModuleDescriptor {
label: Some("Shader"),
@ -232,7 +233,7 @@ pub async fn run() {
// Winit prevents sizing with CSS, so we have to set
// the size manually when on web.
use winit::dpi::PhysicalSize;
let _ = window.request_inner_size(PhysicalSize::new(450, 400));
window.request_inner_size(PhysicalSize::new(450, 400)).unwrap();
use winit::platform::web::WindowExtWebSys;
web_sys::window()

@ -89,7 +89,7 @@ impl<'a> State<'a> {
// The instance is a handle to our GPU
// BackendBit::PRIMARY => Vulkan + Metal + DX12 + Browser WebGPU
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
backends: wgpu::Backends::PRIMARY,
backends: wgpu::Backends::all(),
..Default::default()
});
@ -146,6 +146,7 @@ impl<'a> State<'a> {
view_formats: vec![],
desired_maximum_frame_latency: 2,
};
surface.configure(&device, &config);
let shader = device.create_shader_module(wgpu::ShaderModuleDescriptor {
label: Some("Shader"),

@ -85,7 +85,7 @@ impl<'a> State<'a> {
// The instance is a handle to our GPU
// BackendBit::PRIMARY => Vulkan + Metal + DX12 + Browser WebGPU
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
backends: wgpu::Backends::PRIMARY,
backends: wgpu::Backends::all(),
..Default::default()
});
@ -142,6 +142,7 @@ impl<'a> State<'a> {
view_formats: vec![],
desired_maximum_frame_latency: 2,
};
surface.configure(&device, &config);
let shader = device.create_shader_module(wgpu::ShaderModuleDescriptor {
label: Some("Shader"),
@ -310,7 +311,7 @@ pub async fn run() {
// Winit prevents sizing with CSS, so we have to set
// the size manually when on web.
use winit::dpi::PhysicalSize;
let _ = window.request_inner_size(PhysicalSize::new(450, 400));
window.request_inner_size(PhysicalSize::new(450, 400)).unwrap();
use winit::platform::web::WindowExtWebSys;
web_sys::window()

@ -91,7 +91,7 @@ impl<'a> State<'a> {
// The instance is a handle to our GPU
// BackendBit::PRIMARY => Vulkan + Metal + DX12 + Browser WebGPU
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
backends: wgpu::Backends::PRIMARY,
backends: wgpu::Backends::all(),
..Default::default()
});
@ -147,6 +147,7 @@ impl<'a> State<'a> {
view_formats: vec![],
desired_maximum_frame_latency: 2,
};
surface.configure(&device, &config);
let texture_bind_group_layout =
device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {

@ -91,7 +91,7 @@ impl<'a> State<'a> {
// The instance is a handle to our GPU
// BackendBit::PRIMARY => Vulkan + Metal + DX12 + Browser WebGPU
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
backends: wgpu::Backends::PRIMARY,
backends: wgpu::Backends::all(),
..Default::default()
});
@ -143,6 +143,7 @@ impl<'a> State<'a> {
view_formats: vec![],
desired_maximum_frame_latency: 2,
};
surface.configure(&device, &config);
let diffuse_bytes = include_bytes!("happy-tree.png");
let diffuse_texture =
@ -356,7 +357,7 @@ pub async fn run() {
// Winit prevents sizing with CSS, so we have to set
// the size manually when on web.
use winit::dpi::PhysicalSize;
let _ = window.request_inner_size(PhysicalSize::new(450, 400));
window.request_inner_size(PhysicalSize::new(450, 400)).unwrap();
use winit::platform::web::WindowExtWebSys;
web_sys::window()

@ -241,7 +241,7 @@ impl<'a> State<'a> {
// The instance is a handle to our GPU
// BackendBit::PRIMARY => Vulkan + Metal + DX12 + Browser WebGPU
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
backends: wgpu::Backends::PRIMARY,
backends: wgpu::Backends::all(),
..Default::default()
});
@ -293,6 +293,7 @@ impl<'a> State<'a> {
view_formats: vec![],
desired_maximum_frame_latency: 2,
};
surface.configure(&device, &config);
let diffuse_bytes = include_bytes!("happy-tree.png");
let diffuse_texture =

@ -241,7 +241,7 @@ impl<'a> State<'a> {
// The instance is a handle to our GPU
// BackendBit::PRIMARY => Vulkan + Metal + DX12 + Browser WebGPU
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
backends: wgpu::Backends::PRIMARY,
backends: wgpu::Backends::all(),
..Default::default()
});
@ -293,6 +293,7 @@ impl<'a> State<'a> {
view_formats: vec![],
desired_maximum_frame_latency: 2,
};
surface.configure(&device, &config);
let diffuse_bytes = include_bytes!("happy-tree.png");
let diffuse_texture =
@ -565,7 +566,7 @@ pub async fn run() {
// Winit prevents sizing with CSS, so we have to set
// the size manually when on web.
use winit::dpi::PhysicalSize;
let _ = window.request_inner_size(PhysicalSize::new(450, 400));
window.request_inner_size(PhysicalSize::new(450, 400)).unwrap();
use winit::platform::web::WindowExtWebSys;
web_sys::window()

@ -295,7 +295,7 @@ impl<'a> State<'a> {
// The instance is a handle to our GPU
// BackendBit::PRIMARY => Vulkan + Metal + DX12 + Browser WebGPU
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
backends: wgpu::Backends::PRIMARY,
backends: wgpu::Backends::all(),
..Default::default()
});
@ -347,6 +347,7 @@ impl<'a> State<'a> {
view_formats: vec![],
desired_maximum_frame_latency: 2,
};
surface.configure(&device, &config);
let diffuse_bytes = include_bytes!("happy-tree.png");
let diffuse_texture =

@ -302,7 +302,7 @@ impl<'a> State<'a> {
// The instance is a handle to our GPU
// BackendBit::PRIMARY => Vulkan + Metal + DX12 + Browser WebGPU
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
backends: wgpu::Backends::PRIMARY,
backends: wgpu::Backends::all(),
..Default::default()
});
@ -354,6 +354,7 @@ impl<'a> State<'a> {
view_formats: vec![],
desired_maximum_frame_latency: 2,
};
surface.configure(&device, &config);
let diffuse_bytes = include_bytes!("happy-tree.png");
let diffuse_texture =
@ -663,7 +664,7 @@ pub async fn run() {
// Winit prevents sizing with CSS, so we have to set
// the size manually when on web.
use winit::dpi::PhysicalSize;
let _ = window.request_inner_size(PhysicalSize::new(450, 400));
window.request_inner_size(PhysicalSize::new(450, 400)).unwrap();
use winit::platform::web::WindowExtWebSys;
web_sys::window()

@ -494,7 +494,7 @@ impl<'a> State<'a> {
// The instance is a handle to our GPU
// BackendBit::PRIMARY => Vulkan + Metal + DX12 + Browser WebGPU
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
backends: wgpu::Backends::PRIMARY,
backends: wgpu::Backends::all(),
..Default::default()
});
@ -546,6 +546,7 @@ impl<'a> State<'a> {
view_formats: vec![],
desired_maximum_frame_latency: 2,
};
surface.configure(&device, &config);
let diffuse_bytes = include_bytes!("happy-tree.png");
let diffuse_texture =

@ -312,7 +312,7 @@ impl<'a> State<'a> {
// The instance is a handle to our GPU
// BackendBit::PRIMARY => Vulkan + Metal + DX12 + Browser WebGPU
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
backends: wgpu::Backends::PRIMARY,
backends: wgpu::Backends::all(),
..Default::default()
});
@ -364,6 +364,7 @@ impl<'a> State<'a> {
view_formats: vec![],
desired_maximum_frame_latency: 2,
};
surface.configure(&device, &config);
let diffuse_bytes = include_bytes!("happy-tree.png");
let diffuse_texture =
@ -690,7 +691,7 @@ pub async fn run() {
// Winit prevents sizing with CSS, so we have to set
// the size manually when on web.
use winit::dpi::PhysicalSize;
let _ = window.request_inner_size(PhysicalSize::new(450, 400));
window.request_inner_size(PhysicalSize::new(450, 400)).unwrap();
use winit::platform::web::WindowExtWebSys;
web_sys::window()

@ -252,10 +252,7 @@ impl<'a> State<'a> {
// BackendBit::PRIMARY => Vulkan + Metal + DX12 + Browser WebGPU
log::warn!("WGPU setup");
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
#[cfg(not(target_arch="wasm32"))]
backends: wgpu::Backends::PRIMARY,
#[cfg(target_arch="wasm32")]
backends: wgpu::Backends::GL,
backends: wgpu::Backends::all(),
..Default::default()
});
@ -311,6 +308,7 @@ impl<'a> State<'a> {
desired_maximum_frame_latency: 2,
};
surface.configure(&device, &config);
let texture_bind_group_layout =
device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
@ -590,7 +588,7 @@ pub async fn run() {
cfg_if::cfg_if! {
if #[cfg(target_arch = "wasm32")] {
std::panic::set_hook(Box::new(console_error_panic_hook::hook));
console_log::init_with_level(log::Level::Info).expect("Could't initialize logger");
console_log::init_with_level(log::Level::Warn).expect("Could't initialize logger");
} else {
env_logger::init();
}
@ -608,7 +606,7 @@ pub async fn run() {
// Winit prevents sizing with CSS, so we have to set
// the size manually when on web.
use winit::dpi::PhysicalSize;
let _ = window.request_inner_size(PhysicalSize::new(450, 400));
window.request_inner_size(PhysicalSize::new(450, 400)).unwrap();
use winit::platform::web::WindowExtWebSys;
web_sys::window()

@ -122,6 +122,7 @@ where
camera_bind_group: &'b wgpu::BindGroup,
) {
for mesh in &model.meshes {
log::warn!("materials: {}", model.materials.len());
let material = &model.materials[mesh.material];
self.draw_mesh_instanced(mesh, material, instances.clone(), camera_bind_group);
}

@ -144,7 +144,6 @@ pub async fn load_model(
usage: wgpu::BufferUsages::INDEX,
});
log::info!("{}", m.name);
model::Mesh {
name: file_name.to_string(),
vertex_buffer,

@ -16,8 +16,8 @@ impl Texture {
label: &str,
) -> Self {
let size = wgpu::Extent3d {
width: config.width.max(1),
height: config.height.max(1),
width: config.width,
height: config.height,
depth_or_array_layers: 1,
};
let desc = wgpu::TextureDescriptor {

@ -347,7 +347,7 @@ impl<'a> State<'a> {
// The instance is a handle to our GPU
// BackendBit::PRIMARY => Vulkan + Metal + DX12 + Browser WebGPU
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
backends: wgpu::Backends::PRIMARY,
backends: wgpu::Backends::all(),
..Default::default()
});
@ -400,6 +400,7 @@ impl<'a> State<'a> {
desired_maximum_frame_latency: 2,
};
surface.configure(&device, &config);
let texture_bind_group_layout =
device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
@ -742,7 +743,7 @@ pub async fn run() {
// Winit prevents sizing with CSS, so we have to set
// the size manually when on web.
use winit::dpi::PhysicalSize;
let _ = window.request_inner_size(PhysicalSize::new(450, 400));
window.request_inner_size(PhysicalSize::new(450, 400)).unwrap();
use winit::platform::web::WindowExtWebSys;
web_sys::window()

@ -347,7 +347,7 @@ impl<'a> State<'a> {
// The instance is a handle to our GPU
// BackendBit::PRIMARY => Vulkan + Metal + DX12 + Browser WebGPU
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
backends: wgpu::Backends::PRIMARY,
backends: wgpu::Backends::all(),
..Default::default()
});
@ -400,6 +400,7 @@ impl<'a> State<'a> {
desired_maximum_frame_latency: 2,
};
surface.configure(&device, &config);
let texture_bind_group_layout =
device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
@ -793,7 +794,7 @@ pub async fn run() {
// Winit prevents sizing with CSS, so we have to set
// the size manually when on web.
use winit::dpi::PhysicalSize;
let _ = window.request_inner_size(PhysicalSize::new(450, 400));
window.request_inner_size(PhysicalSize::new(450, 400)).unwrap();
use winit::platform::web::WindowExtWebSys;
web_sys::window()

@ -227,7 +227,7 @@ impl<'a> State<'a> {
// The instance is a handle to our GPU
// BackendBit::PRIMARY => Vulkan + Metal + DX12 + Browser WebGPU
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
backends: wgpu::Backends::PRIMARY,
backends: wgpu::Backends::all(),
..Default::default()
});
@ -280,6 +280,7 @@ impl<'a> State<'a> {
desired_maximum_frame_latency: 2,
};
surface.configure(&device, &config);
let texture_bind_group_layout =
device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
@ -696,7 +697,7 @@ pub async fn run() {
// Winit prevents sizing with CSS, so we have to set
// the size manually when on web.
use winit::dpi::PhysicalSize;
let _ = window.request_inner_size(PhysicalSize::new(450, 400));
window.request_inner_size(PhysicalSize::new(450, 400)).unwrap();
use winit::platform::web::WindowExtWebSys;
web_sys::window()

@ -250,7 +250,7 @@ impl<'a> State<'a> {
#[cfg(target_arch = "wasm32")]
backends: wgpu::Backends::BROWSER_WEBGPU,
#[cfg(not(target_arch = "wasm32"))]
backends: wgpu::Backends::PRIMARY,
backends: wgpu::Backends::all(),
..Default::default()
});
@ -299,6 +299,7 @@ impl<'a> State<'a> {
desired_maximum_frame_latency: 2,
};
surface.configure(&device, &config);
let texture_bind_group_layout =
device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
@ -826,7 +827,7 @@ pub async fn run() {
// Winit prevents sizing with CSS, so we have to set
// the size manually when on web.
use winit::dpi::PhysicalSize;
let _ = window.request_inner_size(PhysicalSize::new(450, 400));
window.request_inner_size(PhysicalSize::new(450, 400)).unwrap();
use winit::platform::web::WindowExtWebSys;
web_sys::window()

@ -228,7 +228,7 @@ impl<'a> State<'a> {
// The instance is a handle to our GPU
// BackendBit::PRIMARY => Vulkan + Metal + DX12 + Browser WebGPU
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
backends: wgpu::Backends::PRIMARY,
backends: wgpu::Backends::all(),
..Default::default()
});
@ -281,6 +281,7 @@ impl<'a> State<'a> {
desired_maximum_frame_latency: 2,
};
surface.configure(&device, &config);
let texture_bind_group_layout =
device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
@ -746,7 +747,7 @@ pub async fn run() {
// Winit prevents sizing with CSS, so we have to set
// the size manually when on web.
use winit::dpi::PhysicalSize;
let _ = window.request_inner_size(PhysicalSize::new(450, 400));
window.request_inner_size(PhysicalSize::new(450, 400)).unwrap();
use winit::platform::web::WindowExtWebSys;
web_sys::window()

@ -166,7 +166,7 @@ impl<'a> State<'a> {
// The instance is a handle to our GPU
// BackendBit::PRIMARY => Vulkan + Metal + DX12 + Browser WebGPU
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
backends: wgpu::Backends::PRIMARY,
backends: wgpu::Backends::all(),
..Default::default()
});
@ -219,6 +219,7 @@ impl<'a> State<'a> {
desired_maximum_frame_latency: 2,
};
surface.configure(&device, &config);
let texture_bind_group_layout =
device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {

@ -36,7 +36,7 @@ impl<'a> Display<'a> {
pub async fn new(window: &'a Window) -> Result<Display<'a>, Error> {
let size = window.inner_size();
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
backends: wgpu::Backends::PRIMARY,
backends: wgpu::Backends::all(),
..Default::default()
});
let surface = instance.create_surface(window).unwrap();
@ -85,6 +85,7 @@ impl<'a> Display<'a> {
view_formats: vec![],
desired_maximum_frame_latency: 2,
};
surface.configure(&device, &config);
Ok(Self {
surface,

@ -232,7 +232,7 @@ impl<'a> State<'a> {
// The instance is a handle to our GPU
// BackendBit::PRIMARY => Vulkan + Metal + DX12 + Browser WebGPU
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
backends: wgpu::Backends::PRIMARY,
backends: wgpu::Backends::all(),
..Default::default()
});
@ -285,6 +285,7 @@ impl<'a> State<'a> {
desired_maximum_frame_latency: 2,
};
surface.configure(&device, &config);
let texture_bind_group_layout =
device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
@ -742,7 +743,7 @@ pub async fn run() {
// Winit prevents sizing with CSS, so we have to set
// the size manually when on web.
use winit::dpi::PhysicalSize;
let _ = window.request_inner_size(PhysicalSize::new(450, 400));
window.request_inner_size(PhysicalSize::new(450, 400)).unwrap();
use winit::platform::web::WindowExtWebSys;
web_sys::window()

@ -41,7 +41,7 @@ impl<'a> Render<'a> {
// The instance is a handle to our GPU
// BackendBit::PRIMARY => Vulkan + Metal + DX12 + Browser WebGPU
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
backends: wgpu::Backends::PRIMARY,
backends: wgpu::Backends::all(),
..Default::default()
});
@ -87,6 +87,7 @@ impl<'a> Render<'a> {
view_formats: vec![],
desired_maximum_frame_latency: 2,
};
surface.configure(&device, &config);
let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
bind_group_layouts: &[],

@ -226,7 +226,7 @@ impl<'a> State<'a> {
// The instance is a handle to our GPU
// BackendBit::PRIMARY => Vulkan + Metal + DX12 + Browser WebGPU
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
backends: wgpu::Backends::PRIMARY,
backends: wgpu::Backends::all(),
..Default::default()
});
@ -279,6 +279,7 @@ impl<'a> State<'a> {
view_formats: vec![],
};
surface.configure(&device, &config);
let texture_bind_group_layout =
device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
@ -703,7 +704,7 @@ pub async fn run() {
// Winit prevents sizing with CSS, so we have to set
// the size manually when on web.
use winit::dpi::PhysicalSize;
let _ = window.request_inner_size(PhysicalSize::new(450, 400));
window.request_inner_size(PhysicalSize::new(450, 400)).unwrap();
use winit::platform::web::WindowExtWebSys;
web_sys::window()

@ -181,7 +181,7 @@ Next, after we create our event loop and window, we need to add a canvas to the
// Winit prevents sizing with CSS, so we have to set
// the size manually when on web.
use winit::dpi::PhysicalSize;
let _ = window.request_inner_size(PhysicalSize::new(450, 400));
window.request_inner_size(PhysicalSize::new(450, 400)).unwrap();
use winit::platform::web::WindowExtWebSys;
web_sys::window()

@ -61,7 +61,7 @@ impl<'a> State<'a> {
// The instance is a handle to our GPU
// Backends::all => Vulkan + Metal + DX12 + Browser WebGPU
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
backends: wgpu::Backends::PRIMARY,
backends: wgpu::Backends::all(),
..Default::default()
});
@ -175,6 +175,7 @@ The `limits` field describes the limit of certain types of resources that we can
view_formats: vec![],
desired_maximum_frame_latency: 2,
};
surface.configure(&device, &config);
```
Here we are defining a config for our surface. This will define how the surface creates its underlying `SurfaceTexture`s. We will talk about `SurfaceTexture` when we get to the `render` function. For now, let's talk about the config's fields.

Loading…
Cancel
Save