From e99bd00dec0b40ee660149459996f2ec15cc2a7a Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Mon, 1 Apr 2024 12:14:44 +0200 Subject: [PATCH] Only avoid glow context switching on Windows (#4296) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …since it is reportedly broken on Windows * Early-out added in https://github.com/emilk/egui/pull/4284 * Re-opens https://github.com/emilk/egui/issues/4173 😭 * Closes https://github.com/emilk/egui/issues/4289 * Closes https://github.com/emilk/egui/pull/4290 --- crates/eframe/src/native/glow_integration.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/crates/eframe/src/native/glow_integration.rs b/crates/eframe/src/native/glow_integration.rs index 823e0b0201a..84b3fd94528 100644 --- a/crates/eframe/src/native/glow_integration.rs +++ b/crates/eframe/src/native/glow_integration.rs @@ -849,10 +849,17 @@ fn change_gl_context( ) { crate::profile_function!(); - if let Some(current_gl_context) = current_gl_context { - crate::profile_scope!("is_current"); - if gl_surface.is_current(current_gl_context) { - return; // Early-out to save a lot of time. + if !cfg!(target_os = "windows") { + // According to https://github.com/emilk/egui/issues/4289 + // we cannot do this early-out on Windows. + // TODO(emilk): optimize context switching on Windows too. + // See https://github.com/emilk/egui/issues/4173 + + if let Some(current_gl_context) = current_gl_context { + crate::profile_scope!("is_current"); + if gl_surface.is_current(current_gl_context) { + return; // Early-out to save a lot of time. + } } }