From bb61be202e79582d7e213411429e3a16e4f1ac76 Mon Sep 17 00:00:00 2001 From: rustbasic <127506429+rustbasic@users.noreply.github.com> Date: Sun, 1 Sep 2024 00:30:37 +0900 Subject: [PATCH 1/5] Update shadow.rs --- crates/epaint/src/shadow.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/epaint/src/shadow.rs b/crates/epaint/src/shadow.rs index ea6454f99cf..bb386d21dc7 100644 --- a/crates/epaint/src/shadow.rs +++ b/crates/epaint/src/shadow.rs @@ -11,7 +11,7 @@ pub struct Shadow { /// Move the shadow by this much. /// /// For instance, a value of `[1.0, 2.0]` will move the shadow 1 point to the right and 2 points down, - /// causing a drop-shadow effet. + /// causing a drop-shadow effect. pub offset: Vec2, /// The width of the blur, i.e. the width of the fuzzy penumbra. From c851a3a2d6ecdf1a04f5803d1e5f297904da3d91 Mon Sep 17 00:00:00 2001 From: rustbasic <127506429+rustbasic@users.noreply.github.com> Date: Sun, 1 Sep 2024 00:32:05 +0900 Subject: [PATCH 2/5] Update wgpu_integration.rs --- crates/eframe/src/native/wgpu_integration.rs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/crates/eframe/src/native/wgpu_integration.rs b/crates/eframe/src/native/wgpu_integration.rs index 9cbd9675e9c..d4d2977da61 100644 --- a/crates/eframe/src/native/wgpu_integration.rs +++ b/crates/eframe/src/native/wgpu_integration.rs @@ -704,11 +704,6 @@ impl WgpuWinitRunning { viewport_from_window, ); - // Prune dead viewports: - viewports.retain(|id, _| active_viewports_ids.contains(id)); - viewport_from_window.retain(|_, id| active_viewports_ids.contains(id)); - painter.gc_viewports(&active_viewports_ids); - let window = viewport_from_window .get(&window_id) .and_then(|id| viewports.get(id)) From 917ff382c75f822e20acbc02039874f505b0aa71 Mon Sep 17 00:00:00 2001 From: rustbasic <127506429+rustbasic@users.noreply.github.com> Date: Sun, 1 Sep 2024 00:39:26 +0900 Subject: [PATCH 3/5] Update wgpu_integration.rs --- crates/eframe/src/native/wgpu_integration.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/crates/eframe/src/native/wgpu_integration.rs b/crates/eframe/src/native/wgpu_integration.rs index d4d2977da61..2ea167d3ea8 100644 --- a/crates/eframe/src/native/wgpu_integration.rs +++ b/crates/eframe/src/native/wgpu_integration.rs @@ -694,8 +694,6 @@ impl WgpuWinitRunning { integration.post_rendering(window); - let active_viewports_ids: ViewportIdSet = viewport_output.keys().copied().collect(); - handle_viewport_output( &integration.egui_ctx, &viewport_output, From f9f7dcef1888040ced9167b2711210ad0f3497bd Mon Sep 17 00:00:00 2001 From: rustbasic <127506429+rustbasic@users.noreply.github.com> Date: Sun, 1 Sep 2024 01:17:20 +0900 Subject: [PATCH 4/5] Update glow_integration.rs --- crates/eframe/src/native/glow_integration.rs | 43 +------------------- 1 file changed, 2 insertions(+), 41 deletions(-) diff --git a/crates/eframe/src/native/glow_integration.rs b/crates/eframe/src/native/glow_integration.rs index 599420e597d..a8e1f3ea848 100644 --- a/crates/eframe/src/native/glow_integration.rs +++ b/crates/eframe/src/native/glow_integration.rs @@ -552,44 +552,6 @@ impl GlowWinitRunning { (raw_input, viewport_ui_cb) }; - let clear_color = self - .app - .clear_color(&self.integration.egui_ctx.style().visuals); - - let has_many_viewports = self.glutin.borrow().viewports.len() > 1; - let clear_before_update = !has_many_viewports; // HACK: for some reason, an early clear doesn't "take" on Mac with multiple viewports. - - if clear_before_update { - // clear before we call update, so users can paint between clear-color and egui windows: - - let mut glutin = self.glutin.borrow_mut(); - let GlutinWindowContext { - viewports, - current_gl_context, - not_current_gl_context, - .. - } = &mut *glutin; - let viewport = &viewports[&viewport_id]; - let Some(window) = viewport.window.as_ref() else { - return Ok(EventResult::Wait); - }; - let Some(gl_surface) = viewport.gl_surface.as_ref() else { - return Ok(EventResult::Wait); - }; - - let screen_size_in_pixels: [u32; 2] = window.inner_size().into(); - - { - frame_timer.pause(); - change_gl_context(current_gl_context, not_current_gl_context, gl_surface); - frame_timer.resume(); - } - - self.painter - .borrow() - .clear(screen_size_in_pixels, clear_color); - } - // ------------------------------------------------------------ // The update function, which could call immediate viewports, // so make sure we don't hold any locks here required by the immediate viewports rendeer. @@ -649,10 +611,9 @@ impl GlowWinitRunning { } let screen_size_in_pixels: [u32; 2] = window.inner_size().into(); + let clear_color = app.clear_color(&integration.egui_ctx.style().visuals); - if !clear_before_update { - painter.clear(screen_size_in_pixels, clear_color); - } + painter.clear(screen_size_in_pixels, clear_color); painter.paint_and_update_textures( screen_size_in_pixels, From 0bbb59a9a34fe4621f7d99467c992274f6016255 Mon Sep 17 00:00:00 2001 From: rustbasic <127506429+rustbasic@users.noreply.github.com> Date: Sun, 1 Sep 2024 17:42:11 +0900 Subject: [PATCH 5/5] Update glow_integration.rs --- crates/eframe/src/native/glow_integration.rs | 43 +++++++++++++++++++- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/crates/eframe/src/native/glow_integration.rs b/crates/eframe/src/native/glow_integration.rs index a8e1f3ea848..599420e597d 100644 --- a/crates/eframe/src/native/glow_integration.rs +++ b/crates/eframe/src/native/glow_integration.rs @@ -552,6 +552,44 @@ impl GlowWinitRunning { (raw_input, viewport_ui_cb) }; + let clear_color = self + .app + .clear_color(&self.integration.egui_ctx.style().visuals); + + let has_many_viewports = self.glutin.borrow().viewports.len() > 1; + let clear_before_update = !has_many_viewports; // HACK: for some reason, an early clear doesn't "take" on Mac with multiple viewports. + + if clear_before_update { + // clear before we call update, so users can paint between clear-color and egui windows: + + let mut glutin = self.glutin.borrow_mut(); + let GlutinWindowContext { + viewports, + current_gl_context, + not_current_gl_context, + .. + } = &mut *glutin; + let viewport = &viewports[&viewport_id]; + let Some(window) = viewport.window.as_ref() else { + return Ok(EventResult::Wait); + }; + let Some(gl_surface) = viewport.gl_surface.as_ref() else { + return Ok(EventResult::Wait); + }; + + let screen_size_in_pixels: [u32; 2] = window.inner_size().into(); + + { + frame_timer.pause(); + change_gl_context(current_gl_context, not_current_gl_context, gl_surface); + frame_timer.resume(); + } + + self.painter + .borrow() + .clear(screen_size_in_pixels, clear_color); + } + // ------------------------------------------------------------ // The update function, which could call immediate viewports, // so make sure we don't hold any locks here required by the immediate viewports rendeer. @@ -611,9 +649,10 @@ impl GlowWinitRunning { } let screen_size_in_pixels: [u32; 2] = window.inner_size().into(); - let clear_color = app.clear_color(&integration.egui_ctx.style().visuals); - painter.clear(screen_size_in_pixels, clear_color); + if !clear_before_update { + painter.clear(screen_size_in_pixels, clear_color); + } painter.paint_and_update_textures( screen_size_in_pixels,