Donner 0.5.0
Embeddable browser-grade SVG2 engine
Loading...
Searching...
No Matches
GeodePathEncoder.h File Reference

CPU-side Slug band decomposition: converts a Path into GPU-ready band data. More...

#include <cstdint>
#include <span>
#include <vector>
#include "donner/base/Box.h"
#include "donner/base/Vector2.h"
Include dependency graph for GeodePathEncoder.h:

Classes

struct  donner::geode::EncodedPath
 GPU-ready encoded path data produced by the Slug band decomposition algorithm. More...
struct  donner::geode::EncodedPath::Curve
 A quadratic Bézier curve segment (3 control points) stored as floats for GPU consumption. More...
struct  donner::geode::EncodedPath::Band
 Metadata for one horizontal band. More...
struct  donner::geode::EncodedPath::Vertex
 Vertex for the band bounding quad (input to the Slug vertex shader). More...
class  donner::geode::GeodePathEncoder
 Encodes a Path into Slug band decomposition format for GPU rendering. More...

Namespaces

namespace  donner
 Top-level Donner namespace, which is split into different sub-namespaces such as donner::svg and donner::css.

Detailed Description

CPU-side Slug band decomposition: converts a Path into GPU-ready band data.


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

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.

Class Members
float _pad0 Padding to match WGSL stride.
float _pad1 Padding to match WGSL stride.
uint32_t curveCount Number of curves intersecting this band.
uint32_t curveStart Index of the first curve in this band's curve range.
float xMax Right extent of curves in this band.
float xMin Left extent of curves in this band.
float yMax Top edge of the band (in path space).
float yMin Bottom edge of the band (in path space).

◆ donner::geode::EncodedPath::Vertex

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.