Skip to content
Permalink
Browse files
Merge pull request #9350 from Pokechu22/sw-viewport
Software: Invert backface test when viewport is positive
  • Loading branch information
JMC47 committed Apr 23, 2021
2 parents 4d37dad + 5b1c632 commit 4ab92d4
Showing 1 changed file with 5 additions and 0 deletions.
@@ -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) &&

0 comments on commit 4ab92d4

Please sign in to comment.