From b02f629bd356a276d1915167b34fe88352e47db9 Mon Sep 17 00:00:00 2001 From: Halbear Date: Sat, 5 Sep 2026 19:54:32 +0100 Subject: [PATCH 1/2] added a check for external overlays, anything like overwolf, OBS and the such will instantly crash the engine with error "ERROR wgpu_hal::vulkan::instance] GENERAL [Loader Message (0x0)] loader_get_json: Failed to open JSON file" so i've put a simple environment variable to skip external overlays in the vulkan initialisation --- src/render/mod.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/render/mod.rs b/src/render/mod.rs index 2687354..dafe901 100644 --- a/src/render/mod.rs +++ b/src/render/mod.rs @@ -880,13 +880,24 @@ impl Renderer { self.surface.configure(&self.device, &self.config); self.eye.resize(width, height); } + + pub fn set_skybox(&mut self, skybox: SimpleTexture) { self.eye.skybox(&self.device, skybox); } pub async fn new(window: &Arc) -> anyhow::Result { + static SKIP_EXTERNAL_OVERLAYS : bool = true; // use a config file or something to allow this to be toggled + let bounds = window.inner_size(); let width = bounds.width; let height = bounds.height; + + if(SKIP_EXTERNAL_OVERLAYS) { + unsafe { // currently will crash on most Windows systems because wGPU in its infinite + // wisdom tries to attach overlays from closed or non-existent programs + std::env::set_var("VK_LOADER_LAYERS_DISABLE", "~implicit~"); + } + } // The instance is a handle to our GPU // BackendBit::PRIMARY => Vulkan + Metal + DX12 + Browser WebGPU let instance = wgpu::Instance::new(wgpu::InstanceDescriptor { From 1519a1c065545323488965959e3c5271bdb3280a Mon Sep 17 00:00:00 2001 From: Halbear Date: Sat, 5 Sep 2026 20:21:15 +0100 Subject: [PATCH 2/2] prevents crashing when reconfiguring with an in use view/image/swapchain something, moved the configure event to after the image has been displayed and resources are released, thats all --- src/render/mod.rs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/render/mod.rs b/src/render/mod.rs index dafe901..68977e7 100644 --- a/src/render/mod.rs +++ b/src/render/mod.rs @@ -1176,10 +1176,13 @@ impl Renderer { } pub(crate) fn render(&mut self, window: &Arc) -> anyhow::Result<()> { window.request_redraw(); + + let mut resize_renderer = false; + let output = match self.surface.get_current_texture() { wgpu::CurrentSurfaceTexture::Success(surface_texture) => surface_texture, wgpu::CurrentSurfaceTexture::Suboptimal(surface_texture) => { - self.surface.configure(&self.device, &self.config); + resize_renderer = true; //moved reconfigure to avoid a crash when resizing window surface_texture } wgpu::CurrentSurfaceTexture::Timeout @@ -1257,6 +1260,21 @@ impl Renderer { output.present(); + + if(resize_renderer){ + std::mem::drop(view); //idk how this would affect a multi-pass system like deferred rendering, but this makes sure it's not gonna collide with resizing the swap chain or whatever wGPU does + self.surface.configure(&self.device, &self.config); + /* + also in this snippet call the functions to + a: resize window resolution + b: resize projection + currently when you resize the window the projection matrix is not updated + and therefore it gets very skewed and weird looking if you resize the current + small window to a big screen like mine(halbear) which is 3440x1440 + i would add it myself but i don't know wGPU or rust all that well sooooo + */ + } + Ok(()) } }