From f68f2df575bca6e75cd8905e926ea823b1f379d5 Mon Sep 17 00:00:00 2001 From: quou Date: Sun, 19 Jan 2025 22:31:04 +1100 Subject: Make the UI renderer more efficient --- c2.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'c2.cpp') diff --git a/c2.cpp b/c2.cpp index 3c862a6..58f3831 100644 --- a/c2.cpp +++ b/c2.cpp @@ -17,7 +17,7 @@ extern "C" { #define video_arena_size (1024 * 1024 * 16) #define asset_arena_size (1024 * 1024 * 4) -#define ui_arena_size (1024 * 1024 * 64) +#define ui_arena_size (1024 * 1024) #define scene_arena_size (1024) #define per_frame_memory_size (1024 * 1024) @@ -879,13 +879,13 @@ struct C2 : public App { ctx.debug_pop(); ctx.debug_push("ui"); - ui->render(&frame_arena); { int s = ui->ren.bound.w * ui->ren.bound.h * 4; void* pixels = dev->map_buffer(ui_buffer, 0, s); - memcpy(pixels, ui->ren.pixels, s); + bool dirty = ui->render(&frame_arena, pixels); dev->unmap_buffer(ui_buffer); - ctx.copy(ui_texture, ui_buffer); + if (dirty) + ctx.copy(ui_texture, ui_buffer); pb.begin_rp(); pb.rp_target(dev->get_backbuffer(), Clear_Mode::restore); -- cgit v1.2.3-54-g00ecf