Donner SVG 0.8.0-pre
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
donner::geode::EncodedPath Struct Reference

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 Member Functions

std::size_t geometryItemCount () const
std::size_t retainedBytes () const
uint32_t boundingDrawVertexCount () const
 Triangle-list vertex count emitted by the vertex shader for the bounding fan.
bool empty () const
 Returns true if the encoded path has no bands (empty or degenerate path).
bool rejected () const

Public Attributes

std::vector< Curvecurves
 Canonical horizontal (Y-monotonic) curves.
std::vector< uint32_t > curveIndices
 Per-band references into curves.
std::vector< Bandbands
 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< CurvevCurves
 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< BandvBands
 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).

Detailed Description

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:

  • Curves: Canonical quadratic Bézier control points (3 × Vector2f per curve).
  • Curve references: Compact per-band indexes into the canonical curve arrays.
  • Bands: Compact offset/count pairs into the curve-reference arrays.
  • Bounding polygon: Up to eight convex vertices enclosing the path. The vertex shader triangulates and dilates it from vertex_index, so no resident vertex buffer is required.

Class Documentation

◆ donner::geode::EncodedPath::Curve

struct donner::geode::EncodedPath::Curve

A quadratic Bézier curve segment (3 control points) stored as floats for GPU consumption.

Class Members
float p0x
float p0y Start point.
float p1x
float p1y Control point.
float p2x
float p2y End point.

◆ donner::geode::EncodedPath::Band

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.

◆ donner::geode::EncodedPath::AxisStats

struct donner::geode::EncodedPath::AxisStats

Per-axis encode statistics retained with the path for diagnostics and perf tests.

Class Members
uint32_t canonicalCurveCount = 0 Curves stored exactly once for this ray.
uint32_t curveReferenceCount = 0 Total indexes across all bands.
uint32_t gridBandCount = 0 Dense band-grid cells.
uint32_t maxCurvesPerBand = 0 Worst packed-band reference count.
double meanCurvesPerBand = 0.0 Mean references per nonempty band.
uint32_t nonemptyBandCount = 0 Packed nonempty band records.
uint32_t omittedParallelCurves = 0 Curves proven parallel to this ray.
uint32_t p95CurvesPerBand = 0 95th percentile nonempty-band count.

◆ donner::geode::EncodedPath::EncodingStats

struct donner::geode::EncodedPath::EncodingStats

Output-neutral instrumentation for the CPU encoding result.

Class Members
double aabbArea = 0.0
double boundingGeometryArea = 0.0
uint32_t boundingGeometryVertexCount = 0
AxisStats horizontal
AxisStats vertical

◆ donner::geode::EncodedPath::BoundingPoint

struct donner::geode::EncodedPath::BoundingPoint

One path-space vertex in the convex bounding polygon.

Class Members
float x
float y

Member Data Documentation

◆ hBandGrid

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.

◆ vCurves

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. These mirror curves/bands, but are split at X-extrema and binned into vertical (X-strip) bands.

Canonical X-monotonic curves.


The documentation for this struct was generated from the following file: