summaryrefslogtreecommitdiff
path: root/c2.cpp
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2025-01-19 22:31:04 +1100
committerquou <quou@disroot.org>2025-01-19 22:31:04 +1100
commitf68f2df575bca6e75cd8905e926ea823b1f379d5 (patch)
tree5fa40674882eb3a04562f5f0e70b0db20d0cb285 /c2.cpp
parent74e8d3f0278a65fdf86a1185fec8a6016e628e88 (diff)
Make the UI renderer more efficient
Diffstat (limited to 'c2.cpp')
-rw-r--r--c2.cpp8
1 files changed, 4 insertions, 4 deletions
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);