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 71e2ee83aa
commit c683c35646

View File

@ -130,14 +130,14 @@ impl Renderer {
// in doing this on rerender.
// Self::enable_seamless_cube_maps(&mut device);
let dims = window.inner_size();
// TODO: fix panic on wayland with opengl?
// TODO: fix backend defaulting to opengl on wayland.
let instance = wgpu::Instance::new(
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
// have an invalid winit::Window then you have bigger issues
#[allow(unsafe_code)]