From 700a314542784a77692eaab949b06cede000476a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 1 Oct 2026 16:25:00 -0600 Subject: [PATCH] SoftGPU: Clip vertex texture coordinates in GE arithmetic The near-plane clipper's new vertices get their texture coordinates with the same float24 arithmetic as their position, not a float lerp. Fixes the texel ties under a clipped fan in a GTA frame dump (gpu/probe exp136; clipped colors and fog still differ). Co-Authored-By: Claude Opus 5.5 (1M context) --- GPU/Software/Clipper.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/GPU/Software/Clipper.cpp b/GPU/Software/Clipper.cpp index 74a075078f..a4282e9058 100644 --- a/GPU/Software/Clipper.cpp +++ b/GPU/Software/Clipper.cpp @@ -339,6 +339,11 @@ void ProcessTriangle(const ClipVertexData &v0, const ClipVertexData &v1, const C const float t = TransformUnit::NearPlaneT(in.clippos, out.clippos); dest.Lerp(t, in, out); dest.clippos = TransformUnit::NearPlanePoint(in.clippos, out.clippos, t); + // Texture coordinates go through the same arithmetic as the position (gpu/probe exp136). + for (int c = 0; c < 3; ++c) { + const float delta = TruncateToFloat24(GEAdd(out.v.texturecoords[c], -in.v.texturecoords[c])); + dest.v.texturecoords[c] = TruncateToFloat24(GEAdd(ProductToFloat24((double)t * delta), in.v.texturecoords[c])); + } bool outsideRange = false; dest.v.screenpos = TransformUnit::ClipToScreen(dest.clippos, &outsideRange); dest.v.clipw = dest.clippos.w;