Commit: 954a41be31f931d6996d25581de9959d22d3bb83
Parent: 0e99aec3b7f6c76e4474a0113d458695e68d9537
Author: Randy Palamar
Date: Sun, 27 Oct 2024 22:59:36 -0600
only reset render ssbo when size actually changed
Diffstat:
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/vtgl.c b/vtgl.c
@@ -99,17 +99,18 @@ resize(Term *t)
os_alloc_framebuffer(&t->views[0].fb, t->size.h, t->size.w);
os_alloc_framebuffer(&t->views[1].fb, t->size.h, t->size.w);
gl->flags |= NEEDS_FULL_REFILL;
+
+ u32 buffer_size = t->size.w * t->size.h * sizeof(RenderCell);
+ glDeleteBuffers(1, &gl->render_shader_ssbo);
+ glGenBuffers(1, &gl->render_shader_ssbo);
+ glBindBuffer(GL_SHADER_STORAGE_BUFFER, gl->render_shader_ssbo);
+ glBufferData(GL_SHADER_STORAGE_BUFFER, buffer_size, 0, GL_DYNAMIC_DRAW);
+ glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 0, gl->render_shader_ssbo);
+ gl->flags |= UPDATE_RENDER_BUFFER;
}
os_set_term_size(t->child, t->size.h, t->size.w, ws.w, ws.h);
- u32 buffer_size = t->size.w * t->size.h * sizeof(RenderCell);
- glDeleteBuffers(1, &gl->render_shader_ssbo);
- glGenBuffers(1, &gl->render_shader_ssbo);
- glBindBuffer(GL_SHADER_STORAGE_BUFFER, gl->render_shader_ssbo);
- glBufferData(GL_SHADER_STORAGE_BUFFER, buffer_size, 0, GL_DYNAMIC_DRAW);
- glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 0, gl->render_shader_ssbo);
-
ShaderParameters *sp = &gl->shader_parameters;
sp->cell_size = (uv2){.w = cs.w, .h = cs.h};
sp->top_left_margin = g_term_margin;