mirror of
https://github.com/italicsjenga/vello.git
synced 2025-01-11 04:51:32 +11:00
131 lines
3.1 KiB
C
131 lines
3.1 KiB
C
|
// Code auto-generated by piet-gpu-derive
|
||
|
|
||
|
struct FillTileHeaderRef {
|
||
|
uint offset;
|
||
|
};
|
||
|
|
||
|
struct FillItemHeaderRef {
|
||
|
uint offset;
|
||
|
};
|
||
|
|
||
|
struct FillSegmentRef {
|
||
|
uint offset;
|
||
|
};
|
||
|
|
||
|
struct FillSegChunkRef {
|
||
|
uint offset;
|
||
|
};
|
||
|
|
||
|
struct FillTileHeader {
|
||
|
uint n;
|
||
|
FillItemHeaderRef items;
|
||
|
};
|
||
|
|
||
|
#define FillTileHeader_size 8
|
||
|
|
||
|
FillTileHeaderRef FillTileHeader_index(FillTileHeaderRef ref, uint index) {
|
||
|
return FillTileHeaderRef(ref.offset + index * FillTileHeader_size);
|
||
|
}
|
||
|
|
||
|
struct FillItemHeader {
|
||
|
int backdrop;
|
||
|
FillSegChunkRef segments;
|
||
|
};
|
||
|
|
||
|
#define FillItemHeader_size 8
|
||
|
|
||
|
FillItemHeaderRef FillItemHeader_index(FillItemHeaderRef ref, uint index) {
|
||
|
return FillItemHeaderRef(ref.offset + index * FillItemHeader_size);
|
||
|
}
|
||
|
|
||
|
struct FillSegment {
|
||
|
vec2 start;
|
||
|
vec2 end;
|
||
|
};
|
||
|
|
||
|
#define FillSegment_size 16
|
||
|
|
||
|
FillSegmentRef FillSegment_index(FillSegmentRef ref, uint index) {
|
||
|
return FillSegmentRef(ref.offset + index * FillSegment_size);
|
||
|
}
|
||
|
|
||
|
struct FillSegChunk {
|
||
|
uint n;
|
||
|
FillSegChunkRef next;
|
||
|
};
|
||
|
|
||
|
#define FillSegChunk_size 8
|
||
|
|
||
|
FillSegChunkRef FillSegChunk_index(FillSegChunkRef ref, uint index) {
|
||
|
return FillSegChunkRef(ref.offset + index * FillSegChunk_size);
|
||
|
}
|
||
|
|
||
|
FillTileHeader FillTileHeader_read(FillTileHeaderRef ref) {
|
||
|
uint ix = ref.offset >> 2;
|
||
|
uint raw0 = fill_seg[ix + 0];
|
||
|
uint raw1 = fill_seg[ix + 1];
|
||
|
FillTileHeader s;
|
||
|
s.n = raw0;
|
||
|
s.items = FillItemHeaderRef(raw1);
|
||
|
return s;
|
||
|
}
|
||
|
|
||
|
void FillTileHeader_write(FillTileHeaderRef ref, FillTileHeader s) {
|
||
|
uint ix = ref.offset >> 2;
|
||
|
fill_seg[ix + 0] = s.n;
|
||
|
fill_seg[ix + 1] = s.items.offset;
|
||
|
}
|
||
|
|
||
|
FillItemHeader FillItemHeader_read(FillItemHeaderRef ref) {
|
||
|
uint ix = ref.offset >> 2;
|
||
|
uint raw0 = fill_seg[ix + 0];
|
||
|
uint raw1 = fill_seg[ix + 1];
|
||
|
FillItemHeader s;
|
||
|
s.backdrop = int(raw0);
|
||
|
s.segments = FillSegChunkRef(raw1);
|
||
|
return s;
|
||
|
}
|
||
|
|
||
|
void FillItemHeader_write(FillItemHeaderRef ref, FillItemHeader s) {
|
||
|
uint ix = ref.offset >> 2;
|
||
|
fill_seg[ix + 0] = uint(s.backdrop);
|
||
|
fill_seg[ix + 1] = s.segments.offset;
|
||
|
}
|
||
|
|
||
|
FillSegment FillSegment_read(FillSegmentRef ref) {
|
||
|
uint ix = ref.offset >> 2;
|
||
|
uint raw0 = fill_seg[ix + 0];
|
||
|
uint raw1 = fill_seg[ix + 1];
|
||
|
uint raw2 = fill_seg[ix + 2];
|
||
|
uint raw3 = fill_seg[ix + 3];
|
||
|
FillSegment s;
|
||
|
s.start = vec2(uintBitsToFloat(raw0), uintBitsToFloat(raw1));
|
||
|
s.end = vec2(uintBitsToFloat(raw2), uintBitsToFloat(raw3));
|
||
|
return s;
|
||
|
}
|
||
|
|
||
|
void FillSegment_write(FillSegmentRef ref, FillSegment s) {
|
||
|
uint ix = ref.offset >> 2;
|
||
|
fill_seg[ix + 0] = floatBitsToUint(s.start.x);
|
||
|
fill_seg[ix + 1] = floatBitsToUint(s.start.y);
|
||
|
fill_seg[ix + 2] = floatBitsToUint(s.end.x);
|
||
|
fill_seg[ix + 3] = floatBitsToUint(s.end.y);
|
||
|
}
|
||
|
|
||
|
FillSegChunk FillSegChunk_read(FillSegChunkRef ref) {
|
||
|
uint ix = ref.offset >> 2;
|
||
|
uint raw0 = fill_seg[ix + 0];
|
||
|
uint raw1 = fill_seg[ix + 1];
|
||
|
FillSegChunk s;
|
||
|
s.n = raw0;
|
||
|
s.next = FillSegChunkRef(raw1);
|
||
|
return s;
|
||
|
}
|
||
|
|
||
|
void FillSegChunk_write(FillSegChunkRef ref, FillSegChunk s) {
|
||
|
uint ix = ref.offset >> 2;
|
||
|
fill_seg[ix + 0] = s.n;
|
||
|
fill_seg[ix + 1] = s.next.offset;
|
||
|
}
|
||
|
|