// Code auto-generated by piet-gpu-derive struct AnnoFillLineSegRef { uint offset; }; struct AnnoStrokeLineSegRef { uint offset; }; struct AnnoQuadSegRef { uint offset; }; struct AnnoCubicSegRef { uint offset; }; struct AnnoFillRef { uint offset; }; struct AnnoStrokeRef { uint offset; }; struct AnnotatedRef { uint offset; }; struct AnnoFillLineSeg { vec2 p0; vec2 p1; uint path_ix; }; #define AnnoFillLineSeg_size 20 AnnoFillLineSegRef AnnoFillLineSeg_index(AnnoFillLineSegRef ref, uint index) { return AnnoFillLineSegRef(ref.offset + index * AnnoFillLineSeg_size); } struct AnnoStrokeLineSeg { vec2 p0; vec2 p1; uint path_ix; vec2 stroke; }; #define AnnoStrokeLineSeg_size 28 AnnoStrokeLineSegRef AnnoStrokeLineSeg_index(AnnoStrokeLineSegRef ref, uint index) { return AnnoStrokeLineSegRef(ref.offset + index * AnnoStrokeLineSeg_size); } struct AnnoQuadSeg { vec2 p0; vec2 p1; vec2 p2; vec2 stroke; }; #define AnnoQuadSeg_size 32 AnnoQuadSegRef AnnoQuadSeg_index(AnnoQuadSegRef ref, uint index) { return AnnoQuadSegRef(ref.offset + index * AnnoQuadSeg_size); } struct AnnoCubicSeg { vec2 p0; vec2 p1; vec2 p2; vec2 p3; vec2 stroke; }; #define AnnoCubicSeg_size 40 AnnoCubicSegRef AnnoCubicSeg_index(AnnoCubicSegRef ref, uint index) { return AnnoCubicSegRef(ref.offset + index * AnnoCubicSeg_size); } struct AnnoFill { uint rgba_color; vec4 bbox; }; #define AnnoFill_size 20 AnnoFillRef AnnoFill_index(AnnoFillRef ref, uint index) { return AnnoFillRef(ref.offset + index * AnnoFill_size); } struct AnnoStroke { uint rgba_color; vec4 bbox; float linewidth; }; #define AnnoStroke_size 24 AnnoStrokeRef AnnoStroke_index(AnnoStrokeRef ref, uint index) { return AnnoStrokeRef(ref.offset + index * AnnoStroke_size); } #define Annotated_Nop 0 #define Annotated_FillLine 1 #define Annotated_StrokeLine 2 #define Annotated_Quad 3 #define Annotated_Cubic 4 #define Annotated_Stroke 5 #define Annotated_Fill 6 #define Annotated_size 44 AnnotatedRef Annotated_index(AnnotatedRef ref, uint index) { return AnnotatedRef(ref.offset + index * Annotated_size); } AnnoFillLineSeg AnnoFillLineSeg_read(AnnoFillLineSegRef ref) { uint ix = ref.offset >> 2; uint raw0 = annotated[ix + 0]; uint raw1 = annotated[ix + 1]; uint raw2 = annotated[ix + 2]; uint raw3 = annotated[ix + 3]; uint raw4 = annotated[ix + 4]; AnnoFillLineSeg s; s.p0 = vec2(uintBitsToFloat(raw0), uintBitsToFloat(raw1)); s.p1 = vec2(uintBitsToFloat(raw2), uintBitsToFloat(raw3)); s.path_ix = raw4; return s; } void AnnoFillLineSeg_write(AnnoFillLineSegRef ref, AnnoFillLineSeg s) { uint ix = ref.offset >> 2; annotated[ix + 0] = floatBitsToUint(s.p0.x); annotated[ix + 1] = floatBitsToUint(s.p0.y); annotated[ix + 2] = floatBitsToUint(s.p1.x); annotated[ix + 3] = floatBitsToUint(s.p1.y); annotated[ix + 4] = s.path_ix; } AnnoStrokeLineSeg AnnoStrokeLineSeg_read(AnnoStrokeLineSegRef ref) { uint ix = ref.offset >> 2; uint raw0 = annotated[ix + 0]; uint raw1 = annotated[ix + 1]; uint raw2 = annotated[ix + 2]; uint raw3 = annotated[ix + 3]; uint raw4 = annotated[ix + 4]; uint raw5 = annotated[ix + 5]; uint raw6 = annotated[ix + 6]; AnnoStrokeLineSeg s; s.p0 = vec2(uintBitsToFloat(raw0), uintBitsToFloat(raw1)); s.p1 = vec2(uintBitsToFloat(raw2), uintBitsToFloat(raw3)); s.path_ix = raw4; s.stroke = vec2(uintBitsToFloat(raw5), uintBitsToFloat(raw6)); return s; } void AnnoStrokeLineSeg_write(AnnoStrokeLineSegRef ref, AnnoStrokeLineSeg s) { uint ix = ref.offset >> 2; annotated[ix + 0] = floatBitsToUint(s.p0.x); annotated[ix + 1] = floatBitsToUint(s.p0.y); annotated[ix + 2] = floatBitsToUint(s.p1.x); annotated[ix + 3] = floatBitsToUint(s.p1.y); annotated[ix + 4] = s.path_ix; annotated[ix + 5] = floatBitsToUint(s.stroke.x); annotated[ix + 6] = floatBitsToUint(s.stroke.y); } AnnoQuadSeg AnnoQuadSeg_read(AnnoQuadSegRef ref) { uint ix = ref.offset >> 2; uint raw0 = annotated[ix + 0]; uint raw1 = annotated[ix + 1]; uint raw2 = annotated[ix + 2]; uint raw3 = annotated[ix + 3]; uint raw4 = annotated[ix + 4]; uint raw5 = annotated[ix + 5]; uint raw6 = annotated[ix + 6]; uint raw7 = annotated[ix + 7]; AnnoQuadSeg s; s.p0 = vec2(uintBitsToFloat(raw0), uintBitsToFloat(raw1)); s.p1 = vec2(uintBitsToFloat(raw2), uintBitsToFloat(raw3)); s.p2 = vec2(uintBitsToFloat(raw4), uintBitsToFloat(raw5)); s.stroke = vec2(uintBitsToFloat(raw6), uintBitsToFloat(raw7)); return s; } void AnnoQuadSeg_write(AnnoQuadSegRef ref, AnnoQuadSeg s) { uint ix = ref.offset >> 2; annotated[ix + 0] = floatBitsToUint(s.p0.x); annotated[ix + 1] = floatBitsToUint(s.p0.y); annotated[ix + 2] = floatBitsToUint(s.p1.x); annotated[ix + 3] = floatBitsToUint(s.p1.y); annotated[ix + 4] = floatBitsToUint(s.p2.x); annotated[ix + 5] = floatBitsToUint(s.p2.y); annotated[ix + 6] = floatBitsToUint(s.stroke.x); annotated[ix + 7] = floatBitsToUint(s.stroke.y); } AnnoCubicSeg AnnoCubicSeg_read(AnnoCubicSegRef ref) { uint ix = ref.offset >> 2; uint raw0 = annotated[ix + 0]; uint raw1 = annotated[ix + 1]; uint raw2 = annotated[ix + 2]; uint raw3 = annotated[ix + 3]; uint raw4 = annotated[ix + 4]; uint raw5 = annotated[ix + 5]; uint raw6 = annotated[ix + 6]; uint raw7 = annotated[ix + 7]; uint raw8 = annotated[ix + 8]; uint raw9 = annotated[ix + 9]; AnnoCubicSeg 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)); s.stroke = vec2(uintBitsToFloat(raw8), uintBitsToFloat(raw9)); return s; } void AnnoCubicSeg_write(AnnoCubicSegRef ref, AnnoCubicSeg s) { uint ix = ref.offset >> 2; annotated[ix + 0] = floatBitsToUint(s.p0.x); annotated[ix + 1] = floatBitsToUint(s.p0.y); annotated[ix + 2] = floatBitsToUint(s.p1.x); annotated[ix + 3] = floatBitsToUint(s.p1.y); annotated[ix + 4] = floatBitsToUint(s.p2.x); annotated[ix + 5] = floatBitsToUint(s.p2.y); annotated[ix + 6] = floatBitsToUint(s.p3.x); annotated[ix + 7] = floatBitsToUint(s.p3.y); annotated[ix + 8] = floatBitsToUint(s.stroke.x); annotated[ix + 9] = floatBitsToUint(s.stroke.y); } AnnoFill AnnoFill_read(AnnoFillRef ref) { uint ix = ref.offset >> 2; uint raw0 = annotated[ix + 0]; uint raw1 = annotated[ix + 1]; uint raw2 = annotated[ix + 2]; uint raw3 = annotated[ix + 3]; uint raw4 = annotated[ix + 4]; AnnoFill s; s.rgba_color = raw0; s.bbox = vec4(uintBitsToFloat(raw1), uintBitsToFloat(raw2), uintBitsToFloat(raw3), uintBitsToFloat(raw4)); return s; } void AnnoFill_write(AnnoFillRef ref, AnnoFill s) { uint ix = ref.offset >> 2; annotated[ix + 0] = s.rgba_color; annotated[ix + 1] = floatBitsToUint(s.bbox.x); annotated[ix + 2] = floatBitsToUint(s.bbox.y); annotated[ix + 3] = floatBitsToUint(s.bbox.z); annotated[ix + 4] = floatBitsToUint(s.bbox.w); } AnnoStroke AnnoStroke_read(AnnoStrokeRef ref) { uint ix = ref.offset >> 2; uint raw0 = annotated[ix + 0]; uint raw1 = annotated[ix + 1]; uint raw2 = annotated[ix + 2]; uint raw3 = annotated[ix + 3]; uint raw4 = annotated[ix + 4]; uint raw5 = annotated[ix + 5]; AnnoStroke s; s.rgba_color = raw0; s.bbox = vec4(uintBitsToFloat(raw1), uintBitsToFloat(raw2), uintBitsToFloat(raw3), uintBitsToFloat(raw4)); s.linewidth = uintBitsToFloat(raw5); return s; } void AnnoStroke_write(AnnoStrokeRef ref, AnnoStroke s) { uint ix = ref.offset >> 2; annotated[ix + 0] = s.rgba_color; annotated[ix + 1] = floatBitsToUint(s.bbox.x); annotated[ix + 2] = floatBitsToUint(s.bbox.y); annotated[ix + 3] = floatBitsToUint(s.bbox.z); annotated[ix + 4] = floatBitsToUint(s.bbox.w); annotated[ix + 5] = floatBitsToUint(s.linewidth); } uint Annotated_tag(AnnotatedRef ref) { return annotated[ref.offset >> 2]; } AnnoFillLineSeg Annotated_FillLine_read(AnnotatedRef ref) { return AnnoFillLineSeg_read(AnnoFillLineSegRef(ref.offset + 4)); } AnnoStrokeLineSeg Annotated_StrokeLine_read(AnnotatedRef ref) { return AnnoStrokeLineSeg_read(AnnoStrokeLineSegRef(ref.offset + 4)); } AnnoQuadSeg Annotated_Quad_read(AnnotatedRef ref) { return AnnoQuadSeg_read(AnnoQuadSegRef(ref.offset + 4)); } AnnoCubicSeg Annotated_Cubic_read(AnnotatedRef ref) { return AnnoCubicSeg_read(AnnoCubicSegRef(ref.offset + 4)); } AnnoStroke Annotated_Stroke_read(AnnotatedRef ref) { return AnnoStroke_read(AnnoStrokeRef(ref.offset + 4)); } AnnoFill Annotated_Fill_read(AnnotatedRef ref) { return AnnoFill_read(AnnoFillRef(ref.offset + 4)); } void Annotated_Nop_write(AnnotatedRef ref) { annotated[ref.offset >> 2] = Annotated_Nop; } void Annotated_FillLine_write(AnnotatedRef ref, AnnoFillLineSeg s) { annotated[ref.offset >> 2] = Annotated_FillLine; AnnoFillLineSeg_write(AnnoFillLineSegRef(ref.offset + 4), s); } void Annotated_StrokeLine_write(AnnotatedRef ref, AnnoStrokeLineSeg s) { annotated[ref.offset >> 2] = Annotated_StrokeLine; AnnoStrokeLineSeg_write(AnnoStrokeLineSegRef(ref.offset + 4), s); } void Annotated_Quad_write(AnnotatedRef ref, AnnoQuadSeg s) { annotated[ref.offset >> 2] = Annotated_Quad; AnnoQuadSeg_write(AnnoQuadSegRef(ref.offset + 4), s); } void Annotated_Cubic_write(AnnotatedRef ref, AnnoCubicSeg s) { annotated[ref.offset >> 2] = Annotated_Cubic; AnnoCubicSeg_write(AnnoCubicSegRef(ref.offset + 4), s); } void Annotated_Stroke_write(AnnotatedRef ref, AnnoStroke s) { annotated[ref.offset >> 2] = Annotated_Stroke; AnnoStroke_write(AnnoStrokeRef(ref.offset + 4), s); } void Annotated_Fill_write(AnnotatedRef ref, AnnoFill s) { annotated[ref.offset >> 2] = Annotated_Fill; AnnoFill_write(AnnoFillRef(ref.offset + 4), s); }