1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#[derive(Copy, Clone)]
#[allow(dead_code)]
pub enum PrimType {
/// Filled circle.
Circle,
/// Stroked arc.
Arc,
/// Rounded corner rectangle.
Rect,
/// Stroked rounded rectangle.
RectStroke,
/// Single-segment quadratic bezier curve.
Bezier,
/// line segment
Segment,
/// Multi-segment bezier curve.
Curve,
/// Connection wire. See https://www.shadertoy.com/view/NdsXRl
Wire,
/// Text rendering.
Glyph,
/// Path fills.
PathFill,
/// Rounded blurred rectangle.
BlurredRect,
}
#[derive(Copy, Clone, Default)]
#[repr(C)]
pub struct Prim {
/// Min and max coordinates of the quad we're rendering.
pub quad_bounds: [f32; 4],
/// Index of transform applied to drawing region.
pub xform: u32,
/// Type of primitive.
pub prim_type: u32,
/// Stroke width.
pub width: f32,
/// Radius of circles. Corner radius for rounded rectangles.
pub radius: f32,
/// Control vertices.
pub cvs: [f32; 6],
/// Start of the control vertices, if they're in a separate buffer.
pub start: u32,
/// Number of control vertices (vgerCurve and vgerPathFill)
pub count: u32,
/// Index of paint applied to drawing region.
pub paint: u32,
/// Glyph region index.
pub glyph: u32,
/// Min and max coordinates in texture space.
pub tex_bounds: [f32; 4],
/// Index of scissor.
pub scissor: u32,
pad: u32,
}
mod tests {
#[test]
fn test_size() {
assert_eq!(std::mem::size_of::<super::Prim>(), 96);
}
}