hal/shader/lattice.lisp
The continuous summed-area value at cell (I,J) plus offset (A,B). Bilinear over the cell's four nodes, which for a unit-cell-constant integrand is the integral itself, not an interpolation of it.
Vertex lanes arrive through the analytic family's own vertex stage: the local coordinate carries cell units, the half-size lanes carry the grid's column and row counts, and the color is the premultiplied ink of the INKED cells. The zero cells are white paper, and the paper's own outer edge is part of the same integral: alpha is the footprint's overlap with the grid rectangle, so even the card boundary is filtered, and no part of the drawing is composited against another part of itself.
The pixel's footprint in cell units, per axis, exactly as
slug-pixels-per-em measures it in em units.
The box's corners, clamped to the grid: the integrand is zero outside, so clamping the integration bound changes nothing.
Cell addresses, clamped to the last cell so an offset of exactly one stays on the lattice; bilinear is exact on the closed cell.
Ink fraction and grid (paper) fraction of the footprint.
The pixel scale of the em square along each axis, from the sample coordinate's screen derivatives, already divided by the filter width so the rest of the pipeline works in filter widths rather than pixels. The footprint norm chooses between the gradient length and fwidth.
(name lambda-list &body body)Define NAME as a source-level shader abstraction. The expansion body receives the destructured call operands and returns a raw shader source form made from core operators or other abstractions.
Convert one scalar float or unsigned value to a 32-bit float.
Select and reorder vector components by a designator such as :XYZ or :RGB.
Load one exact two-dimensional texel at an unsigned integer coordinate.
The continuous summed-area value at cell (I,J) plus offset (A,B). Bilinear over the cell's four nodes, which for a unit-cell-constant integrand is the integral itself, not an interpolation of it.
Interpolate compatible quantities by a scalar amount.
Addition over compatible quantities.
Convert one scalar float or unsigned value to a 32-bit unsigned integer.
(name options &body body)Define NAME as a function that reparses its shader source on every call. Where DEFINE-SHADER parses once at load, this parses each time it is asked, so live named values (SHADER-SOURCE-VALUE) folded into the body are read afresh -- and noted in *SHADER-SOURCE-VALUE-REFERENCES* -- by every pipeline build, exactly as a…
The componentwise square root of a raw value.
The inner product of two vectors.
The componentwise absolute value of a raw value.
The maximum of compatible quantities.
Multiplication and scalar scaling.
Constrain a quantity between compatible bounds.
Subtraction or unary negation.
The minimum of compatible quantities.
Division of two represented quantities.
An exact box-filtered lattice ink: shapes that are constant on unit cells (a QR code is the canonical one), rendered with the Slug text renderer's philosophy -- recompute exact analytic coverage at the pixel's true derivative footprint, every frame -- but with the outline integral replaced by a lattice integral.
The compositing rule is the whole point. Drawing a module grid as many rectangles gives every shared edge two half-coverage fragments that OVER-composite to three quarters of either ink: a light hairline on every module boundary, which shimmers as the surface moves. Here the entire grid is one primitive whose fragment computes one coverage value for the whole footprint, so there is no interior boundary to leak.
The closed form is a summed-area table. The SAT of a function constant on unit cells is exactly bilinear within each cell, so the continuous integral over [0,x]*[0,y] is four integer texel loads and two lerps -- not approximately, exactly. A box filter needs that integral at its four corners; sixteen loads make the coverage exact at every scale, magnified or minified, one code path, no mip chain. Where Slug pays a fold over a band's curve list per fragment, the lattice pays O(1).
The filter footprint and width come from the same derivatives and the same knobs as
slug-pixels-per-em, so a code and the text beside it on one panel are filtered identically.