From 93f273bf840730931ce7afa1cb4e838d2f2b4eb9 Mon Sep 17 00:00:00 2001 From: Bigfoot71 Date: Sat, 18 Jul 2026 14:36:40 +0200 Subject: [PATCH] check whether vertex colors should be interpolated --- src/external/rlsw.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/external/rlsw.h b/src/external/rlsw.h index 491e33996..c27fab8f9 100644 --- a/src/external/rlsw.h +++ b/src/external/rlsw.h @@ -3783,7 +3783,6 @@ static void sw_immediate_set_color(const float color[4]) RLSW.primitive.color[1] = color[1]; RLSW.primitive.color[2] = color[2]; RLSW.primitive.color[3] = color[3]; - } static void sw_immediate_set_texcoord(const float texcoord[2]) @@ -3840,6 +3839,18 @@ static void sw_immediate_push_vertex(const float position[4]) } } + // Determine whether colors should be interpolated + const float *ref = RLSW.primitive.buffer[0].color; + for (int i = 1; i < RLSW.primitive.vertexCount; ++i) + { + const float *c = RLSW.primitive.buffer[i].color; + if (c[0] != ref[0] || c[1] != ref[1] || c[2] != ref[2] || c[3] != ref[3]) + { + state |= SW_STATE_COLOR_INTERP; + break; + } + } + switch (RLSW.polyMode) { case SW_FILL: sw_poly_fill_render(state); break;