From dc68fc9943658b5b22614e998f8b3f4597b36e1e Mon Sep 17 00:00:00 2001 From: GPUCode Date: Tue, 29 Aug 2023 21:05:37 +0300 Subject: [PATCH] gpu: Saturate color before interpolation --- src/host_shaders/opengl_vertex_shader.vert | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/host_shaders/opengl_vertex_shader.vert b/src/host_shaders/opengl_vertex_shader.vert index cbf992c4..63ef1ae4 100644 --- a/src/host_shaders/opengl_vertex_shader.vert +++ b/src/host_shaders/opengl_vertex_shader.vert @@ -64,7 +64,8 @@ float decodeFP(uint hex, uint E, uint M) { void main() { gl_Position = a_coords; - v_colour = a_vertexColour; + vec4 colourAbs = abs(a_vertexColour); + v_colour = min(colourAbs, vec4(1.f)); // Flip y axis of UVs because OpenGL uses an inverted y for texture sampling compared to the PICA v_texcoord0 = vec3(a_texcoord0.x, 1.0 - a_texcoord0.y, a_texcoord0_w); @@ -94,4 +95,4 @@ void main() { // There's also another, always-on clipping plane based on vertex z gl_ClipDistance[0] = -a_coords.z; gl_ClipDistance[1] = dot(clipData, a_coords); -} \ No newline at end of file +}