mirror of
https://github.com/italicsjenga/vello.git
synced 2025-01-10 20:51:29 +11:00
2ed89dd65e
Output of kernel 1 is validated by simple inspection, next step is to wire it up properly.
239 lines
5.1 KiB
C
239 lines
5.1 KiB
C
// Code auto-generated by piet-gpu-derive
|
|
|
|
struct BboxRef {
|
|
uint offset;
|
|
};
|
|
|
|
struct PointRef {
|
|
uint offset;
|
|
};
|
|
|
|
struct SimpleGroupRef {
|
|
uint offset;
|
|
};
|
|
|
|
struct PietCircleRef {
|
|
uint offset;
|
|
};
|
|
|
|
struct PietStrokeLineRef {
|
|
uint offset;
|
|
};
|
|
|
|
struct PietFillRef {
|
|
uint offset;
|
|
};
|
|
|
|
struct PietStrokePolyLineRef {
|
|
uint offset;
|
|
};
|
|
|
|
struct PietItemRef {
|
|
uint offset;
|
|
};
|
|
|
|
struct Bbox {
|
|
ivec4 bbox;
|
|
};
|
|
|
|
#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;
|
|
Point offset;
|
|
};
|
|
|
|
#define SimpleGroup_size 20
|
|
|
|
SimpleGroupRef SimpleGroup_index(SimpleGroupRef ref, uint index) {
|
|
return SimpleGroupRef(ref.offset + index * SimpleGroup_size);
|
|
}
|
|
|
|
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);
|
|
}
|
|
|
|
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);
|
|
}
|
|
|
|
#define PietItem_Group 0
|
|
#define PietItem_Circle 1
|
|
#define PietItem_Line 2
|
|
#define PietItem_Fill 3
|
|
#define PietItem_Poly 4
|
|
#define PietItem_size 32
|
|
|
|
PietItemRef PietItem_index(PietItemRef ref, uint index) {
|
|
return PietItemRef(ref.offset + index * PietItem_size);
|
|
}
|
|
|
|
Bbox Bbox_read(BboxRef ref) {
|
|
uint ix = ref.offset >> 2;
|
|
uint raw0 = scene[ix + 0];
|
|
uint raw1 = scene[ix + 1];
|
|
Bbox s;
|
|
s.bbox = ivec4(int(raw0 << 16) >> 16, int(raw0) >> 16, int(raw1 << 16) >> 16, int(raw1) >> 16);
|
|
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);
|
|
s.offset = Point_read(PointRef(ref.offset + 12));
|
|
return s;
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
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];
|
|
}
|
|
|
|
SimpleGroup PietItem_Group_read(PietItemRef ref) {
|
|
return SimpleGroup_read(SimpleGroupRef(ref.offset + 4));
|
|
}
|
|
|
|
PietCircle PietItem_Circle_read(PietItemRef ref) {
|
|
return PietCircle_read(PietCircleRef(ref.offset + 4));
|
|
}
|
|
|
|
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));
|
|
}
|
|
|