diff options
| author | Pokechu22 <Pokechu022@gmail.com> | 2021-11-18 16:52:43 -0800 |
|---|---|---|
| committer | Pokechu22 <Pokechu022@gmail.com> | 2022-04-16 12:35:00 -0700 |
| commit | 8745d84949b34748e736d417f657b7758f1c944f (patch) | |
| tree | e42a143e6a0c2dc5c1c0a495eb11a21635172a74 /Source/Core/VideoBackends/Software/Clipper.cpp | |
| parent | 925ceab82f874dcd9eeab5ca9520b5d6f0157ed1 (diff) | |
Software: Disable clipping based on xfmem
This fixes https://bugs.dolphin-emu.org/issues/12562, and is also needed for a hardware test of mine.
Diffstat (limited to 'Source/Core/VideoBackends/Software/Clipper.cpp')
| -rw-r--r-- | Source/Core/VideoBackends/Software/Clipper.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/Source/Core/VideoBackends/Software/Clipper.cpp b/Source/Core/VideoBackends/Software/Clipper.cpp index edae393350..ae6b60f1ee 100644 --- a/Source/Core/VideoBackends/Software/Clipper.cpp +++ b/Source/Core/VideoBackends/Software/Clipper.cpp @@ -345,7 +345,24 @@ void ProcessTriangle(OutputVertexData* v0, OutputVertexData* v1, OutputVertexDat Vertices[2] = v2; } - ClipTriangle(indices, &numIndices); + // TODO: behavior when disable_clipping_detection is set doesn't quite match actual hardware; + // there does still seem to be a maximum size after which things are clipped. Also, currently + // when clipping is enabled triangles are clipped to exactly the viewport, but on hardware there + // is a guardband (and with certain scissor configurations, things can show up in it) + // Mario Party 8 in widescreen breaks without this: https://bugs.dolphin-emu.org/issues/12769 + bool skip_clipping = false; + if (xfmem.clipDisable.disable_clipping_detection) + { + // If any w coordinate is negative, then the perspective divide will flip coordinates, breaking + // various assumptions (including backface). So, we still need to do clipping in that case. + // This isn't the actual condition hardware uses. + if (Vertices[0]->projectedPosition.w >= 0 && Vertices[1]->projectedPosition.w >= 0 && + Vertices[2]->projectedPosition.w >= 0) + skip_clipping = true; + } + + if (!skip_clipping) + ClipTriangle(indices, &numIndices); for (int i = 0; i + 3 <= numIndices; i += 3) { |
