Skip to content

Commit

Permalink
Update glow_integration.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
rustbasic authored Jun 19, 2024
1 parent f793688 commit 8926a2c
Showing 1 changed file with 7 additions and 20 deletions.
27 changes: 7 additions & 20 deletions crates/eframe/src/native/glow_integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -698,10 +698,6 @@ impl GlowWinitRunning {
frame_timer.resume();
}

let Some(current_gl_context) = current_gl_context.as_ref() else {
return EventResult::Wait;
};

let screen_size_in_pixels: [u32; 2] = window.inner_size().into();
let clear_color = app.clear_color(&integration.egui_ctx.style().visuals);

Expand Down Expand Up @@ -756,9 +752,9 @@ impl GlowWinitRunning {
}

{
// let Some(current_gl_context) = current_gl_context.as_ref() else {
// return EventResult::Wait;
// };
let Some(current_gl_context) = current_gl_context.as_ref() else {
return EventResult::Wait;
};

// vsync - don't count as frame-time:
frame_timer.pause();
Expand Down Expand Up @@ -1533,19 +1529,6 @@ fn render_immediate_viewport(

change_gl_context(current_gl_context, gl_surface);

// let current_gl_context = current_gl_context.as_ref().unwrap();
let Some(current_gl_context) = current_gl_context.as_ref() else {
return;
};

if !gl_surface.is_current(current_gl_context) {
log::error!(
"egui::show_viewport_immediate: viewport {:?} ({:?}) was not created on main thread.",
viewport.ids.this,
viewport.builder.title
);
}

let screen_size_in_pixels: [u32; 2] = window.inner_size().into();

egui_glow::painter::clear(
Expand All @@ -1562,6 +1545,10 @@ fn render_immediate_viewport(
);

{
let Some(current_gl_context) = current_gl_context.as_ref() else {
return;
};

crate::profile_scope!("swap_buffers");
if let Err(err) = gl_surface.swap_buffers(current_gl_context) {
log::error!("swap_buffers failed: {err}");
Expand Down

0 comments on commit 8926a2c

Please sign in to comment.