Skip to content

Commit

Permalink
Fix blocky artifacts in area aa
Browse files Browse the repository at this point in the history
The numerical robustness work for multisampled aa was not carried over to the area version. This patch changes the computation of y_edge in the tiling stage so that rendering using area antialiasing in fine will match the multisampled case. See the linked bug for a diagram which explains the cases.

Fixes #393
  • Loading branch information
raphlinus committed Oct 25, 2023
1 parent 9a6ef95 commit fc06a92
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions shader/path_tiling.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ fn main(
}
// See comments in CPU version of shader
var y_edge = 1e9;
if xy0.x == tile_xy.x {
if xy0.x == tile_xy.x && xy1.x != tile_xy.x && xy0.y != tile_xy.y {
y_edge = xy0.y;
} else if xy1.x == tile_xy.x {
} else if xy1.x == tile_xy.x && xy1.y != tile_xy.y {
y_edge = xy1.y;
}
if !is_down {
Expand Down
7 changes: 3 additions & 4 deletions src/cpu_shader/path_tiling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,11 @@ fn path_tiling_main(
if !is_down {
(xy0, xy1) = (xy1, xy0);
}
// TODO: figure out what to if both xy0 and xy1 are at left edge
// Also TODO (part of move to 8 byte encoding for segments): don't store y_edge at all,
// TODO (part of move to 8 byte encoding for segments): don't store y_edge at all,
// resolve this in fine.
let y_edge = if xy0.x == tile_xy.x {
let y_edge = if xy0.x == tile_xy.x && xy1.x != tile_xy.x && xy0.y != tile_xy.y {
xy0.y
} else if xy1.x == tile_xy.x {
} else if xy1.x == tile_xy.x && xy1.y != tile_xy.y {
xy1.y
} else {
1e9
Expand Down

0 comments on commit fc06a92

Please sign in to comment.