Builtin Library
- ..
- README.md2.3 KB
- alloc.luau3.3 KB
- capture.luau54.2 KB
- compact.luau366 B
- compile.luau1.9 KB
- concat.luau782 B
- draw.luau11.9 KB
- encode.luau2.1 KB
- eval.luau16.3 KB
- expand.luau479 B
- expr.luau34.0 KB
- form.luau41.4 KB
- init.luau5.1 KB
- join.luau7.2 KB
- make.luau608 B
- map.luau3.1 KB
- ops.luau3.7 KB
- place.luau20.2 KB
- ray_shapes.luau1.1 KB
- reduce.luau893 B
- rows.luau3.7 KB
- scan.luau884 B
- scatter.luau888 B
- structural.luau10.5 KB
- twins.luau21.1 KB
README.md
fx
The fixed, data-driven device program set an effect play runs on. A graph reaches the device as data: a field
expression is compiled to an op list (fx.ops.compileText), words that a fixed element interpreter
(kernels/fx_eval) reads, so no program is built for a graph and a play never waits on a build.
The op compiler
fx.ops.compileText(text, retType) reads the let name: T = expr; lines and the return of a field function (or the
whole function) and answers { ops, words, ret, lanes, slots, family, ... }, or { refusal } naming what the op set
does not hold. fx.refusals() counts every refusal by its reason.
An op list is SSA over a scalar bank of registers (values of one lane, up to 32) and a vector bank (values of two to
four lanes, up to 15), with the element's position in vector register 0. Pure ops that repeat are shared, ops no
returned value reads are dropped, and the field operator templates (division, remainder, square root, gather index,
unit hash) are one op each, except a remainder, which is a quotient, a product and a difference. fx.ops.table is the
opcode table: each op's code, its family (core, rand, noise) and whether it is a scalar form. slot_get(k) reads
word k of the dispatch.
The interpreter
fx.warm() registers the three families of kernels/fx_eval once; fx.ready() says when they are built and
fx.awaitReady() waits. fx.dispatchEval(job) writes the job's row, column descriptors and op list into the owner's
chunk of rows and queues the family's program over the pages the columns stand in; the dispatch names the runs it
reaches and writes. fx.dispatchCount() counts the dispatches queued.
The backend
proc.substrate.withBackend("fx", fn), setOwnerBackend(owner, "fx") and backend() choose where work runs. Under
"fx":
fieldc.evaluateandfieldc.runMaprun a field chain on the interpreter (fx.map);- the element programs of
proc.devicethat have a twin (fx.twins: fills, the index run, the word copy, an integer run read as numbers, the bounded gather) are never built, and queue their op list; - anything the fixed set does not hold runs the compiled program and is counted by
fx.refusals().
proc.eval(graph, target, { backend = "fx" }) cooks under it.