| // SPDX-License-Identifier: Apache-2.0 OR MIT OR Unlicense |
| |
| // Segments laid out for contiguous storage |
| struct Segment { |
| origin: vec2<f32>, |
| delta: vec2<f32>, |
| y_edge: f32, |
| } |
| |
| // A line segment produced by flattening and ready for rasterization. |
| // |
| // The name is perhaps too playful, but reflects the fact that these |
| // lines are completely unordered. They will flow through coarse path |
| // rasterization, then the per-tile segments will be scatter-written into |
| // segment storage so that each (tile, path) tuple gets a contiguous |
| // slice of segments. |
| struct LineSoup { |
| path_ix: u32, |
| // Note: this creates an alignment gap. Don't worry about |
| // this now, but maybe move to scalars. |
| p0: vec2<f32>, |
| p1: vec2<f32>, |
| } |
| |
| // An intermediate data structure for sorting tile segments. |
| struct SegmentCount { |
| // Reference to element of LineSoup array |
| line_ix: u32, |
| // Two count values packed into a single u32 |
| // Lower 16 bits: index of segment within line |
| // Upper 16 bits: index of segment within segment slice |
| counts: u32, |
| } |