Fix Certain Slopes Having Bugged Anti-Aliasing + Rewrite Of AA Code #1855
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains two commits:
Commit 1: Fixes a bug with certain positive x-major slopes having bugged aa.
This was caused by lack of proper handling for x coordinates which had a different y coordinate calculated than they actually had when following the DS' slope algorithm, resulting in improper coverage being calculated.
The fix was simply to invert the final coverage value when these two values differ.
This seems to match hardware behavior.
Also seems to allow for removing extra handling elsewhere as it should no longer be possible for abnormally high starting coverage values to be calculated.
Commit 2: Attempts to rewrite some of the anti-aliasing code to be simpler. Hope I succeeded, if not then it's easy to revert. (Though I'm keeping most of the changes to y-major aa, because in hindsight I wrote some needlessly gross code when I fixed aa for swapped slopes.)
I did some testing to ensure this new handling doesn't break anything, but it's possible I missed some weird edge case (there's a lot of them.)
For the most part anti-aliasing should be unchanged, aside from some small fixes on certain slopes.
Example bugged slope:
Fixed: