Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Certain Slopes Having Bugged Anti-Aliasing + Rewrite Of AA Code #1855

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Jaklyy
Copy link
Contributor

@Jaklyy Jaklyy commented Oct 18, 2023

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:
image
Fixed:
image

if the calculated y coordinate differs from the expected y coordinate, invert its coverage.
should behave identically
seems to just make things sliiightly slower on my machine
why did i optimize swapped polygons?
they're not that common.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant