From 1797914ac8205a890e6bfb50574744cb7b0c8b83 Mon Sep 17 00:00:00 2001 From: Raph Levien Date: Sat, 2 May 2020 16:20:04 -0700 Subject: [PATCH] Fix artifacts We were overwriting `end` when clipping, then reusing it when reading the path, for continuity. --- piet-gpu/shader/kernel2f.comp | 8 +++++--- piet-gpu/shader/kernel2f.spv | Bin 21048 -> 21108 bytes 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/piet-gpu/shader/kernel2f.comp b/piet-gpu/shader/kernel2f.comp index 14a6ead..7ea93bd 100644 --- a/piet-gpu/shader/kernel2f.comp +++ b/piet-gpu/shader/kernel2f.comp @@ -119,6 +119,8 @@ void main() { && ytop < ybot && s00 * s01 + s00 * s10 + s00 * s11 < 3.0) { + // avoid overwriting `end` so that it can be used as start + vec2 enc_end = end; if (xymin.x < xy0.x) { float yEdge = mix(start.y, end.y, (start.x - xy0.x) / b); if (yEdge >= xy0.y && yEdge < xy1.y) { @@ -127,8 +129,8 @@ void main() { // in piet-metal). FillSegment edge_seg; if (b > 0.0) { - end = vec2(xy0.x, yEdge); - edge_seg.start = end; + enc_end = vec2(xy0.x, yEdge); + edge_seg.start = enc_end; edge_seg.end = vec2(xy0.x, xy1.y); } else { start = vec2(xy0.x, yEdge); @@ -141,7 +143,7 @@ void main() { } } alloc_chunk(chunk_n_segs, seg_chunk_ref, first_seg_chunk, seg_limit); - FillSegment seg = FillSegment(start, end); + FillSegment seg = FillSegment(start, enc_end); FillSegment_write(FillSegmentRef(seg_chunk_ref.offset + FillSegChunk_size + FillSegment_size * chunk_n_segs), seg); chunk_n_segs++; } diff --git a/piet-gpu/shader/kernel2f.spv b/piet-gpu/shader/kernel2f.spv index 36e7b9475cc5d71b962abffe64ffda55eb72107c..75a7a39616532d313668ff49c7fbd7b0ec2b8681 100644 GIT binary patch delta 3642 zcmZ9PS!`8R6o&Wh1SqYPA_@g7qsoko6)F@#Eh-ctCO#1Y6%!&c8clpK7r_T#&3WQY z5?%xmv1mXAah?ZM#2FQ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