From dceb0f941246a3961e2bb3212e468eee2bedde8b Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Mon, 21 Sep 2020 10:24:18 +0200 Subject: [PATCH 1/3] piet-gpu-types: remove unused annotated types Signed-off-by: Elias Naur --- piet-gpu-types/src/annotated.rs | 33 ----- piet-gpu/shader/annotated.h | 230 +------------------------------- piet-gpu/shader/backdrop.spv | Bin 7272 -> 7256 bytes piet-gpu/shader/binning.spv | Bin 10136 -> 10136 bytes piet-gpu/shader/coarse.spv | Bin 30904 -> 30904 bytes piet-gpu/shader/elements.spv | Bin 52988 -> 52988 bytes piet-gpu/shader/tile_alloc.spv | Bin 8800 -> 8800 bytes 7 files changed, 3 insertions(+), 260 deletions(-) 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 67d05dfb6314282d14da2f770eeaf1950d5a02f2..fdbb4f1b1a11f1c4901d4b7fa46b750ae3efe68c 100644 GIT binary patch literal 7256 zcmZ{n33QcL5ywAxN!WKNWl!LoT1&xF=?bl+TR^EG?Kvtg&zIyuqmP#~d4aZ~jcvuX z?i;RA(P}sAzH0>(cWvFVD()L<-MXL!f4}#>fonW|J=6LBXXehGJ9obCg~I41W3p^i zHkSXEjLPcIv}`n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F%xC&IOvXCo6b1>K2QgL|0681MZO^poniaqpf*ZhX|R n5$yT=f99#^C)aUf{U-3Gh_e*$vfLQgPeWgZ=y%q|&ia1)UYtei{?3=Btsm~rz%f$d@db$kbi delta 29 jcmbQ?Kf`|m3pb)UYtek8N3=Btsn050*f$d@dcN_fGj53>9HBXoF-e6#0aAaU*-~`fXlN;v=Z~ib(fsywfl5o-FgY$(q J8!R}Z2LMiW5<~z1 delta 62 zcmew}m-)|J<_#>Gj5?cHHBXoFN;5JrI5My@a56A3q)l#|C%pN?JOxJHC?w&c$p_~P KZ#GzPMh^fbWf2ts diff --git a/piet-gpu/shader/tile_alloc.spv b/piet-gpu/shader/tile_alloc.spv index 4eae6b8762b627c104810ad770c1298e6e6a49bb..e012b7c5d0f5f04473cc628eba3bbdedfee36b25 100644 GIT binary patch delta 29 jcmaFh^1x+-3m2ozW>>EFESyXX3=F%0m~pc$zp^j@iz^3J delta 29 jcmaFh^1x+-3m2o#W>>EFESzi%3=F%0n02!)zp^j@jLQdY From fa9bf0dc2b9f4693d60314213930b7949838cea1 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Sun, 27 Sep 2020 18:30:33 +0200 Subject: [PATCH 2/3] piet-gpu-types: remove unused ptcl types Signed-off-by: Elias Naur --- piet-gpu-types/src/ptcl.rs | 12 ----- piet-gpu/shader/coarse.spv | Bin 30904 -> 30904 bytes piet-gpu/shader/kernel4.spv | Bin 20760 -> 20760 bytes piet-gpu/shader/ptcl.h | 91 +----------------------------------- 4 files changed, 2 insertions(+), 101 deletions(-) diff --git a/piet-gpu-types/src/ptcl.rs b/piet-gpu-types/src/ptcl.rs index 96c0ecc..1deac38 100644 --- a/piet-gpu-types/src/ptcl.rs +++ b/piet-gpu-types/src/ptcl.rs @@ -25,15 +25,6 @@ piet_gpu! { backdrop: i32, rgba_color: u32, } - struct CmdFillEdge { - // The sign is only one bit. - sign: i32, - y: f32, - } - struct CmdDrawFill { - backdrop: i32, - rgba_color: u32, - } struct CmdSolid { rgba_color: u32, } @@ -46,11 +37,8 @@ piet_gpu! { Line(CmdLine), Fill(CmdFill), Stroke(CmdStroke), - FillEdge(CmdFillEdge), - DrawFill(CmdDrawFill), Solid(CmdSolid), Jump(CmdJump), - Bail, } // TODO: strongly consider using f16. If so, these would be diff --git a/piet-gpu/shader/coarse.spv b/piet-gpu/shader/coarse.spv index 29c430fb7be63bfae1cd5bfef60277e6f724c028..334e1f52bc8e29efd23b1a54a5f058a4a0761b45 100644 GIT binary patch delta 260 zcmdn-k#WaI#tmzD8ShV?%PYV646g-0>oZ0M2DZ(dvfkl>_km1y1_lOe1{Q`0ApKx+ zYKgn*Eud%%5Vr$GZUSjL24)73*h3)Sk%5 Z27ve6d70^A1q-HV`)eMcII&cY$n> z*lHj<0BB|?kiG}xgTz6mfb0YDZGm#(K)HuNb|sJo$vptFL3~S~NlZYoM?iKAkOt{_ zFqyGXcydB%2;<|)f@Q*@Pk>^Nf%p*A-lstJlgW2WrFlUtkZI3>^s~*ZWt*7*lHNFB delta 260 zcmXYqu@1pt5XbLBiQx-PnZzibL4?HA!D1ja7%T>(q-|m|NIbyz7z~mw9ay}95iLr~ z+&A#Q#Blll?svI6KNWr|_B*K#vMeI+D9w^~6+{KESnpfAbBTJVqvJMGZeAXU89=7#i-N&?+2Wy(5Xo#zV<~{Jk9koKbrbCsQ>@~ diff --git a/piet-gpu/shader/kernel4.spv b/piet-gpu/shader/kernel4.spv index 6f50746197f173e9b71a494ce9a57b417b8b1eb6..84919e07df997d9280b068322fe37e750b44a3a7 100644 GIT binary patch delta 24 gcmbQSh;hau#tjRkI9VAO80IlDFtBZ2DV1*q09|?puK)l5 delta 24 gcmbQSh;hau#tjRkIN2E(80IlDFmP;MDV1*q09~R6vj6}9 diff --git a/piet-gpu/shader/ptcl.h b/piet-gpu/shader/ptcl.h index 0c20a89..c9be302 100644 --- a/piet-gpu/shader/ptcl.h +++ b/piet-gpu/shader/ptcl.h @@ -16,14 +16,6 @@ struct CmdFillRef { uint offset; }; -struct CmdFillEdgeRef { - uint offset; -}; - -struct CmdDrawFillRef { - uint offset; -}; - struct CmdSolidRef { uint offset; }; @@ -91,28 +83,6 @@ CmdFillRef CmdFill_index(CmdFillRef ref, uint index) { return CmdFillRef(ref.offset + index * CmdFill_size); } -struct CmdFillEdge { - int sign; - float y; -}; - -#define CmdFillEdge_size 8 - -CmdFillEdgeRef CmdFillEdge_index(CmdFillEdgeRef ref, uint index) { - return CmdFillEdgeRef(ref.offset + index * CmdFillEdge_size); -} - -struct CmdDrawFill { - int backdrop; - uint rgba_color; -}; - -#define CmdDrawFill_size 8 - -CmdDrawFillRef CmdDrawFill_index(CmdDrawFillRef ref, uint index) { - return CmdDrawFillRef(ref.offset + index * CmdDrawFill_size); -} - struct CmdSolid { uint rgba_color; }; @@ -138,11 +108,8 @@ CmdJumpRef CmdJump_index(CmdJumpRef ref, uint index) { #define Cmd_Line 2 #define Cmd_Fill 3 #define Cmd_Stroke 4 -#define Cmd_FillEdge 5 -#define Cmd_DrawFill 6 -#define Cmd_Solid 7 -#define Cmd_Jump 8 -#define Cmd_Bail 9 +#define Cmd_Solid 5 +#define Cmd_Jump 6 #define Cmd_size 20 CmdRef Cmd_index(CmdRef ref, uint index) { @@ -252,38 +219,6 @@ void CmdFill_write(CmdFillRef ref, CmdFill s) { ptcl[ix + 2] = s.rgba_color; } -CmdFillEdge CmdFillEdge_read(CmdFillEdgeRef ref) { - uint ix = ref.offset >> 2; - uint raw0 = ptcl[ix + 0]; - uint raw1 = ptcl[ix + 1]; - CmdFillEdge s; - s.sign = int(raw0); - s.y = uintBitsToFloat(raw1); - return s; -} - -void CmdFillEdge_write(CmdFillEdgeRef ref, CmdFillEdge s) { - uint ix = ref.offset >> 2; - ptcl[ix + 0] = uint(s.sign); - ptcl[ix + 1] = floatBitsToUint(s.y); -} - -CmdDrawFill CmdDrawFill_read(CmdDrawFillRef ref) { - uint ix = ref.offset >> 2; - uint raw0 = ptcl[ix + 0]; - uint raw1 = ptcl[ix + 1]; - CmdDrawFill s; - s.backdrop = int(raw0); - s.rgba_color = raw1; - return s; -} - -void CmdDrawFill_write(CmdDrawFillRef ref, CmdDrawFill s) { - uint ix = ref.offset >> 2; - ptcl[ix + 0] = uint(s.backdrop); - ptcl[ix + 1] = s.rgba_color; -} - CmdSolid CmdSolid_read(CmdSolidRef ref) { uint ix = ref.offset >> 2; uint raw0 = ptcl[ix + 0]; @@ -330,14 +265,6 @@ CmdStroke Cmd_Stroke_read(CmdRef ref) { return CmdStroke_read(CmdStrokeRef(ref.offset + 4)); } -CmdFillEdge Cmd_FillEdge_read(CmdRef ref) { - return CmdFillEdge_read(CmdFillEdgeRef(ref.offset + 4)); -} - -CmdDrawFill Cmd_DrawFill_read(CmdRef ref) { - return CmdDrawFill_read(CmdDrawFillRef(ref.offset + 4)); -} - CmdSolid Cmd_Solid_read(CmdRef ref) { return CmdSolid_read(CmdSolidRef(ref.offset + 4)); } @@ -370,16 +297,6 @@ void Cmd_Stroke_write(CmdRef ref, CmdStroke s) { CmdStroke_write(CmdStrokeRef(ref.offset + 4), s); } -void Cmd_FillEdge_write(CmdRef ref, CmdFillEdge s) { - ptcl[ref.offset >> 2] = Cmd_FillEdge; - CmdFillEdge_write(CmdFillEdgeRef(ref.offset + 4), s); -} - -void Cmd_DrawFill_write(CmdRef ref, CmdDrawFill s) { - ptcl[ref.offset >> 2] = Cmd_DrawFill; - CmdDrawFill_write(CmdDrawFillRef(ref.offset + 4), s); -} - void Cmd_Solid_write(CmdRef ref, CmdSolid s) { ptcl[ref.offset >> 2] = Cmd_Solid; CmdSolid_write(CmdSolidRef(ref.offset + 4), s); @@ -390,10 +307,6 @@ void Cmd_Jump_write(CmdRef ref, CmdJump s) { CmdJump_write(CmdJumpRef(ref.offset + 4), s); } -void Cmd_Bail_write(CmdRef ref) { - ptcl[ref.offset >> 2] = Cmd_Bail; -} - Segment Segment_read(SegmentRef ref) { uint ix = ref.offset >> 2; uint raw0 = ptcl[ix + 0]; From 9be0faba6fd45afe8b830a96c37f035aac233d00 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Sun, 27 Sep 2020 18:57:53 +0200 Subject: [PATCH 3/3] piet-gpu-types: remove unused scene elements Delete image compute shader as well; it is unused. Signed-off-by: Elias Naur --- piet-gpu-types/src/scene.rs | 50 -------- piet-gpu/shader/build.ninja | 2 - piet-gpu/shader/image.comp | 54 --------- piet-gpu/shader/image.spv | Bin 8116 -> 0 bytes piet-gpu/shader/scene.h | 236 ------------------------------------ 5 files changed, 342 deletions(-) delete mode 100644 piet-gpu/shader/image.comp delete mode 100644 piet-gpu/shader/image.spv diff --git a/piet-gpu-types/src/scene.rs b/piet-gpu-types/src/scene.rs index 5e4899f..0d72650 100644 --- a/piet-gpu-types/src/scene.rs +++ b/piet-gpu-types/src/scene.rs @@ -1,60 +1,10 @@ use piet_gpu_derive::piet_gpu; -pub use self::scene::{ - Bbox, PietCircle, PietFill, PietItem, PietStrokeLine, PietStrokePolyLine, Point, SimpleGroup, -}; - pub use self::scene::{CubicSeg, Element, Fill, LineSeg, QuadSeg, SetLineWidth, Stroke, Transform}; piet_gpu! { #[rust_encode] mod scene { - struct Bbox { - bbox: [i16; 4], - } - struct Point { - xy: [f32; 2], - } - struct SimpleGroup { - n_items: u32, - // Note: both of the following items are actually arrays - items: Ref, - bboxes: Ref, - offset: Point, - } - struct PietCircle { - rgba_color: u32, - center: Point, - radius: f32, - } - struct PietStrokeLine { - flags: u32, - rgba_color: u32, - width: f32, - start: Point, - end: Point, - } - struct PietFill { - flags: u32, - rgba_color: u32, - n_points: u32, - points: Ref, - } - struct PietStrokePolyLine { - rgba_color: u32, - width: f32, - n_points: u32, - points: Ref, - } - enum PietItem { - Group(SimpleGroup), - Circle(PietCircle), - Line(PietStrokeLine), - Fill(PietFill), - Poly(PietStrokePolyLine), - } - - // New approach follows (above to be deleted) struct LineSeg { p0: [f32; 2], p1: [f32; 2], diff --git a/piet-gpu/shader/build.ninja b/piet-gpu/shader/build.ninja index 13fb1b2..cce8615 100644 --- a/piet-gpu/shader/build.ninja +++ b/piet-gpu/shader/build.ninja @@ -7,8 +7,6 @@ glslang_validator = glslangValidator rule glsl command = $glslang_validator -V -o $out $in -build image.spv: glsl image.comp | scene.h - build elements.spv: glsl elements.comp | scene.h state.h annotated.h diff --git a/piet-gpu/shader/image.comp b/piet-gpu/shader/image.comp deleted file mode 100644 index 6d84eb5..0000000 --- a/piet-gpu/shader/image.comp +++ /dev/null @@ -1,54 +0,0 @@ -// A simple kernel to create an image. - -// Right now, this kernel stores the image in a buffer, but a better -// plan is to use a texture. This is because of limited support. - -#version 450 -#extension GL_GOOGLE_include_directive : enable - -layout(local_size_x = 16, local_size_y = 16) in; - -layout(set = 0, binding = 0) readonly buffer SceneBuf { - uint[] scene; -}; - -layout(set = 0, binding = 1) buffer ImageBuf { - uint[] image; -}; - -#include "scene.h" - -// TODO: make the image size dynamic. -#define IMAGE_WIDTH 2048 -#define IMAGE_HEIGHT 1535 - -void main() { - uvec2 xy_uint = gl_GlobalInvocationID.xy; - vec2 xy = vec2(xy_uint); - vec2 uv = xy * vec2(1.0 / IMAGE_WIDTH, 1.0 / IMAGE_HEIGHT); - vec3 rgb = uv.xyy; - - // Render the scene. Right now, every pixel traverses the scene graph, - // which is horribly wasteful, but the goal is to get *some* output and - // then optimize. - - SimpleGroup group = PietItem_Group_read(PietItemRef(0)); - for (uint i = 0; i < group.n_items; i++) { - PietItemRef item_ref = PietItem_index(group.items, i); - uint tag = PietItem_tag(item_ref); - tag = PietItem_Circle; - if (tag == PietItem_Circle) { - PietCircle circle = PietItem_Circle_read(item_ref); - float r = length(xy + vec2(0.5, 0.5) - circle.center.xy); - float alpha = clamp(0.5 + circle.radius - r, 0.0, 1.0); - vec4 fg_rgba = unpackUnorm4x8(circle.rgba_color); - // TODO: sRGB - rgb = mix(rgb, fg_rgba.rgb, alpha * fg_rgba.a); - } - } - - // TODO: sRGB - uvec4 s = uvec4(round(vec4(rgb, 1.0) * 255.0)); - uint rgba_packed = s.r | (s.g << 8) | (s.b << 16) | (s.a << 24); - image[xy_uint.y * IMAGE_WIDTH + xy_uint.x] = rgba_packed; -} diff --git a/piet-gpu/shader/image.spv b/piet-gpu/shader/image.spv deleted file mode 100644 index 097add185fc152cd7131529812585e68b2eebfd6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8116 zcmaKv32I@<-hzc$!F2xx|XIyZ`1x73`DDEh(xS_a#%BFz7-+lMw-NqR&IsN|s|2g0J&bQtB zXc)g_Vv>wYCh_0-iF!;~UsabhTM2mODy9&jzw5$-R(5G9_u-R&3k8y=~h$#m<3&;!t&OPr2Ar=_?nz zDudl8#Eb+FmX9UR2(lR;lLGzkBykxtb6) zo&V}_#Y$gSd1Tp8b#S<|x+>Ru)o@G8hT)bC#5Pj@RN6suI_@-Z+AZ}pvL58?uk=+N zl*iRk^Qn(pNM^&+I9gXq?lZF2F{UK*z^T7DST1#q)|6#V3rcI5OI)p%3CWS*9hKgJ zo^sn@|L{Osf#a+DzG+wgh(X54ed;ld$pUyTUmB<8(^sspvO}Yqds|a#b2iR> z-o+T@p}OYDsgE%|Sp?6GamZ|QI%U@9ypTRI=O(Z_wYf6b*;7uZoYti7Qy;4_Sq!ho zTGND7Gj6bZSE<<9-_t)>tJPTN)LHJUmUEhO8Z32HhMAM+=U8|>=ON|S<^9_zo7ZylHs!E~xnosneRTEmdkcE&!9m z(o)|gv@CUschbgKUEumyg``sBS-(Q!iwOV8G-=;q+FG7May@vUG+64*d^gZW-kZSr zyf@eQDKu%G+h`-t9pHMNLUQ*Qe$Nmj@$c^uBMOmjbRh_8@51Mf`lU2W`V5Aio7&%wDmY2OK4rc%$qWu=VI zg75AwdhPHxB#Ys-b!|*mg46prQ0lzA+=ag}*@)KOTk6iAB{iRlI<0wHGp&uaa2+RL z1#Aod#@X|IxP|E8OW;0j^jGs8Wq;45?*X6S%{7{GzjJ;Ij?VmNGIo8uTFr*%^ILP| zx7K`qc{A}eY5r{h^Uud-^EUO}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Xt@J-njCpU3w?;MNo?~~{V*VcT{qDQnX9{*YaehChX4rSYG|V$TgEs0s6>LoY zy>J>_J!(1~Y~PsgIpOzh z-)+`>CRWQ;ueHm=w>{PCc`t;kdDbHDMc~M*Kl<(f>oc!wAP?V*!H#t$ zYv}v)C74?HUkbKQ_+JKA>tH?n_PrdlkGkvVck&gOYwP?RQ*N9&-OpEI`rT`B?DYch zBFyJ#%)OpZyAX4)kD-md-U-g{b=MeP8N>T>yb2!9anIBB8IQA2f;(>hEbM}-$64qE ztHoK^308}>D}&YI-0udf<Nw^@Dd}k@wYLwE-;7*dRFa>W{udV14Fwt>xj{19lFvwpV~%|2Q9VVo9d|@;u4?{pp#112zv+cbto9--ubqKFmIH z$zt%an9mZ-d(uq16!V@OM;rI#2JpljziAA=Imd4W-- zIP&U`zV89+Gp}nR58r#ijumV0KCtWL8W=A(Cj9RQk6oh=psB~4KL}R49gFkxA+WkR z@1T{(`S~!|^P?W;=ObY2hG%AJ zjJ!<_jSS@O80)GWl Vw^nn?> 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)); -} - LineSeg LineSeg_read(LineSegRef ref) { uint ix = ref.offset >> 2; uint raw0 = scene[ix + 0];