mirror of
https://github.com/italicsjenga/vello.git
synced 2025-01-10 12:41:30 +11:00
076e6d600d
Write the right_edge to the binning output. More work on encoding the fill/stroke distinction and plumbing that through the pipeline. This is a bit unsatisfying because of the code duplication; having an extra fill/stroke bool might be better, but I want to avoid making the structs bigger (this could be solved by better packing in the struct encoding). Fills are plumbed through to the last stage. Backdrop is WIP.
65 lines
1.3 KiB
C
65 lines
1.3 KiB
C
// Code auto-generated by piet-gpu-derive
|
|
|
|
struct BinInstanceRef {
|
|
uint offset;
|
|
};
|
|
|
|
struct BinChunkRef {
|
|
uint offset;
|
|
};
|
|
|
|
struct BinInstance {
|
|
uint element_ix;
|
|
float right_edge;
|
|
};
|
|
|
|
#define BinInstance_size 8
|
|
|
|
BinInstanceRef BinInstance_index(BinInstanceRef ref, uint index) {
|
|
return BinInstanceRef(ref.offset + index * BinInstance_size);
|
|
}
|
|
|
|
struct BinChunk {
|
|
uint n;
|
|
BinChunkRef next;
|
|
};
|
|
|
|
#define BinChunk_size 8
|
|
|
|
BinChunkRef BinChunk_index(BinChunkRef ref, uint index) {
|
|
return BinChunkRef(ref.offset + index * BinChunk_size);
|
|
}
|
|
|
|
BinInstance BinInstance_read(BinInstanceRef ref) {
|
|
uint ix = ref.offset >> 2;
|
|
uint raw0 = bins[ix + 0];
|
|
uint raw1 = bins[ix + 1];
|
|
BinInstance s;
|
|
s.element_ix = raw0;
|
|
s.right_edge = uintBitsToFloat(raw1);
|
|
return s;
|
|
}
|
|
|
|
void BinInstance_write(BinInstanceRef ref, BinInstance s) {
|
|
uint ix = ref.offset >> 2;
|
|
bins[ix + 0] = s.element_ix;
|
|
bins[ix + 1] = floatBitsToUint(s.right_edge);
|
|
}
|
|
|
|
BinChunk BinChunk_read(BinChunkRef ref) {
|
|
uint ix = ref.offset >> 2;
|
|
uint raw0 = bins[ix + 0];
|
|
uint raw1 = bins[ix + 1];
|
|
BinChunk s;
|
|
s.n = raw0;
|
|
s.next = BinChunkRef(raw1);
|
|
return s;
|
|
}
|
|
|
|
void BinChunk_write(BinChunkRef ref, BinChunk s) {
|
|
uint ix = ref.offset >> 2;
|
|
bins[ix + 0] = s.n;
|
|
bins[ix + 1] = s.next.offset;
|
|
}
|
|
|