diff --git a/piet-gpu/shader/kernel2f.spv b/piet-gpu/shader/kernel2f.spv index 960741e..36e7b94 100644 Binary files a/piet-gpu/shader/kernel2f.spv and b/piet-gpu/shader/kernel2f.spv differ diff --git a/piet-gpu/shader/kernel3.comp b/piet-gpu/shader/kernel3.comp index 5b0e85a..bd6d809 100644 --- a/piet-gpu/shader/kernel3.comp +++ b/piet-gpu/shader/kernel3.comp @@ -110,7 +110,7 @@ void main() { FillItemHeader fill_item = FillItemHeader_read(fill_th.items); fill_th.items.offset += FillItemHeader_size; // TODO: handle segments == 0 but backdrop != specially, it's a solid tile. - if (fill_item.segments.offset != 0 || fill_item.backdrop != 0) { + if (fill_item.segments.offset != 0) { PietFill fill = PietItem_Fill_read(item_ref); CmdFill cmd = CmdFill( fill_item.segments.offset, @@ -120,6 +120,12 @@ void main() { alloc_cmd(cmd_ref, cmd_limit); Cmd_Fill_write(cmd_ref, cmd); cmd_ref.offset += Cmd_size; + } else if (fill_item.backdrop != 0) { + // TODO: truncate existing cmd list if alpha is opaque + PietFill fill = PietItem_Fill_read(item_ref); + alloc_cmd(cmd_ref, cmd_limit); + Cmd_Solid_write(cmd_ref, CmdSolid(fill.rgba_color)); + cmd_ref.offset += Cmd_size; } break; } diff --git a/piet-gpu/shader/kernel3.spv b/piet-gpu/shader/kernel3.spv index d20cc57..c182337 100644 Binary files a/piet-gpu/shader/kernel3.spv and b/piet-gpu/shader/kernel3.spv differ diff --git a/piet-gpu/shader/kernel4.comp b/piet-gpu/shader/kernel4.comp index d369f0e..1754bba 100644 --- a/piet-gpu/shader/kernel4.comp +++ b/piet-gpu/shader/kernel4.comp @@ -106,6 +106,11 @@ void main() { alpha = min(abs(area), 1.0); rgb = mix(rgb, fg_rgba.rgb, alpha * fg_rgba.a); break; + case Cmd_Solid: + CmdSolid solid = Cmd_Solid_read(cmd_ref); + fg_rgba = unpackUnorm4x8(solid.rgba_color).wzyx; + rgb = mix(rgb, fg_rgba.rgb, fg_rgba.a); + break; case Cmd_Jump: cmd_ref = CmdRef(Cmd_Jump_read(cmd_ref).new_ref); continue; diff --git a/piet-gpu/shader/kernel4.spv b/piet-gpu/shader/kernel4.spv index aab4107..db03dde 100644 Binary files a/piet-gpu/shader/kernel4.spv and b/piet-gpu/shader/kernel4.spv differ diff --git a/piet-gpu/src/render_ctx.rs b/piet-gpu/src/render_ctx.rs index a0560da..c08aca9 100644 --- a/piet-gpu/src/render_ctx.rs +++ b/piet-gpu/src/render_ctx.rs @@ -39,7 +39,7 @@ pub enum PietGpuBrush { Gradient, } -const TOLERANCE: f64 = 0.1; +const TOLERANCE: f64 = 0.25; impl PietGpuRenderContext { pub fn new() -> PietGpuRenderContext {