2020-04-17 11:14:09 +10:00
|
|
|
// Code auto-generated by piet-gpu-derive
|
|
|
|
|
|
|
|
struct BboxRef {
|
|
|
|
uint offset;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct PointRef {
|
|
|
|
uint offset;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SimpleGroupRef {
|
|
|
|
uint offset;
|
|
|
|
};
|
|
|
|
|
2020-04-18 09:01:37 +10:00
|
|
|
struct PietCircleRef {
|
|
|
|
uint offset;
|
|
|
|
};
|
|
|
|
|
2020-04-17 11:14:09 +10:00
|
|
|
struct PietStrokeLineRef {
|
|
|
|
uint offset;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct PietFillRef {
|
|
|
|
uint offset;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct PietStrokePolyLineRef {
|
|
|
|
uint offset;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct PietItemRef {
|
|
|
|
uint offset;
|
|
|
|
};
|
|
|
|
|
2020-05-12 13:01:06 +10:00
|
|
|
struct LineSegRef {
|
|
|
|
uint offset;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct QuadSegRef {
|
|
|
|
uint offset;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct CubicSegRef {
|
|
|
|
uint offset;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct FillRef {
|
|
|
|
uint offset;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct StrokeRef {
|
|
|
|
uint offset;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SetLineWidthRef {
|
|
|
|
uint offset;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct TransformRef {
|
|
|
|
uint offset;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ElementRef {
|
|
|
|
uint offset;
|
|
|
|
};
|
|
|
|
|
2020-04-17 11:14:09 +10:00
|
|
|
struct Bbox {
|
2020-04-21 10:15:36 +10:00
|
|
|
ivec4 bbox;
|
2020-04-17 11:14:09 +10:00
|
|
|
};
|
|
|
|
|
|
|
|
#define Bbox_size 8
|
|
|
|
|
|
|
|
BboxRef Bbox_index(BboxRef ref, uint index) {
|
|
|
|
return BboxRef(ref.offset + index * Bbox_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct Point {
|
|
|
|
vec2 xy;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define Point_size 8
|
|
|
|
|
|
|
|
PointRef Point_index(PointRef ref, uint index) {
|
|
|
|
return PointRef(ref.offset + index * Point_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct SimpleGroup {
|
|
|
|
uint n_items;
|
|
|
|
PietItemRef items;
|
|
|
|
BboxRef bboxes;
|
2020-04-21 10:15:36 +10:00
|
|
|
Point offset;
|
2020-04-17 11:14:09 +10:00
|
|
|
};
|
|
|
|
|
2020-04-21 10:15:36 +10:00
|
|
|
#define SimpleGroup_size 20
|
2020-04-17 11:14:09 +10:00
|
|
|
|
|
|
|
SimpleGroupRef SimpleGroup_index(SimpleGroupRef ref, uint index) {
|
|
|
|
return SimpleGroupRef(ref.offset + index * SimpleGroup_size);
|
|
|
|
}
|
|
|
|
|
2020-04-18 09:01:37 +10:00
|
|
|
struct PietCircle {
|
|
|
|
uint rgba_color;
|
|
|
|
Point center;
|
|
|
|
float radius;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define PietCircle_size 16
|
|
|
|
|
|
|
|
PietCircleRef PietCircle_index(PietCircleRef ref, uint index) {
|
|
|
|
return PietCircleRef(ref.offset + index * PietCircle_size);
|
|
|
|
}
|
|
|
|
|
2020-04-17 11:14:09 +10:00
|
|
|
struct PietStrokeLine {
|
|
|
|
uint flags;
|
|
|
|
uint rgba_color;
|
|
|
|
float width;
|
|
|
|
Point start;
|
|
|
|
Point end;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define PietStrokeLine_size 28
|
|
|
|
|
|
|
|
PietStrokeLineRef PietStrokeLine_index(PietStrokeLineRef ref, uint index) {
|
|
|
|
return PietStrokeLineRef(ref.offset + index * PietStrokeLine_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct PietFill {
|
|
|
|
uint flags;
|
|
|
|
uint rgba_color;
|
|
|
|
uint n_points;
|
|
|
|
PointRef points;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define PietFill_size 16
|
|
|
|
|
|
|
|
PietFillRef PietFill_index(PietFillRef ref, uint index) {
|
|
|
|
return PietFillRef(ref.offset + index * PietFill_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct PietStrokePolyLine {
|
|
|
|
uint rgba_color;
|
|
|
|
float width;
|
|
|
|
uint n_points;
|
|
|
|
PointRef points;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define PietStrokePolyLine_size 16
|
|
|
|
|
|
|
|
PietStrokePolyLineRef PietStrokePolyLine_index(PietStrokePolyLineRef ref, uint index) {
|
|
|
|
return PietStrokePolyLineRef(ref.offset + index * PietStrokePolyLine_size);
|
|
|
|
}
|
|
|
|
|
2020-04-21 10:15:36 +10:00
|
|
|
#define PietItem_Group 0
|
|
|
|
#define PietItem_Circle 1
|
|
|
|
#define PietItem_Line 2
|
|
|
|
#define PietItem_Fill 3
|
|
|
|
#define PietItem_Poly 4
|
2020-04-17 11:14:09 +10:00
|
|
|
#define PietItem_size 32
|
|
|
|
|
|
|
|
PietItemRef PietItem_index(PietItemRef ref, uint index) {
|
|
|
|
return PietItemRef(ref.offset + index * PietItem_size);
|
|
|
|
}
|
|
|
|
|
2020-05-12 13:01:06 +10:00
|
|
|
struct LineSeg {
|
|
|
|
vec2 p0;
|
|
|
|
vec2 p1;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define LineSeg_size 16
|
|
|
|
|
|
|
|
LineSegRef LineSeg_index(LineSegRef ref, uint index) {
|
|
|
|
return LineSegRef(ref.offset + index * LineSeg_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct QuadSeg {
|
|
|
|
vec2 p0;
|
|
|
|
vec2 p1;
|
|
|
|
vec2 p2;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define QuadSeg_size 24
|
|
|
|
|
|
|
|
QuadSegRef QuadSeg_index(QuadSegRef ref, uint index) {
|
|
|
|
return QuadSegRef(ref.offset + index * QuadSeg_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct CubicSeg {
|
|
|
|
vec2 p0;
|
|
|
|
vec2 p1;
|
|
|
|
vec2 p2;
|
|
|
|
vec2 p3;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define CubicSeg_size 32
|
|
|
|
|
|
|
|
CubicSegRef CubicSeg_index(CubicSegRef ref, uint index) {
|
|
|
|
return CubicSegRef(ref.offset + index * CubicSeg_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct Fill {
|
|
|
|
uint rgba_color;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define Fill_size 4
|
|
|
|
|
|
|
|
FillRef Fill_index(FillRef ref, uint index) {
|
|
|
|
return FillRef(ref.offset + index * Fill_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct Stroke {
|
|
|
|
uint rgba_color;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define Stroke_size 4
|
|
|
|
|
|
|
|
StrokeRef Stroke_index(StrokeRef ref, uint index) {
|
|
|
|
return StrokeRef(ref.offset + index * Stroke_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct SetLineWidth {
|
|
|
|
float width;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define SetLineWidth_size 4
|
|
|
|
|
|
|
|
SetLineWidthRef SetLineWidth_index(SetLineWidthRef ref, uint index) {
|
|
|
|
return SetLineWidthRef(ref.offset + index * SetLineWidth_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct Transform {
|
|
|
|
vec4 mat;
|
|
|
|
vec2 translate;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define Transform_size 24
|
|
|
|
|
|
|
|
TransformRef Transform_index(TransformRef ref, uint index) {
|
|
|
|
return TransformRef(ref.offset + index * Transform_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
#define Element_Nop 0
|
2020-05-21 00:38:52 +10:00
|
|
|
#define Element_StrokeLine 1
|
|
|
|
#define Element_FillLine 2
|
2020-06-10 09:01:47 +10:00
|
|
|
#define Element_StrokeQuad 3
|
|
|
|
#define Element_FillQuad 4
|
|
|
|
#define Element_StrokeCubic 5
|
|
|
|
#define Element_FillCubic 6
|
|
|
|
#define Element_Stroke 7
|
|
|
|
#define Element_Fill 8
|
|
|
|
#define Element_SetLineWidth 9
|
|
|
|
#define Element_Transform 10
|
2020-05-12 13:01:06 +10:00
|
|
|
#define Element_size 36
|
|
|
|
|
|
|
|
ElementRef Element_index(ElementRef ref, uint index) {
|
|
|
|
return ElementRef(ref.offset + index * Element_size);
|
|
|
|
}
|
|
|
|
|
2020-04-17 11:14:09 +10:00
|
|
|
Bbox Bbox_read(BboxRef ref) {
|
|
|
|
uint ix = ref.offset >> 2;
|
|
|
|
uint raw0 = scene[ix + 0];
|
|
|
|
uint raw1 = scene[ix + 1];
|
|
|
|
Bbox s;
|
2020-04-21 10:15:36 +10:00
|
|
|
s.bbox = ivec4(int(raw0 << 16) >> 16, int(raw0) >> 16, int(raw1 << 16) >> 16, int(raw1) >> 16);
|
2020-04-17 11:14:09 +10:00
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
|
|
|
Point Point_read(PointRef ref) {
|
|
|
|
uint ix = ref.offset >> 2;
|
|
|
|
uint raw0 = scene[ix + 0];
|
|
|
|
uint raw1 = scene[ix + 1];
|
|
|
|
Point s;
|
|
|
|
s.xy = vec2(uintBitsToFloat(raw0), uintBitsToFloat(raw1));
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
|
|
|
SimpleGroup SimpleGroup_read(SimpleGroupRef ref) {
|
|
|
|
uint ix = ref.offset >> 2;
|
|
|
|
uint raw0 = scene[ix + 0];
|
|
|
|
uint raw1 = scene[ix + 1];
|
|
|
|
uint raw2 = scene[ix + 2];
|
|
|
|
SimpleGroup s;
|
|
|
|
s.n_items = raw0;
|
|
|
|
s.items = PietItemRef(raw1);
|
|
|
|
s.bboxes = BboxRef(raw2);
|
2020-04-21 10:15:36 +10:00
|
|
|
s.offset = Point_read(PointRef(ref.offset + 12));
|
2020-04-17 11:14:09 +10:00
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2020-04-18 09:01:37 +10:00
|
|
|
PietCircle PietCircle_read(PietCircleRef ref) {
|
|
|
|
uint ix = ref.offset >> 2;
|
|
|
|
uint raw0 = scene[ix + 0];
|
|
|
|
uint raw3 = scene[ix + 3];
|
|
|
|
PietCircle s;
|
|
|
|
s.rgba_color = raw0;
|
|
|
|
s.center = Point_read(PointRef(ref.offset + 4));
|
|
|
|
s.radius = uintBitsToFloat(raw3);
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2020-04-17 11:14:09 +10:00
|
|
|
PietStrokeLine PietStrokeLine_read(PietStrokeLineRef ref) {
|
|
|
|
uint ix = ref.offset >> 2;
|
|
|
|
uint raw0 = scene[ix + 0];
|
|
|
|
uint raw1 = scene[ix + 1];
|
|
|
|
uint raw2 = scene[ix + 2];
|
|
|
|
PietStrokeLine s;
|
|
|
|
s.flags = raw0;
|
|
|
|
s.rgba_color = raw1;
|
|
|
|
s.width = uintBitsToFloat(raw2);
|
|
|
|
s.start = Point_read(PointRef(ref.offset + 12));
|
|
|
|
s.end = Point_read(PointRef(ref.offset + 20));
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
|
|
|
PietFill PietFill_read(PietFillRef ref) {
|
|
|
|
uint ix = ref.offset >> 2;
|
|
|
|
uint raw0 = scene[ix + 0];
|
|
|
|
uint raw1 = scene[ix + 1];
|
|
|
|
uint raw2 = scene[ix + 2];
|
|
|
|
uint raw3 = scene[ix + 3];
|
|
|
|
PietFill s;
|
|
|
|
s.flags = raw0;
|
|
|
|
s.rgba_color = raw1;
|
|
|
|
s.n_points = raw2;
|
|
|
|
s.points = PointRef(raw3);
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
|
|
|
PietStrokePolyLine PietStrokePolyLine_read(PietStrokePolyLineRef ref) {
|
|
|
|
uint ix = ref.offset >> 2;
|
|
|
|
uint raw0 = scene[ix + 0];
|
|
|
|
uint raw1 = scene[ix + 1];
|
|
|
|
uint raw2 = scene[ix + 2];
|
|
|
|
uint raw3 = scene[ix + 3];
|
|
|
|
PietStrokePolyLine s;
|
|
|
|
s.rgba_color = raw0;
|
|
|
|
s.width = uintBitsToFloat(raw1);
|
|
|
|
s.n_points = raw2;
|
|
|
|
s.points = PointRef(raw3);
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint PietItem_tag(PietItemRef ref) {
|
|
|
|
return scene[ref.offset >> 2];
|
|
|
|
}
|
|
|
|
|
2020-04-21 10:15:36 +10:00
|
|
|
SimpleGroup PietItem_Group_read(PietItemRef ref) {
|
|
|
|
return SimpleGroup_read(SimpleGroupRef(ref.offset + 4));
|
|
|
|
}
|
|
|
|
|
2020-04-18 09:01:37 +10:00
|
|
|
PietCircle PietItem_Circle_read(PietItemRef ref) {
|
|
|
|
return PietCircle_read(PietCircleRef(ref.offset + 4));
|
|
|
|
}
|
|
|
|
|
2020-04-17 11:14:09 +10:00
|
|
|
PietStrokeLine PietItem_Line_read(PietItemRef ref) {
|
|
|
|
return PietStrokeLine_read(PietStrokeLineRef(ref.offset + 4));
|
|
|
|
}
|
|
|
|
|
|
|
|
PietFill PietItem_Fill_read(PietItemRef ref) {
|
|
|
|
return PietFill_read(PietFillRef(ref.offset + 4));
|
|
|
|
}
|
|
|
|
|
|
|
|
PietStrokePolyLine PietItem_Poly_read(PietItemRef ref) {
|
|
|
|
return PietStrokePolyLine_read(PietStrokePolyLineRef(ref.offset + 4));
|
|
|
|
}
|
|
|
|
|
2020-05-12 13:01:06 +10:00
|
|
|
LineSeg LineSeg_read(LineSegRef ref) {
|
|
|
|
uint ix = ref.offset >> 2;
|
|
|
|
uint raw0 = scene[ix + 0];
|
|
|
|
uint raw1 = scene[ix + 1];
|
|
|
|
uint raw2 = scene[ix + 2];
|
|
|
|
uint raw3 = scene[ix + 3];
|
|
|
|
LineSeg s;
|
|
|
|
s.p0 = vec2(uintBitsToFloat(raw0), uintBitsToFloat(raw1));
|
|
|
|
s.p1 = vec2(uintBitsToFloat(raw2), uintBitsToFloat(raw3));
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
|
|
|
QuadSeg QuadSeg_read(QuadSegRef ref) {
|
|
|
|
uint ix = ref.offset >> 2;
|
|
|
|
uint raw0 = scene[ix + 0];
|
|
|
|
uint raw1 = scene[ix + 1];
|
|
|
|
uint raw2 = scene[ix + 2];
|
|
|
|
uint raw3 = scene[ix + 3];
|
|
|
|
uint raw4 = scene[ix + 4];
|
|
|
|
uint raw5 = scene[ix + 5];
|
|
|
|
QuadSeg s;
|
|
|
|
s.p0 = vec2(uintBitsToFloat(raw0), uintBitsToFloat(raw1));
|
|
|
|
s.p1 = vec2(uintBitsToFloat(raw2), uintBitsToFloat(raw3));
|
|
|
|
s.p2 = vec2(uintBitsToFloat(raw4), uintBitsToFloat(raw5));
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
|
|
|
CubicSeg CubicSeg_read(CubicSegRef ref) {
|
|
|
|
uint ix = ref.offset >> 2;
|
|
|
|
uint raw0 = scene[ix + 0];
|
|
|
|
uint raw1 = scene[ix + 1];
|
|
|
|
uint raw2 = scene[ix + 2];
|
|
|
|
uint raw3 = scene[ix + 3];
|
|
|
|
uint raw4 = scene[ix + 4];
|
|
|
|
uint raw5 = scene[ix + 5];
|
|
|
|
uint raw6 = scene[ix + 6];
|
|
|
|
uint raw7 = scene[ix + 7];
|
|
|
|
CubicSeg s;
|
|
|
|
s.p0 = vec2(uintBitsToFloat(raw0), uintBitsToFloat(raw1));
|
|
|
|
s.p1 = vec2(uintBitsToFloat(raw2), uintBitsToFloat(raw3));
|
|
|
|
s.p2 = vec2(uintBitsToFloat(raw4), uintBitsToFloat(raw5));
|
|
|
|
s.p3 = vec2(uintBitsToFloat(raw6), uintBitsToFloat(raw7));
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
|
|
|
Fill Fill_read(FillRef ref) {
|
|
|
|
uint ix = ref.offset >> 2;
|
|
|
|
uint raw0 = scene[ix + 0];
|
|
|
|
Fill s;
|
|
|
|
s.rgba_color = raw0;
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
|
|
|
Stroke Stroke_read(StrokeRef ref) {
|
|
|
|
uint ix = ref.offset >> 2;
|
|
|
|
uint raw0 = scene[ix + 0];
|
|
|
|
Stroke s;
|
|
|
|
s.rgba_color = raw0;
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
|
|
|
SetLineWidth SetLineWidth_read(SetLineWidthRef ref) {
|
|
|
|
uint ix = ref.offset >> 2;
|
|
|
|
uint raw0 = scene[ix + 0];
|
|
|
|
SetLineWidth s;
|
|
|
|
s.width = uintBitsToFloat(raw0);
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
|
|
|
Transform Transform_read(TransformRef ref) {
|
|
|
|
uint ix = ref.offset >> 2;
|
|
|
|
uint raw0 = scene[ix + 0];
|
|
|
|
uint raw1 = scene[ix + 1];
|
|
|
|
uint raw2 = scene[ix + 2];
|
|
|
|
uint raw3 = scene[ix + 3];
|
|
|
|
uint raw4 = scene[ix + 4];
|
|
|
|
uint raw5 = scene[ix + 5];
|
|
|
|
Transform s;
|
|
|
|
s.mat = vec4(uintBitsToFloat(raw0), uintBitsToFloat(raw1), uintBitsToFloat(raw2), uintBitsToFloat(raw3));
|
|
|
|
s.translate = vec2(uintBitsToFloat(raw4), uintBitsToFloat(raw5));
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint Element_tag(ElementRef ref) {
|
|
|
|
return scene[ref.offset >> 2];
|
|
|
|
}
|
|
|
|
|
2020-05-21 00:38:52 +10:00
|
|
|
LineSeg Element_StrokeLine_read(ElementRef ref) {
|
|
|
|
return LineSeg_read(LineSegRef(ref.offset + 4));
|
|
|
|
}
|
|
|
|
|
|
|
|
LineSeg Element_FillLine_read(ElementRef ref) {
|
2020-05-12 13:01:06 +10:00
|
|
|
return LineSeg_read(LineSegRef(ref.offset + 4));
|
|
|
|
}
|
|
|
|
|
2020-06-10 09:01:47 +10:00
|
|
|
QuadSeg Element_StrokeQuad_read(ElementRef ref) {
|
2020-05-12 13:01:06 +10:00
|
|
|
return QuadSeg_read(QuadSegRef(ref.offset + 4));
|
|
|
|
}
|
|
|
|
|
2020-06-10 09:01:47 +10:00
|
|
|
QuadSeg Element_FillQuad_read(ElementRef ref) {
|
|
|
|
return QuadSeg_read(QuadSegRef(ref.offset + 4));
|
|
|
|
}
|
|
|
|
|
|
|
|
CubicSeg Element_StrokeCubic_read(ElementRef ref) {
|
|
|
|
return CubicSeg_read(CubicSegRef(ref.offset + 4));
|
|
|
|
}
|
|
|
|
|
|
|
|
CubicSeg Element_FillCubic_read(ElementRef ref) {
|
2020-05-12 13:01:06 +10:00
|
|
|
return CubicSeg_read(CubicSegRef(ref.offset + 4));
|
|
|
|
}
|
|
|
|
|
|
|
|
Stroke Element_Stroke_read(ElementRef ref) {
|
|
|
|
return Stroke_read(StrokeRef(ref.offset + 4));
|
|
|
|
}
|
|
|
|
|
|
|
|
Fill Element_Fill_read(ElementRef ref) {
|
|
|
|
return Fill_read(FillRef(ref.offset + 4));
|
|
|
|
}
|
|
|
|
|
|
|
|
SetLineWidth Element_SetLineWidth_read(ElementRef ref) {
|
|
|
|
return SetLineWidth_read(SetLineWidthRef(ref.offset + 4));
|
|
|
|
}
|
|
|
|
|
|
|
|
Transform Element_Transform_read(ElementRef ref) {
|
|
|
|
return Transform_read(TransformRef(ref.offset + 4));
|
|
|
|
}
|
|
|
|
|