summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/Software/Clipper.cpp
diff options
context:
space:
mode:
authorPokechu22 <Pokechu022@gmail.com>2020-12-21 18:20:32 -0800
committerPokechu22 <Pokechu022@gmail.com>2021-03-06 22:00:16 -0800
commit5b1c6328626557bbb25fe290738e7c6e7069af68 (patch)
tree5ff5ab4ad4ce8ce5a6b100d5ea17ff34f820dfdc /Source/Core/VideoBackends/Software/Clipper.cpp
parent089250fde65c2e225681c0ef6917d28fa187e8de (diff)
Software: Invert backface test when viewport is positive
Fixes Jimmie Johnson's Anything with an Engine.
Diffstat (limited to 'Source/Core/VideoBackends/Software/Clipper.cpp')
-rw-r--r--Source/Core/VideoBackends/Software/Clipper.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/Source/Core/VideoBackends/Software/Clipper.cpp b/Source/Core/VideoBackends/Software/Clipper.cpp
index 417bc63fa3..41a5e07d07 100644
--- a/Source/Core/VideoBackends/Software/Clipper.cpp
+++ b/Source/Core/VideoBackends/Software/Clipper.cpp
@@ -488,6 +488,11 @@ bool CullTest(const OutputVertexData* v0, const OutputVertexData* v1, const Outp
float normalZDir = (x0 * w2 - x2 * w0) * y1 + (x2 * y0 - x0 * y2) * w1 + (y2 * w0 - y0 * w2) * x1;
backface = normalZDir <= 0.0f;
+ // Jimmie Johnson's Anything with an Engine has a positive viewport, while other games have a
+ // negative viewport. The positive viewport does not require vertices to be vertically mirrored,
+ // but the backface test does need to be inverted for things to be drawn.
+ if (xfmem.viewport.ht > 0)
+ backface = !backface;
// TODO: Are these tests / the definition of backface above backwards?
if ((bpmem.genMode.cullmode == CullMode::Back || bpmem.genMode.cullmode == CullMode::All) &&