diff --git a/ports/doom/patches/0003-Remove-unnecessary-copy-from-framebuffer.patch b/ports/doom/patches/0003-Remove-unnecessary-copy-from-framebuffer.patch new file mode 100644 index 00000000..e54c8ea4 --- /dev/null +++ b/ports/doom/patches/0003-Remove-unnecessary-copy-from-framebuffer.patch @@ -0,0 +1,47 @@ +From 70c235938f0b64c4f08a478d3107e5254ad904c6 Mon Sep 17 00:00:00 2001 +From: Bananymous +Date: Wed, 27 Nov 2024 13:28:42 +0200 +Subject: [PATCH] Remove unnecessary copy from framebuffer + +--- + doomgeneric/doomgeneric.c | 2 -- + doomgeneric/doomgeneric_banan_os.cpp | 6 +++--- + 2 files changed, 3 insertions(+), 5 deletions(-) + +diff --git a/doomgeneric/doomgeneric.c b/doomgeneric/doomgeneric.c +index 782a7e7..f4eb63e 100644 +--- a/doomgeneric/doomgeneric.c ++++ b/doomgeneric/doomgeneric.c +@@ -18,8 +18,6 @@ void doomgeneric_Create(int argc, char **argv) + + M_FindResponseFile(); + +- DG_ScreenBuffer = malloc(DOOMGENERIC_RESX * DOOMGENERIC_RESY * 4); +- + DG_Init(); + + D_DoomMain (); +diff --git a/doomgeneric/doomgeneric_banan_os.cpp b/doomgeneric/doomgeneric_banan_os.cpp +index d00c30d..9d13b43 100644 +--- a/doomgeneric/doomgeneric_banan_os.cpp ++++ b/doomgeneric/doomgeneric_banan_os.cpp +@@ -80,13 +80,13 @@ void DG_Init() + s_key_write_index = (s_key_write_index + 1) % s_key_queue_size; + } + ); ++ ++ ASSERT(DG_ScreenBuffer == nullptr); ++ DG_ScreenBuffer = s_window->pixels().data(); + } + + void DG_DrawFrame() + { +- for (size_t y = 0; y < DOOMGENERIC_RESY; y++) +- for (size_t x = 0; x < DOOMGENERIC_RESX; x++) +- s_window->set_pixel(x, y, 0xFF000000 | DG_ScreenBuffer[y * DOOMGENERIC_RESX + x]); + s_window->invalidate(); + s_window->poll_events(); + } +-- +2.47.1 +