diff --git a/piet-gpu-types/src/annotated.rs b/piet-gpu-types/src/annotated.rs index d53d870..0e36f62 100644 --- a/piet-gpu-types/src/annotated.rs +++ b/piet-gpu-types/src/annotated.rs @@ -3,35 +3,6 @@ use piet_gpu_derive::piet_gpu; piet_gpu! { #[gpu_write] mod annotated { - // Note: path segments have moved to pathseg, delete these. - struct AnnoFillLineSeg { - p0: [f32; 2], - p1: [f32; 2], - path_ix: u32, - // A note: the layout of this struct is shared with - // AnnoStrokeLineSeg. In that case, we actually write - // [0.0, 0.0] as the stroke field, to minimize divergence. - } - struct AnnoStrokeLineSeg { - p0: [f32; 2], - p1: [f32; 2], - path_ix: u32, - // halfwidth in both x and y for binning - stroke: [f32; 2], - } - struct AnnoQuadSeg { - p0: [f32; 2], - p1: [f32; 2], - p2: [f32; 2], - stroke: [f32; 2], - } - struct AnnoCubicSeg { - p0: [f32; 2], - p1: [f32; 2], - p2: [f32; 2], - p3: [f32; 2], - stroke: [f32; 2], - } struct AnnoFill { rgba_color: u32, bbox: [f32; 4], @@ -45,10 +16,6 @@ piet_gpu! { } enum Annotated { Nop, - FillLine(AnnoFillLineSeg), - StrokeLine(AnnoStrokeLineSeg), - Quad(AnnoQuadSeg), - Cubic(AnnoCubicSeg), Stroke(AnnoStroke), Fill(AnnoFill), } diff --git a/piet-gpu/shader/annotated.h b/piet-gpu/shader/annotated.h index f243fab..5dcb4ad 100644 --- a/piet-gpu/shader/annotated.h +++ b/piet-gpu/shader/annotated.h @@ -1,21 +1,5 @@ // 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; }; @@ -28,58 +12,6 @@ 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; @@ -104,134 +36,14 @@ AnnoStrokeRef AnnoStroke_index(AnnoStrokeRef ref, uint index) { } #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 +#define Annotated_Stroke 1 +#define Annotated_Fill 2 +#define Annotated_size 28 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]; @@ -283,22 +95,6 @@ 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)); } @@ -311,26 +107,6 @@ 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); diff --git a/piet-gpu/shader/backdrop.spv b/piet-gpu/shader/backdrop.spv index 67d05df..fdbb4f1 100644 Binary files a/piet-gpu/shader/backdrop.spv and b/piet-gpu/shader/backdrop.spv differ diff --git a/piet-gpu/shader/binning.spv b/piet-gpu/shader/binning.spv index 98f1d4e..d1c469c 100644 Binary files a/piet-gpu/shader/binning.spv and b/piet-gpu/shader/binning.spv differ diff --git a/piet-gpu/shader/coarse.spv b/piet-gpu/shader/coarse.spv index 757b8b2..29c430f 100644 Binary files a/piet-gpu/shader/coarse.spv and b/piet-gpu/shader/coarse.spv differ diff --git a/piet-gpu/shader/elements.spv b/piet-gpu/shader/elements.spv index 54c5cc0..4b7a1c2 100644 Binary files a/piet-gpu/shader/elements.spv and b/piet-gpu/shader/elements.spv differ diff --git a/piet-gpu/shader/tile_alloc.spv b/piet-gpu/shader/tile_alloc.spv index 4eae6b8..e012b7c 100644 Binary files a/piet-gpu/shader/tile_alloc.spv and b/piet-gpu/shader/tile_alloc.spv differ