From bd450ef46157e2b38a8abb2b074331da1bdbb203 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Sun, 29 Nov 2020 16:51:35 +0100 Subject: [PATCH] piet-gpu-types: remove unused Segment and SegChunk types Signed-off-by: Elias Naur --- piet-gpu-types/src/ptcl.rs | 19 ---------- piet-gpu/shader/ptcl.h | 74 -------------------------------------- 2 files changed, 93 deletions(-) diff --git a/piet-gpu-types/src/ptcl.rs b/piet-gpu-types/src/ptcl.rs index 86e4572..00da859 100644 --- a/piet-gpu-types/src/ptcl.rs +++ b/piet-gpu-types/src/ptcl.rs @@ -67,24 +67,5 @@ piet_gpu! { SolidMask(CmdSolidMask), Jump(CmdJump), } - - // TODO: strongly consider using f16. If so, these would be - // relative to the tile. We're doing f32 for now to minimize - // divergence from piet-metal originals. - struct Segment { - start: [f32; 2], - end: [f32; 2], - - // This is used for fills only, but we're including it in - // the general structure for simplicity. - y_edge: f32, - } - - struct SegChunk { - n: u32, - next: Ref, - // Actually a reference to a variable-sized slice. - segs: Ref, - } } } diff --git a/piet-gpu/shader/ptcl.h b/piet-gpu/shader/ptcl.h index db8d47b..d80d24f 100644 --- a/piet-gpu/shader/ptcl.h +++ b/piet-gpu/shader/ptcl.h @@ -48,14 +48,6 @@ struct CmdRef { uint offset; }; -struct SegmentRef { - uint offset; -}; - -struct SegChunkRef { - uint offset; -}; - struct CmdCircle { vec2 center; float radius; @@ -195,30 +187,6 @@ CmdRef Cmd_index(CmdRef ref, uint index) { return CmdRef(ref.offset + index * Cmd_size); } -struct Segment { - vec2 start; - vec2 end; - float y_edge; -}; - -#define Segment_size 20 - -SegmentRef Segment_index(SegmentRef ref, uint index) { - return SegmentRef(ref.offset + index * Segment_size); -} - -struct SegChunk { - uint n; - SegChunkRef next; - SegmentRef segs; -}; - -#define SegChunk_size 12 - -SegChunkRef SegChunk_index(SegChunkRef ref, uint index) { - return SegChunkRef(ref.offset + index * SegChunk_size); -} - CmdCircle CmdCircle_read(CmdCircleRef ref) { uint ix = ref.offset >> 2; uint raw0 = ptcl[ix + 0]; @@ -514,45 +482,3 @@ void Cmd_Jump_write(CmdRef ref, CmdJump s) { CmdJump_write(CmdJumpRef(ref.offset + 4), s); } -Segment Segment_read(SegmentRef ref) { - uint ix = ref.offset >> 2; - uint raw0 = ptcl[ix + 0]; - uint raw1 = ptcl[ix + 1]; - uint raw2 = ptcl[ix + 2]; - uint raw3 = ptcl[ix + 3]; - uint raw4 = ptcl[ix + 4]; - Segment s; - s.start = vec2(uintBitsToFloat(raw0), uintBitsToFloat(raw1)); - s.end = vec2(uintBitsToFloat(raw2), uintBitsToFloat(raw3)); - s.y_edge = uintBitsToFloat(raw4); - return s; -} - -void Segment_write(SegmentRef ref, Segment s) { - uint ix = ref.offset >> 2; - ptcl[ix + 0] = floatBitsToUint(s.start.x); - ptcl[ix + 1] = floatBitsToUint(s.start.y); - ptcl[ix + 2] = floatBitsToUint(s.end.x); - ptcl[ix + 3] = floatBitsToUint(s.end.y); - ptcl[ix + 4] = floatBitsToUint(s.y_edge); -} - -SegChunk SegChunk_read(SegChunkRef ref) { - uint ix = ref.offset >> 2; - uint raw0 = ptcl[ix + 0]; - uint raw1 = ptcl[ix + 1]; - uint raw2 = ptcl[ix + 2]; - SegChunk s; - s.n = raw0; - s.next = SegChunkRef(raw1); - s.segs = SegmentRef(raw2); - return s; -} - -void SegChunk_write(SegChunkRef ref, SegChunk s) { - uint ix = ref.offset >> 2; - ptcl[ix + 0] = s.n; - ptcl[ix + 1] = s.next.offset; - ptcl[ix + 2] = s.segs.offset; -} -