From 17a17194508c6352051988c4e86c25b2a6e3142b Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Wed, 12 Aug 2020 02:27:03 +1000 Subject: [PATCH] GPU/HW: Fix incorrect texel offset when upscaling Fixes incorrectly coloured triangles in Tomb Raider. --- src/core/gpu_hw.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/gpu_hw.cpp b/src/core/gpu_hw.cpp index a8264abc9..59eabdbd0 100644 --- a/src/core/gpu_hw.cpp +++ b/src/core/gpu_hw.cpp @@ -182,8 +182,11 @@ void GPU_HW::HandleFlippedQuadTextureCoordinates(BatchVertex* vertices) const s32 texArea = (vertices[1].u - vertices[0].u) * (vertices[2].v - vertices[0].v) - (vertices[2].u - vertices[0].u) * (vertices[1].v - vertices[0].v); + // Leverage PGXP to further avoid 3D polygons that just happen to align this way after projection + const bool is_3d = (vertices[0].w != vertices[1].w || vertices[0].w != vertices[2].w); + // Shouldn't matter as degenerate primitives will be culled anyways. - if (area == 0.0f && texArea == 0) + if (area == 0.0f || texArea == 0 || is_3d) return; // Use floats here as it'll be faster than integer divides.