From 0c5ec1e5ccfd45c58e2464a9c4900ff59212ebb4 Mon Sep 17 00:00:00 2001 From: beeanyew Date: Wed, 28 Jul 2021 16:32:49 +0200 Subject: [PATCH] Only update RTG palette texture after set_clut_entry calls --- platforms/amiga/rtg/rtg-output-raylib.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/platforms/amiga/rtg/rtg-output-raylib.c b/platforms/amiga/rtg/rtg-output-raylib.c index 8c7ee58..788e4a2 100644 --- a/platforms/amiga/rtg/rtg-output-raylib.c +++ b/platforms/amiga/rtg/rtg-output-raylib.c @@ -37,7 +37,7 @@ extern uint16_t rtg_offset_x, rtg_offset_y; uint32_t cur_rtg_frame = 0; static pthread_t thread_id; -static uint8_t mouse_cursor_enabled = 0, cursor_image_updated = 0, updating_screen = 0, debug_palette = 0, show_fps = 0; +static uint8_t mouse_cursor_enabled = 0, cursor_image_updated = 0, updating_screen = 0, debug_palette = 0, show_fps = 1, palette_updated = 0; static uint8_t mouse_cursor_w = 16, mouse_cursor_h = 16; static int16_t mouse_cursor_x = 0, mouse_cursor_y = 0; static int16_t mouse_cursor_x_adj = 0, mouse_cursor_y_adj = 0; @@ -297,7 +297,6 @@ reinit_raylib:; switch (format) { case RTGFMT_8BIT: - UpdateTexture(raylib_clut_texture, palette); BeginShaderMode(clut_shader); SetShaderValueTexture(clut_shader, clut_loc, raylib_clut_texture); break; @@ -353,6 +352,10 @@ reinit_raylib:; UpdateTexture(raylib_cursor_texture, cursor_data); cursor_image_updated = 0; } + if (palette_updated) { + UpdateTexture(raylib_clut_texture, palette); + palette_updated = 0; + } updating_screen = 0; } else { BeginDrawing(); @@ -393,6 +396,7 @@ void rtg_set_clut_entry(uint8_t index, uint32_t xrgb) { //palette[index] = xrgb; unsigned char *src = (unsigned char *)&xrgb; unsigned char *dst = (unsigned char *)&palette[index]; + palette_updated = 1; dst[0] = src[2]; dst[1] = src[1]; dst[2] = src[0];