mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-27 00:12:55 +03:00
fix major perf regression from modal menus getting sections. need to
call draw_queued for text once per frame, otherwise cache gets ruined
This commit is contained in:
parent
3c2d794c62
commit
84ac102d05
@ -707,3 +707,20 @@ transitions... pop current state, push some new state, replace current state
|
||||
I don't want to wind up with the mess of plugins again. Why am I sure it's not that?
|
||||
|
||||
- these are complete, mutex states
|
||||
|
||||
## Text
|
||||
|
||||
What's slow right now?
|
||||
- drawing the rectangles?
|
||||
- forming the Text?
|
||||
- doing the draw_queued flush?
|
||||
|
||||
Simpler ideas for speedup:
|
||||
= only one draw_queued flush, to preserve caching behavior!
|
||||
- batch fork/unfork and all the rectangles? maybe not needed for modal menu
|
||||
- detect state changes in ModalMenu, recreate Drawable thing only when needed
|
||||
|
||||
Current stack:
|
||||
- https://docs.rs/glium-glyph/0.3.0/glium_glyph/
|
||||
- https://docs.rs/glyph_brush/0.4.0/glyph_brush/
|
||||
- https://docs.rs/rusttype/0.7.7/rusttype/
|
||||
|
@ -220,6 +220,10 @@ impl<'a> LoadingScreen<'a> {
|
||||
&txt,
|
||||
(HorizontalAlignment::Center, VerticalAlignment::Center),
|
||||
);
|
||||
self.canvas
|
||||
.glyphs
|
||||
.borrow_mut()
|
||||
.draw_queued(self.prerender.display, &mut target);
|
||||
target.finish().unwrap();
|
||||
}
|
||||
}
|
||||
|
@ -122,6 +122,13 @@ impl<G: GUI> State<G> {
|
||||
menu.draw(&mut g);
|
||||
}
|
||||
|
||||
// Flush text just once, so that GlyphBrush's internal caching works. We have to assume
|
||||
// nothing will ever cover up text.
|
||||
self.canvas
|
||||
.glyphs
|
||||
.borrow_mut()
|
||||
.draw_queued(display, &mut target);
|
||||
|
||||
target.finish().unwrap();
|
||||
naming_hint
|
||||
}
|
||||
|
@ -239,10 +239,6 @@ pub fn draw_text_bubble(
|
||||
y += height;
|
||||
g.canvas.glyphs.borrow_mut().queue(section);
|
||||
}
|
||||
g.canvas
|
||||
.glyphs
|
||||
.borrow_mut()
|
||||
.draw_queued(g.display, g.target);
|
||||
|
||||
g.unfork();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user