aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Wilm <joe@jwilm.com>2016-06-06 13:29:05 -0700
committerJoe Wilm <joe@jwilm.com>2016-06-06 13:29:05 -0700
commitb977a151874fb97742e61b60cba494766a4ec697 (patch)
tree297e6f365da8273ff57d3772224cd466df22e9ab
parented7aa96907e8c5e51facb45f9b590ce25b4f3dd5 (diff)
downloadalacritty-b977a151874fb97742e61b60cba494766a4ec697.tar.gz
alacritty-b977a151874fb97742e61b60cba494766a4ec697.zip
Batching flushes on texture change
This fixes a bug when multiple atlases are required.
-rw-r--r--src/renderer/mod.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/renderer/mod.rs b/src/renderer/mod.rs
index ff2963f7..379e22ee 100644
--- a/src/renderer/mod.rs
+++ b/src/renderer/mod.rs
@@ -184,7 +184,7 @@ impl Batch {
/// Maximum items to be drawn in a batch.
const BATCH_MAX: usize = 4096;
-const ATLAS_SIZE: i32 = 512;
+const ATLAS_SIZE: i32 = 1024;
impl QuadRenderer {
// TODO should probably hand this a transform instead of width/height
@@ -481,6 +481,13 @@ impl<'a> RenderApi<'a> {
#[inline]
fn add_render_item(&mut self, row: f32, col: f32, color: Rgb, glyph: &Glyph) {
+ // Flush batch if tex changing
+ if !self.batch.is_empty() {
+ if self.batch.tex != glyph.tex_id {
+ self.render_batch();
+ }
+ }
+
self.batch.add_item(row, col, color, glyph);
// Render batch and clear if it's full