tirbofish/dropbear · commit
7192219e7306a1b7f358ee10885094bcfd2142d5
fix: antialiasing hot swapping fix
Signature present but could not be verified.
Unverified
@@ -637,6 +637,23 @@ Hardware: ); } + pub fn set_antialiasing(&mut self, antialiasing: AntiAliasingMode) -> bool { + if *self.antialiasing.read() == antialiasing { + return false; + } + + *self.antialiasing.write() = antialiasing; + + let config = self.config.read().clone(); + self.depth_texture = + Texture::depth_texture(&config, &self.device, antialiasing, Some("depth texture")); + self.hdr + .write() + .resize(&self.device, config.width, config.height, Some(antialiasing)); + + true + } + /// Resizes the offscreen viewport texture without touching the window surface. pub fn resize_viewport_texture(&mut self, width: u32, height: u32) { if width == 0 || height == 0 { @@ -1443,6 +1460,13 @@ impl ApplicationHandler for App { scene::SceneCommand::SetFPS(new_fps) => { self.set_target_fps(new_fps); } + scene::SceneCommand::SetAntialiasing(antialiasing) => { + if let Some((state, graphics)) = self.windows.get_mut(&window_id) { + if state.set_antialiasing(antialiasing) { + *graphics = Arc::new(graphics::SharedGraphicsContext::from_state(state)); + } + } + } scene::SceneCommand::ResizeViewport((width, height)) => { if let Some((state, graphics)) = self.windows.get_mut(&window_id) { state.resize_viewport_texture(width, height); @@ -7,6 +7,7 @@ use winit::event_loop::ActiveEventLoop; use winit::window::WindowId; use crate::{WindowData, graphics::SharedGraphicsContext, input};
Large diffs are not rendered by default. Showing the first 50 of 326 lines. Show full diff