2020-04-16 18:14:09 -07:00
|
|
|
use piet_gpu_derive::piet_gpu;
|
|
|
|
|
|
|
|
piet_gpu! {
|
|
|
|
#[gpu_write]
|
|
|
|
mod ptcl {
|
|
|
|
struct CmdCircle {
|
2020-04-21 17:55:17 -07:00
|
|
|
center: [f32; 2],
|
|
|
|
radius: f32,
|
|
|
|
rgba_color: u32,
|
2020-04-16 18:14:09 -07:00
|
|
|
}
|
|
|
|
struct CmdLine {
|
|
|
|
start: [f32; 2],
|
|
|
|
end: [f32; 2],
|
|
|
|
}
|
|
|
|
struct CmdStroke {
|
2020-04-28 22:25:57 -07:00
|
|
|
// Should be Ref<SegChunk> if we had cross-module references.
|
2020-04-28 11:02:19 -07:00
|
|
|
seg_ref: u32,
|
|
|
|
half_width: f32,
|
2020-04-16 18:14:09 -07:00
|
|
|
rgba_color: u32,
|
|
|
|
}
|
|
|
|
struct CmdFill {
|
2020-04-30 17:06:01 -07:00
|
|
|
// Should be Ref<FillSegChunk> if we had cross-module references.
|
|
|
|
seg_ref: u32,
|
|
|
|
backdrop: i32,
|
|
|
|
rgba_color: u32,
|
2020-04-16 18:14:09 -07:00
|
|
|
}
|
|
|
|
struct CmdFillEdge {
|
|
|
|
// The sign is only one bit.
|
|
|
|
sign: i32,
|
|
|
|
y: f32,
|
|
|
|
}
|
|
|
|
struct CmdDrawFill {
|
|
|
|
backdrop: i32,
|
|
|
|
rgba_color: u32,
|
|
|
|
}
|
|
|
|
struct CmdSolid {
|
|
|
|
rgba_color: u32,
|
|
|
|
}
|
2020-04-25 10:15:22 -07:00
|
|
|
struct CmdJump {
|
|
|
|
new_ref: u32,
|
|
|
|
}
|
2020-04-16 18:14:09 -07:00
|
|
|
enum Cmd {
|
|
|
|
End,
|
|
|
|
Circle(CmdCircle),
|
|
|
|
Line(CmdLine),
|
|
|
|
Fill(CmdFill),
|
|
|
|
Stroke(CmdStroke),
|
|
|
|
FillEdge(CmdFillEdge),
|
|
|
|
DrawFill(CmdDrawFill),
|
|
|
|
Solid(CmdSolid),
|
2020-04-25 10:15:22 -07:00
|
|
|
Jump(CmdJump),
|
2020-04-16 18:14:09 -07:00
|
|
|
Bail,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|