From d366456f2a4effd32f6406f0e0be1e8ab2d5c308 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 1 Oct 2026 08:23:49 -0600 Subject: [PATCH] SoftGPU: Interpolate through mode triangle UVs with the GE's planes Like transform mode with w = 1, and like sprites. Bit exact on gpu/probe exp73. Co-Authored-By: Claude Opus 5.5 (1M context) --- GPU/Software/Rasterizer.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/GPU/Software/Rasterizer.cpp b/GPU/Software/Rasterizer.cpp index 774ab2912e..1a59e5f4c0 100644 --- a/GPU/Software/Rasterizer.cpp +++ b/GPU/Software/Rasterizer.cpp @@ -1265,7 +1265,8 @@ void DrawTriangleSlice( const Vec3 v2_c1 = Vec3::FromRGB(v2.color1); const DepthPlane depthPlane = flatZ ? DepthPlane{} : ComputeDepthPlane(v0, v1, v2); - const UVPlanes uvPlanes = state.enableTextures && !state.throughMode ? ComputeUVPlanes(v0, v1, v2, state.textureProj) : UVPlanes{}; + // Through mode too, where w is 1 (gpu/probe exp73). + const UVPlanes uvPlanes = state.enableTextures ? ComputeUVPlanes(v0, v1, v2, state.textureProj && !state.throughMode) : UVPlanes{}; DepthPlane color0Planes[4], color1Planes[3]; if (!flatColor0) ComputeColorPlanes<4>(v0, v1, v2, v0.color0, v1.color0, v2.color0, color0Planes); @@ -1366,10 +1367,14 @@ void DrawTriangleSlice( Vec4 s, t; Vec4 q = Vec4::AssignToAll(1.0f); if (state.throughMode) { - s = Interpolate(v0.texturecoords.s(), v1.texturecoords.s(), v2.texturecoords.s(), w0, w1, - w2, wsum_recip); - t = Interpolate(v0.texturecoords.t(), v1.texturecoords.t(), v2.texturecoords.t(), w0, w1, - w2, wsum_recip); + if (uvPlanes.valid) { + GetTextureCoordinatesGE(uvPlanes, centerX, centerY, s, t, q); + } else { + s = Interpolate(v0.texturecoords.s(), v1.texturecoords.s(), v2.texturecoords.s(), w0, w1, + w2, wsum_recip); + t = Interpolate(v0.texturecoords.t(), v1.texturecoords.t(), v2.texturecoords.t(), w0, w1, + w2, wsum_recip); + } // For levels > 0, mipmapping is always based on level 0. Simpler to scale first. s *= 1.0f / (float) (1 << state.samplerID.width0Shift);