From ef96ce68e6834225e0981a47e271b6f132bd0289 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Capucho?= Date: Wed, 17 Mar 2021 18:48:31 +0000 Subject: [PATCH] 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 --- voxygen/src/render/renderer.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/voxygen/src/render/renderer.rs b/voxygen/src/render/renderer.rs index dc9a5a4549..8a209abdba 100644 --- a/voxygen/src/render/renderer.rs +++ b/voxygen/src/render/renderer.rs @@ -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)]