From 0e7424b359a072bc05347c04913478d2e0eb7e6a Mon Sep 17 00:00:00 2001 From: Scott Mansell Date: Fri, 2 Sep 2016 10:05:08 +1200 Subject: [PATCH] VideoSoftware: Fix unsigned overflow bug in fog Was causing fog errors on the left half of the screen. Only appeared to affect visual studio builds, GCC did the correct thing. --- Source/Core/VideoBackends/Software/Tev.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/Core/VideoBackends/Software/Tev.cpp b/Source/Core/VideoBackends/Software/Tev.cpp index 54dd305206ff..5cd4491cc9a3 100644 --- a/Source/Core/VideoBackends/Software/Tev.cpp +++ b/Source/Core/VideoBackends/Software/Tev.cpp @@ -769,7 +769,8 @@ void Tev::Draw() // - scaling of the "k" coefficient isn't clear either. // First, calculate the offset from the viewport center (normalized to 0..1) - float offset = (Position[0] - (bpmem.fogRange.Base.Center - 342)) / (float)xfmem.viewport.wd; + float offset = (Position[0] - (static_cast(bpmem.fogRange.Base.Center) - 342)) / + static_cast(xfmem.viewport.wd); // Based on that, choose the index such that points which are far away from the z-axis use the // 10th "k" value and such that central points use the first value.