From dc1e1b5adf909e8a7cc71ad9e8617ac62c62e9c5 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sun, 26 Apr 2020 21:43:18 +1000 Subject: [PATCH] GPU/HW: Fix too-large polygon culling Fixes graphical corruption in some levels of Point Blank 2. --- src/core/gpu_hw.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/gpu_hw.cpp b/src/core/gpu_hw.cpp index 1b9915a8a..af468f07c 100644 --- a/src/core/gpu_hw.cpp +++ b/src/core/gpu_hw.cpp @@ -204,7 +204,7 @@ void GPU_HW::LoadVertices() // Cull polygons which are too large. const s32 min_x_12 = std::min(vertices[1].x, vertices[2].x); - const s32 max_x_12 = std::max(vertices[2].x, vertices[2].x); + const s32 max_x_12 = std::max(vertices[1].x, vertices[2].x); const s32 min_y_12 = std::min(vertices[1].y, vertices[2].y); const s32 max_y_12 = std::max(vertices[1].y, vertices[2].y); const s32 min_x = std::min(min_x_12, vertices[2].x); @@ -236,9 +236,9 @@ void GPU_HW::LoadVertices() if (rc.quad_polygon) { const s32 min_x_123 = std::min(min_x_12, vertices[3].x); - const s32 max_x_123 = std::max(min_x_12, vertices[3].x); + const s32 max_x_123 = std::max(max_x_12, vertices[3].x); const s32 min_y_123 = std::min(min_y_12, vertices[3].y); - const s32 max_y_123 = std::max(min_y_12, vertices[3].y); + const s32 max_y_123 = std::max(max_y_12, vertices[3].y); // Cull polygons which are too large. if ((max_x_123 - min_x_123) >= MAX_PRIMITIVE_WIDTH || (max_y_123 - min_y_123) >= MAX_PRIMITIVE_HEIGHT)