|
|
Donner 0.8.0-pre
Embeddable browser-grade SVG2 engine
|
GPU-ready encoded path data produced by the Slug band decomposition algorithm. More...
#include "donner/svg/renderer/geode/GeodePathEncoder.h"
Classes | |
| struct | Curve |
| A quadratic Bézier curve segment (3 control points) stored as floats for GPU consumption. More... | |
| struct | Band |
| Metadata for one horizontal band. More... | |
| struct | Vertex |
| Vertex for the band bounding quad (input to the Slug vertex shader). More... | |
Public Member Functions | |
| bool | empty () const |
| Returns true if the encoded path has no bands (empty or degenerate path). | |
Public Attributes | |
| std::vector< Curve > | curves |
| Horizontal (Y-monotonic) curves, sorted by band. | |
| std::vector< Band > | bands |
| Horizontal band metadata (Y-strips), for the horizontal ray. | |
| std::vector< Vertex > | vertices |
| Per-band bounding quad vertices (6 per band) — legacy 4-sample path (gradient/mask alpha-coverage shaders). | |
| Box2d | pathBounds |
| Axis-aligned bounding box of the path. | |
| std::vector< Vertex > | quadVertices |
| Single bounding quad (6 verts) over the whole path, for the analytic dual-ray fill shader (0041 §8.1). One quad per path means each pixel is rasterized by exactly one fragment, so folded sampleCount=1 coverage composes correctly (no band-seam double-count — Blocker B). bandIndex is unused (the fragment looks up both its H- and V-band from sample_pos via the band grids). | |
| std::vector< Curve > | vCurves |
| Vertical (X-monotonic) curve + band data, for the Slug vertical ray used by the dual-ray analytic coverage (see docs/design_docs/0041). These mirror curves/bands but are split at X-extrema and binned into vertical (X-strip) bands. For a vertical Band the field semantics are transposed: xMin/xMax are the band's X-strip boundaries and yMin/yMax are the Y-extent of the curves in the band. | |
| std::vector< Band > | vBands |
| Vertical band metadata (X-strips), for the vertical ray. | |
| std::vector< uint32_t > | hBandGrid |
| Dense band-grid lookup, for the analytic dual-ray fragment shader (0041 §8.1). The shader finds its band in O(1) from the sample position: slot = hBandGrid[clamp(floor((y - yBase) / hStride), 0, hBandCount-1)] if (slot != kNoBand) iterate bands[slot]'s curves for the horizontal ray. vBandGrid indexes vBands by (x - xBase) / vStride for the vertical ray. The grids map dense grid cells onto the empty-skipped bands/vBands arrays, so no curve data is duplicated. Empty for a degenerate axis (count 0). | |
| std::vector< uint32_t > | vBandGrid |
| size == vBandCount; cell → index into vBands. | |
| float | yBase = 0.0f |
| Top edge of the horizontal band grid (path space). | |
| float | hStride = 0.0f |
| Height of each horizontal band cell (path space). | |
| uint32_t | hBandCount = 0 |
| Number of horizontal band cells. | |
| float | xBase = 0.0f |
| Left edge of the vertical band grid (path space). | |
| float | vStride = 0.0f |
| Width of each vertical band cell (path space). | |
| uint32_t | vBandCount = 0 |
| Number of vertical band cells. | |
Static Public Attributes | |
| static constexpr uint32_t | kNoBand = 0xFFFFFFFFu |
| Sentinel for a grid cell with no band (no curves overlap that strip). | |
GPU-ready encoded path data produced by the Slug band decomposition algorithm.
This struct contains all the data needed by the Slug vertex and fragment shaders to render a filled path. It is produced by GeodePathEncoder::encode() and consumed by the GPU pipeline.
The data is organized as:
| struct donner::geode::EncodedPath::Curve |
| struct donner::geode::EncodedPath::Band |
Metadata for one horizontal band.
Layout matches the WGSL Band struct in shaders/slug_fill.wgsl exactly (8 × 4 bytes = 32 bytes per band). Two trailing pad fields are required because storage buffer struct stride must be 16-byte aligned, and without them WGSL would round the struct to 32 bytes anyway.
| struct donner::geode::EncodedPath::Vertex |
Vertex for the band bounding quad (input to the Slug vertex shader).
| Class Members | ||
|---|---|---|
| uint32_t | bandIndex | Which band this vertex belongs to. |
| float | normalX | |
| float | normalY | Outward normal (for dynamic half-pixel dilation). |
| float | posX | |
| float | posY | Position in path space. |
| std::vector<uint32_t> donner::geode::EncodedPath::hBandGrid |
Dense band-grid lookup, for the analytic dual-ray fragment shader (0041 §8.1). The shader finds its band in O(1) from the sample position: slot = hBandGrid[clamp(floor((y - yBase) / hStride), 0, hBandCount-1)] if (slot != kNoBand) iterate bands[slot]'s curves for the horizontal ray. vBandGrid indexes vBands by (x - xBase) / vStride for the vertical ray. The grids map dense grid cells onto the empty-skipped bands/vBands arrays, so no curve data is duplicated. Empty for a degenerate axis (count 0).
size == hBandCount; cell → index into bands.
| std::vector<Curve> donner::geode::EncodedPath::vCurves |
Vertical (X-monotonic) curve + band data, for the Slug vertical ray used by the dual-ray analytic coverage (see docs/design_docs/0041). These mirror curves/bands but are split at X-extrema and binned into vertical (X-strip) bands. For a vertical Band the field semantics are transposed: xMin/xMax are the band's X-strip boundaries and yMin/yMax are the Y-extent of the curves in the band.
X-monotonic curves, sorted by vertical band.