vtgl

terminal emulator implemented in OpenGL
git clone anongit@rnpnr.xyz:vtgl.git
Log | Files | Refs | Feed | LICENSE

Commit: 42c2fce9d37ea378d1b94bee58bb7a1700b36932
Parent: f16d477a58ea9bb2f9df81a3cc45691b02ad65d7
Author: Randy Palamar
Date:   Sun, 18 Aug 2024 21:45:53 -0600

combine FULL_BLIT with blit_lines

Diffstat:
Mterminal.c | 8++++++++
Mvtgl.c | 11+----------
2 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/terminal.c b/terminal.c @@ -896,6 +896,12 @@ static void blit_lines(Term *t, Arena a, size line_count) { TermView *tv = t->views + t->view_idx; + + if (t->gl.flags & NEEDS_FULL_BLIT) { + term_reset(t); + line_count = t->size.h - 1; + } + CLAMP(line_count, 0, tv->lines.filled); for (size i = 0; i <= line_count; i++) { size line_idx = get_line_idx(&tv->lines, -line_count + i); @@ -905,4 +911,6 @@ blit_lines(Term *t, Arena a, size line_count) tv->last_line_idx = line_idx; push_line(t, tv->lines.buf + line_idx, a); } + + t->gl.flags &= ~NEEDS_FULL_BLIT; } diff --git a/vtgl.c b/vtgl.c @@ -407,16 +407,6 @@ do_terminal(Term *t, Arena a) if (t->gl.flags & UPDATE_POST_UNIFORMS) update_uniforms(t, SHADER_POST); - RenderPushBuffer *rpb = alloc(&a, RenderPushBuffer, 1); - - /* NOTE: this could cause extra work if there is new data and we need a full - * blit on the same frame but for now we will ignore that */ - if (t->gl.flags & NEEDS_FULL_BLIT) { - term_reset(t); - blit_lines(t, a, t->size.h - 1); - t->gl.flags &= ~NEEDS_FULL_BLIT; - } - if (os_child_data_available(t->child)) { RingBuf *rb = &t->views[t->view_idx].log; if (os_child_exited(t->child)) { @@ -439,6 +429,7 @@ do_terminal(Term *t, Arena a) glUniform1i(t->gl.render.texslot, 0); glBindFramebuffer(GL_FRAMEBUFFER, t->gl.fb); + RenderPushBuffer *rpb = alloc(&a, RenderPushBuffer, 1); clear_colour(); render_framebuffer(t, rpb);