From e1aa9b2f5db695e74db7e0f09e12a830aa043f7a Mon Sep 17 00:00:00 2001 From: Raph Levien Date: Wed, 3 Jun 2020 20:59:19 -0700 Subject: [PATCH] Remove bbox guard It's probably not necessary. This development still work in progress. --- piet-gpu/shader/coarse.comp | 28 ++++++++++++---------------- piet-gpu/shader/coarse.spv | Bin 29976 -> 29380 bytes 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/piet-gpu/shader/coarse.comp b/piet-gpu/shader/coarse.comp index 692eeca..2a3ba56 100644 --- a/piet-gpu/shader/coarse.comp +++ b/piet-gpu/shader/coarse.comp @@ -413,22 +413,18 @@ void main() { // should probably be stored in the annotated element. uint path_ix = element_ix; Path path = Path_read(PathRef(path_ix * Path_size)); - // It may be we have a strong guarantee this will always be `true`, but - // I prefer not to take chances. - if (tile_x >= path.bbox.x && tile_x < path.bbox.z && tile_y >= path.bbox.y && tile_y < path.bbox.w) { - uint stride = path.bbox.z - path.bbox.x; - uint tile_subix = (tile_y - path.bbox.y) * stride + tile_x - path.bbox.x; - Tile tile = Tile_read(Tile_index(path.tiles, tile_subix)); - if (tile.tile.offset != 0) { - AnnoStroke stroke = Annotated_Stroke_read(ref); - CmdStroke cmd_stroke; - cmd_stroke.tile_ref = tile.tile.offset; - cmd_stroke.half_width = 0.5 * stroke.linewidth; - cmd_stroke.rgba_color = stroke.rgba_color; - alloc_cmd(cmd_ref, cmd_limit); - Cmd_Stroke_write(cmd_ref, cmd_stroke); - cmd_ref.offset += Cmd_size; - } + uint stride = path.bbox.z - path.bbox.x; + uint tile_subix = (tile_y - path.bbox.y) * stride + tile_x - path.bbox.x; + Tile tile = Tile_read(Tile_index(path.tiles, tile_subix)); + if (tile.tile.offset != 0) { + AnnoStroke stroke = Annotated_Stroke_read(ref); + CmdStroke cmd_stroke; + cmd_stroke.tile_ref = tile.tile.offset; + cmd_stroke.half_width = 0.5 * stroke.linewidth; + cmd_stroke.rgba_color = stroke.rgba_color; + alloc_cmd(cmd_ref, cmd_limit); + Cmd_Stroke_write(cmd_ref, cmd_stroke); + cmd_ref.offset += Cmd_size; } break; } diff --git a/piet-gpu/shader/coarse.spv b/piet-gpu/shader/coarse.spv index b3a90c89d27c70e089535afb0615701fd3ec8fec..2cc0acfe36e52bfe32eb5cc7164197d9f8d4276e 100644 GIT binary patch delta 1864 zcmZ9MOKg-?7>3WZGi@R1qJ^Y}m>4jo3rt9KVF*#vkg$+llakOTlBz5kHPp610byuq zmHWjXrC`0(TT!$|2M`4cRW~kR1BM;O1q*TEf<@KD#OImL2hIGGlk>jscRA-f=Q}fY zH}~_MTw`s`qxC7}QUkvqziIrdskkYhQvX0-&r2IqD)8G3ALw~y*q+)D%@I`tv`4- zZq^?BN$l1hTz_j1uHD*$Ux!{@$ETR%!4W0>Rihz7uVsy~xzlf9w#bma)Q zfbVf8k!5Q()X`ELMBU1WEZe|(sz>B@u-Qf`EA0U5ryf49ga0J^?uyS&xPI!f;x2Fx zqnF+8U=W-A)?O$U(X_=Lc7u&qw-Rqvt&QB?(jKsR#^-XRCzwaz>iT=j^4QxOU~_2m z#^ozHGvnUOr#0y*fI%8{vJEicR7k6_?E|l2R@ZJ@sYPM?!9&^a>lPIcfMjQgoZ>hR zg4HZ{mdL|kzkgG{Y&!&3`#aSnv0HAzehmCy&D?4>o!s3tV|xqy2(!Aou}Rg~&BAim z9EZ$p=WUS8le3@R0o$_PfT41IwBJS>1DmcN>{b>qpMWVtuQn6QBW@BL8}UKQwLQlgpMx#JxYIVUg3abez5u_- zY>+QMD*qB}!uhB36`FcHs41|T|AZ0uH8|p2P_ExUtY%jgY^%fB#QL?xZ=nlWBGQ%M zYPV=oL$#?z{b#{y!Oy`P;Zt;hjeQ=jk9zog2fl$V_yzb)I5F$WLEj_jq+zm>=m)UL zwE03VG5h&Kv|VJVS&G=&n%Ic^Qa01M{IM&jaUIiOxo-uhbQSzO^K_}HtA5GzVDpgM?%u!5l9?|GjK$4l?Hx&QzFb=}v;{qgM3 zPo=HDlvNQyLiT@42lzr564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