2020-06-03 10:10:20 +10:00
|
|
|
use piet_gpu_derive::piet_gpu;
|
|
|
|
|
|
|
|
piet_gpu! {
|
|
|
|
#[gpu_write]
|
|
|
|
mod pathseg {
|
2020-06-10 09:01:47 +10:00
|
|
|
struct PathFillCubic {
|
|
|
|
p0: [f32; 2],
|
|
|
|
p1: [f32; 2],
|
|
|
|
p2: [f32; 2],
|
|
|
|
p3: [f32; 2],
|
|
|
|
path_ix: u32,
|
2021-03-15 22:28:04 +11:00
|
|
|
// trans_ix is 1-based, 0 means no transformation.
|
|
|
|
trans_ix: u32,
|
2020-06-10 09:01:47 +10:00
|
|
|
// A note: the layout of this struct is shared with
|
|
|
|
// PathStrokeCubic. In that case, we actually write
|
|
|
|
// [0.0, 0.0] as the stroke field, to minimize divergence.
|
|
|
|
}
|
|
|
|
struct PathStrokeCubic {
|
|
|
|
p0: [f32; 2],
|
|
|
|
p1: [f32; 2],
|
|
|
|
p2: [f32; 2],
|
|
|
|
p3: [f32; 2],
|
|
|
|
path_ix: u32,
|
2021-03-15 22:28:04 +11:00
|
|
|
trans_ix: u32,
|
2020-06-10 09:01:47 +10:00
|
|
|
// halfwidth in both x and y for binning
|
|
|
|
stroke: [f32; 2],
|
|
|
|
}
|
2020-06-03 10:10:20 +10:00
|
|
|
enum PathSeg {
|
|
|
|
Nop,
|
2020-06-10 09:01:47 +10:00
|
|
|
FillCubic(PathFillCubic),
|
|
|
|
StrokeCubic(PathStrokeCubic),
|
2020-06-03 10:10:20 +10:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|