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

Improve numerical robustness in path tiling #401

Merged
merged 7 commits into from
Nov 2, 2023
Merged

Commits on Nov 1, 2023

  1. Add test scene to trigger numerical robustness issues

    This test scene contains a number of subpaths that contain line segments aligned to the grid, or that cross grid corners. These trigger one-pixel artifacts with the multisampled rendering modes, and are now correct with area antialiasing.
    raphlinus committed Nov 1, 2023
    Configuration menu
    Copy the full SHA
    6dd71dd View commit details
    Browse the repository at this point in the history
  2. Change to tile-relative segment coordinates

    WIP. Currently works but no cleanup.
    raphlinus committed Nov 1, 2023
    Configuration menu
    Copy the full SHA
    faf288a View commit details
    Browse the repository at this point in the history
  3. Move numerical robustness into tiling

    Change representation to tile-relative coordinates for segment endpoints.
    raphlinus committed Nov 1, 2023
    Configuration menu
    Copy the full SHA
    6f2a83e View commit details
    Browse the repository at this point in the history
  4. Test code for msaa

    raphlinus committed Nov 1, 2023
    Configuration menu
    Copy the full SHA
    b6e90a9 View commit details
    Browse the repository at this point in the history
  5. Antialiasing fixes

    This commit fixes a number of problems with multisampled AA. There are three main changes:
    
    * This fixes a cut'n'paste typo where the third word of four in resolution was computed incorrectly. This degraded antialiasing quality.
    
    * There is a bit more logic in `is_bump` to handle crossings at the top of the tile better. This is not done in the even-odd variant because it is seemingly not needed. (I don't have a careful analysis why, but suspect it has something to do with the fact that double counting or getting the sign wrong is less critical in even-odd than nonzero).
    
    * There is a tweak in tiling to cause vertical lines sent to fine to be not pixel-aligned. That's a difficult case for msaa (area doesn't care).
    
    The latter two might be considered hacky, but examination of the test cases should improve confidence. There were artifacts in glyph rendering that this patch also improves, so in any case it's better than the previous state.
    raphlinus committed Nov 1, 2023
    Configuration menu
    Copy the full SHA
    ce0abff View commit details
    Browse the repository at this point in the history
  6. Unbreak CI

    CI is broken because the WebGPU stuff doesn't have stable semver guarantees. This pins the web-sys version to protect against that.
    raphlinus committed Nov 1, 2023
    Configuration menu
    Copy the full SHA
    9861e50 View commit details
    Browse the repository at this point in the history
  7. Add comments to help explain msaa logic

    To say that the msaa logic is dense and hard to understand is an understatement. I've added some comments which will I hope will help the reader navigate the code, but ultimately it requires a real explanation.
    
    While reviewing the code, I realized that horizontal pixel-aligned lines are already being discarded by separate robustness logic, so that case doesn't need to be handled in is_bump, so I took it out.
    raphlinus committed Nov 1, 2023
    Configuration menu
    Copy the full SHA
    5a9ddf4 View commit details
    Browse the repository at this point in the history