Skip to content

Commit

Permalink
VideoSoftware: Fix unsigned overflow bug in fog
Browse files Browse the repository at this point in the history
Was causing fog errors on the left half of the screen.

Only appeared to affect visual studio builds, GCC did the correct
thing.
  • Loading branch information
phire committed Sep 1, 2016
1 parent efac0cf commit 0e7424b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Source/Core/VideoBackends/Software/Tev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<s32>(bpmem.fogRange.Base.Center) - 342)) /
static_cast<float>(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.
Expand Down

0 comments on commit 0e7424b

Please sign in to comment.