Fix winit returning wrong window size

It seems like waiting for wgpu to create a instance is enough to make
winit return the correct window size
This commit is contained in:
João Capucho 2021-03-17 18:48:31 +00:00 committed by Avi Weinstock
parent e40702c083
commit ef96ce68e6

View File

@ -130,14 +130,14 @@ impl Renderer {
// in doing this on rerender. // in doing this on rerender.
// Self::enable_seamless_cube_maps(&mut device); // Self::enable_seamless_cube_maps(&mut device);
let dims = window.inner_size();
// TODO: fix panic on wayland with opengl? // TODO: fix panic on wayland with opengl?
// TODO: fix backend defaulting to opengl on wayland. // TODO: fix backend defaulting to opengl on wayland.
let instance = wgpu::Instance::new( let instance = wgpu::Instance::new(
wgpu::BackendBit::PRIMARY, /* | wgpu::BackendBit::SECONDARY */ wgpu::BackendBit::PRIMARY, /* | wgpu::BackendBit::SECONDARY */
); );
let dims = window.inner_size();
// This is unsafe because the window handle must be valid, if you find a way to // This is unsafe because the window handle must be valid, if you find a way to
// have an invalid winit::Window then you have bigger issues // have an invalid winit::Window then you have bigger issues
#[allow(unsafe_code)] #[allow(unsafe_code)]