From 579a6c93117b910475b83452d8deff193cc1681c Mon Sep 17 00:00:00 2001 From: kd-11 Date: Tue, 2 May 2023 19:05:52 +0300 Subject: [PATCH] rsx: Add a comment explaining the barycentric interpolation change --- rpcs3/Emu/RSX/Program/GLSLCommon.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rpcs3/Emu/RSX/Program/GLSLCommon.cpp b/rpcs3/Emu/RSX/Program/GLSLCommon.cpp index a378349a50..180ea9d74b 100644 --- a/rpcs3/Emu/RSX/Program/GLSLCommon.cpp +++ b/rpcs3/Emu/RSX/Program/GLSLCommon.cpp @@ -1250,6 +1250,8 @@ namespace glsl "\n" "vec4 _interpolate_varying3(const in vec4[3] v)\n" "{\n" + // In the corner case where v[0] == v[1] == v[2], this algorithm generates a perfect result vs alternatives that use weighted multiply + add. + // Due to the finite precision of floating point arithmetic, adding together the result of different multiplies yeields a slightly inaccurate result which breaks things. " const vec4 p10 = v[1] - v[0];\n" " const vec4 p20 = v[2] - v[0];\n" " return v[0] + p10 * $gl_BaryCoord.y + p20 * $gl_BaryCoord.z;\n"