|
|
Donner SVG 0.8.0-pre
SVG editor and embeddable C++20 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 |
| Compact metadata for one band. Layout matches the WGSL Band struct exactly. More... | |
| struct | AxisStats |
| Per-axis encode statistics retained with the path for diagnostics and perf tests. More... | |
| struct | EncodingStats |
| Output-neutral instrumentation for the CPU encoding result. More... | |
| struct | BoundingPoint |
| One path-space vertex in the convex bounding polygon. More... | |
Public Types | |
| enum class | Outcome { Empty , Ready , Rejected } |
Public Attributes | |
| std::vector< Curve > | curves |
| Canonical horizontal (Y-monotonic) curves. | |
| std::vector< uint32_t > | curveIndices |
| Per-band references into curves. | |
| std::vector< Band > | bands |
| Horizontal band metadata (Y-strips), for the horizontal ray. | |
| Box2d | pathBounds |
| Axis-aligned bounding box of the path. | |
| std::array< BoundingPoint, kMaxBoundingVertices > | boundingVertices {} |
| Small convex path enclosure, counter-clockwise in path space. The first vertex is the fan origin; the vertex shader expands (vertexCount - 2) * 3 triangle-list vertices from vertex_index. The selected enclosure is either a support-bounds polygon or its AABB fallback, so it always has 3 to kMaxBoundingVertices vertices for a nonempty path. | |
| uint32_t | boundingVertexCount = 0 |
| std::vector< Curve > | vCurves |
| Vertical (X-monotonic) curve + band data, for the Slug vertical ray used by the dual-ray analytic coverage. These mirror curves/bands, but are split at X-extrema and binned into vertical (X-strip) bands. | |
| std::vector< uint32_t > | vCurveIndices |
| Per-band references into vCurves. | |
| 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. | |
| EncodingStats | stats |
| Encode diagnostics; does not affect rendering. | |
| Outcome | outcome = Outcome::Empty |
Static Public Attributes | |
| static constexpr uint32_t | kMaxBoundingVertices = 8u |
| 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 |
Compact metadata for one band. Layout matches the WGSL Band struct exactly.
| Class Members | ||
|---|---|---|
| uint32_t | curveCount | Number of curve references in the band. |
| uint32_t | curveStart | First entry in the axis's curve-reference array. |
| struct donner::geode::EncodedPath::AxisStats |
Per-axis encode statistics retained with the path for diagnostics and perf tests.
| struct donner::geode::EncodedPath::EncodingStats |
| struct donner::geode::EncodedPath::BoundingPoint |
| 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 |