Skip to content

Commit

Permalink
Merge branch 'emilk:master' into patch79
Browse files Browse the repository at this point in the history
  • Loading branch information
rustbasic authored Jul 13, 2024
2 parents e0a8c91 + 08c75d7 commit c0dae38
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
20 changes: 15 additions & 5 deletions crates/eframe/src/native/glow_integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,7 @@ impl GlowWinitRunning {
let GlutinWindowContext {
viewports,
current_gl_context,
not_current_gl_context,
..
} = &mut *glutin;
let viewport = &viewports[&viewport_id];
Expand All @@ -602,7 +603,7 @@ impl GlowWinitRunning {

{
frame_timer.pause();
change_gl_context(current_gl_context, gl_surface);
change_gl_context(current_gl_context, not_current_gl_context, gl_surface);
frame_timer.resume();
}

Expand Down Expand Up @@ -645,6 +646,7 @@ impl GlowWinitRunning {
let GlutinWindowContext {
viewports,
current_gl_context,
not_current_gl_context,
..
} = &mut *glutin;

Expand All @@ -664,7 +666,7 @@ impl GlowWinitRunning {
{
// We may need to switch contexts again, because of immediate viewports:
frame_timer.pause();
change_gl_context(current_gl_context, gl_surface);
change_gl_context(current_gl_context, not_current_gl_context, gl_surface);
frame_timer.resume();
}

Expand Down Expand Up @@ -866,6 +868,7 @@ impl GlowWinitRunning {

fn change_gl_context(
current_gl_context: &mut Option<glutin::context::PossiblyCurrentContext>,
not_current_gl_context: &mut Option<glutin::context::NotCurrentContext>,
gl_surface: &glutin::surface::Surface<glutin::surface::WindowSurface>,
) {
crate::profile_function!();
Expand All @@ -884,7 +887,9 @@ fn change_gl_context(
}
}

let not_current = {
let not_current = if let Some(not_current_context) = not_current_gl_context.take() {
not_current_context
} else {
crate::profile_scope!("make_not_current");
current_gl_context
.take()
Expand Down Expand Up @@ -1227,7 +1232,11 @@ impl GlutinWindowContext {

if let Some(viewport) = self.viewports.get(&viewport_id) {
if let Some(gl_surface) = &viewport.gl_surface {
change_gl_context(&mut self.current_gl_context, gl_surface);
change_gl_context(
&mut self.current_gl_context,
&mut self.not_current_gl_context,
gl_surface,
);
gl_surface.resize(
self.current_gl_context
.as_ref()
Expand Down Expand Up @@ -1459,6 +1468,7 @@ fn render_immediate_viewport(

let GlutinWindowContext {
current_gl_context,
not_current_gl_context,
viewports,
..
} = &mut *glutin;
Expand All @@ -1479,7 +1489,7 @@ fn render_immediate_viewport(

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

change_gl_context(current_gl_context, gl_surface);
change_gl_context(current_gl_context, not_current_gl_context, gl_surface);

let current_gl_context = current_gl_context.as_ref().unwrap();

Expand Down
2 changes: 1 addition & 1 deletion crates/egui_extras/src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ impl Default for TableScrollOptions {
scroll_to_row: None,
scroll_offset_y: None,
min_scrolled_height: 200.0,
max_scroll_height: 800.0,
max_scroll_height: f32::INFINITY,
auto_shrink: Vec2b::TRUE,
scroll_bar_visibility: ScrollBarVisibility::VisibleWhenNeeded,
}
Expand Down
8 changes: 8 additions & 0 deletions crates/epaint/src/mesh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ impl Mesh {
self.vertices = Default::default();
}

/// Returns the amount of memory used by the vertices and indices.
pub fn bytes_used(&self) -> usize {
std::mem::size_of::<Self>()
+ self.vertices.len() * std::mem::size_of::<Vertex>()
Expand Down Expand Up @@ -107,6 +108,8 @@ impl Mesh {
}

/// Append all the indices and vertices of `other` to `self`.
///
/// Panics when `other` mesh has a different texture.
pub fn append(&mut self, other: Self) {
crate::profile_function!();
debug_assert!(other.is_valid());
Expand All @@ -120,6 +123,8 @@ impl Mesh {

/// Append all the indices and vertices of `other` to `self` without
/// taking ownership.
///
/// Panics when `other` mesh has a different texture.
pub fn append_ref(&mut self, other: &Self) {
debug_assert!(other.is_valid());

Expand All @@ -138,6 +143,9 @@ impl Mesh {
self.vertices.extend(other.vertices.iter());
}

/// Add a colored vertex.
///
/// Panics when the mesh has assigned a texture.
#[inline(always)]
pub fn colored_vertex(&mut self, pos: Pos2, color: Color32) {
debug_assert!(self.texture_id == TextureId::default());
Expand Down

0 comments on commit c0dae38

Please sign in to comment.