1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-25 22:33:52 +03:00

gui: improve vertex buffer map/write/release performance

Switches from using a dynamic vertex buffer to an immutable
vertex buffer.  This feels counter-intuitive to me; the purpose
of dynamic is to sustain frequent updates, but mapping the buffer
needs to synchronize with the GPU, and if we are rapidly invalidating
the window that can stall painting by tens of milliseconds.

Switching to an immutable buffer avoids the stall and makes
quad mapping more consistently < 10ms, but its still not
ideal.

refs: https://github.com/wez/wezterm/issues/546
This commit is contained in:
Wez Furlong 2021-03-21 10:28:17 -07:00
parent 4767fcc28c
commit 1994a2ea2d
2 changed files with 8 additions and 1 deletions

View File

@ -286,7 +286,7 @@ impl RenderState {
quads.scroll_thumb = define_quad(0.0, 0.0, 0.0, 0.0) as usize;
Ok((
VertexBuffer::dynamic(context, &verts)?,
VertexBuffer::immutable(context, &verts)?,
IndexBuffer::new(
context,
glium::index::PrimitiveType::TrianglesList,

View File

@ -167,7 +167,10 @@ impl super::TermWindow {
let gl_state = self.render_state.as_ref().unwrap();
let mut vb = gl_state.glyph_vertex_buffer.borrow_mut();
let start = Instant::now();
let mut quads = gl_state.quads.map(&mut vb);
log::trace!("quad map elapsed {:?}", start.elapsed());
let cursor_border_color = rgbcolor_to_window_color(palette.cursor_border);
let foreground = rgbcolor_to_window_color(palette.foreground);
@ -299,6 +302,10 @@ impl super::TermWindow {
)?;
}
let start = Instant::now();
drop(quads);
log::trace!("quad drop elapsed {:?}", start.elapsed());
Ok(())
}