op.publish

The last stage: write the state into the texture the layer samples.

op.publish(step: (f: GridFrame) => ComputeStep): GridStage

Import sim from shaders/std and use sim.grids.op.publish.

Chosen per frame so it can follow whichever buffer holds the current result.

Parameters

NameTypeNotes
step(f: GridFrame) => ComputeStep

Example

op.publish(() => outputPass.with(sort.side() === 'A' ? outputBgA : outputBgB))

See also

  • op.pass — One GPU pass, the same every frame.
  • op.sortPass — A compare-and-swap sort that converges a little more every frame: passes swaps per frame, alternating odd and even pairs and the two buffers.

Used by

PixelSort, ReactionDiffusion