vello/piet-gpu-types/src/annotated.rs
Raph Levien d14895b107 Continuing work on clips
I realized there's a problem with encoding clip bboxes relative to the
current transform (see #36 for a more detailed explanation), so this is
changing it to absolute bboxes.

This more or less gets clips working. There are optimization
opportunities (all-clear and all-opaque mask tiles), and it doesn't deal
with overflow of the blend stack, but it seems to basically work.
2020-11-20 18:25:27 -08:00

37 lines
972 B
Rust

use piet_gpu_derive::piet_gpu;
piet_gpu! {
#[gpu_write]
mod annotated {
struct AnnoFill {
// The bbox is always first, as we take advantage of common
// layout when binning.
bbox: [f32; 4],
rgba_color: u32,
}
struct AnnoFillMask {
bbox: [f32; 4],
mask: f32,
}
struct AnnoStroke {
bbox: [f32; 4],
rgba_color: u32,
// For the nonuniform scale case, this needs to be a 2x2 matrix.
// That's expected to be uncommon, so we could special-case it.
linewidth: f32,
}
struct AnnoClip {
bbox: [f32; 4],
}
enum Annotated {
Nop,
Stroke(AnnoStroke),
Fill(AnnoFill),
FillMask(AnnoFillMask),
FillMaskInv(AnnoFillMask),
BeginClip(AnnoClip),
EndClip(AnnoClip),
}
}
}