From aa985823ba451838206435552203d8c6885c6f23 Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 12 Nov 2025 19:20:29 +0100 Subject: [PATCH] speed up GL_SetPalette "take 2" ensuring bytecolor is packed nd mypalettedata is initialized this seems to now work properly on windows --- src/hardware/r_opengl/r_opengl.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 80697eb8c..b8466ee3a 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -1499,14 +1499,14 @@ void GL_ReadScreenTexture(int tex, UINT8 *restrict dest, INT32 scale) // -----------------+ void GL_SetPalette(RGBA_t *palette) { - INT32 i; + const size_t palsize = (sizeof(RGBA_t) * 256); - for (i = 0; i < 256; i++) + // on a palette change, you have to reload all of the textures + if (memcmp(myPaletteData, palette, palsize)) { - myPaletteData[i].s = palette[i].s; + memcpy(myPaletteData, palette, palsize); + GL_Flush(); } - - GL_Flush(); } // -----------------+