Rendering

DriftTexture

171 symbols, imported from @driftengine/texture.

Explained in DriftTexture.

Interfaces

ChannelSpec
DecodeGraph
DecodeResources
GraphBuilder
GraphEvaluator
GraphNode
GraphTensor
GraphValue
InstanceTileInfo
What tilesForView needs besides the view.
LatentImage
LatentLevel
One level of a latent's chain. Components are the image's own.
LerpWeights
MaterialArray
Materials as slices of a few texture arrays, which is what WebGPU can bind.
MaterialTileGrid
One latent's tiles, level by level, by content.
NetworkGraph
NetworkShape
Operator
Overlay
OverlayJournal
OverlayOptions
OverlayTile
PageCache
PageCacheOptions
Predictor
PrefetchQueue
What to fetch next, ordered by how soon it will be needed.
ResidencyTable
SimulationHandle
What prediction needs from a simulation.
StoredGraph
A graph as a file stores it: its tensors in either precision, half as the bits a device uploads. @driftengine/drft's DrftGraph is one, structurally, which is how the two packages meet without either importing the other.
Streamer
StreamerOptions
TileIndex
TileSource
Where a tile's bytes come from. Resolving null means the source does not have it.
Weights
WeightSource
Where a definition's weights come from: a checkpoint being converted, or a converted file.

Functions

acquirePage
The slot holding this tile's page, acquiring one if it is not held. -1 where none can be given.
activationBound
The largest magnitude any product, partial sum or output of the network can reach over the given input box.
addBias
Add bias[cols] to every one of rows rows of x, in place.
addDecodeNode
applyOverlayJournal
Apply every entry up to and including upToFrame, onto whatever the overlay already holds.
arrayDescriptor
What a bind group needs to know: how many layers and how large each is.
assignLayer
Give this material a layer. Returns it, or -1 when the array is full.
attention
out[batch][queries][channels] from q of that shape and k and v of [batch][keys][channels]. scratch holds at least queries × keys values and is overwritten.
beginCacheFrame
Say a new frame has begun, so everything acquired from here is protected from eviction.
clearMissing
clearOverlay
Throw away every written tile. The overlay keeps its shape and holds nothing.
compositeOverlay
Put the overlay over the base, channel by channel, into out.
conv2d
out[cout][oh][ow] from input[cin][h][w], with oh = ⌊(h + 2·padding − kh)/stride⌋ + 1 and likewise ow. bias may be null.
convTranspose2d
out[cout][oh][ow] from input[cin][h][w], with oh = (h − 1)·stride − 2·padding + kh: each input pixel spread over the kernel at its strided place, which is how a decoder head upsamples.
createDecodeGraph
createDecodeRegisters
A registers array of the right size, for a caller that holds one across calls.
createGraphEvaluator
Validate, size every value once, and return something that evaluates without allocating.
createMaterialArray
createOverlay
createOverlayJournal
createPageCache
createPrefetchQueue
createResidencyTable
createStreamer
createTileIndex
decodeCpu
Run the graph at one texture coordinate and one time, writing four components into out.
decodeDecodeGraph
decodeMode
decodeOverlayJournal
Read a journal back. Null where the bytes are not one.
emptyLike
An overlay with the same shape as like and nothing written. What a replay starts from.
encodeDecodeGraph
count, result, addressMode, then the nodes.
encodeOverlayJournal
enqueue
ensurePageDecoded
Decode a held page if the mode says the cache owns that, and it has not been done.
erf
The error function, to double precision.
evalNetwork
Evaluate the network, writing shape.outputs values into out.
evalNetworkHalf
Evaluate the network as a device with enable f16 would, writing shape.outputs values into out.
evict
flipbookFrame
Which frame of a flipbook this time lands on. Never negative, never past the end.
forgetMissing
Stop calling a tile missing, so the next pump asks for it again.
fromHalfBits
The value sixteen bits hold.
gelu
x·Φ(x), the exact GELU, from x into out.
graphForDevice
A graph as @driftengine/core's runner takes it: its tensors listed by name, and every value's shape as inferred here — nothing evaluated and nothing sized, where asking an evaluator for its shapes would allocate every intermediate value first. Structural, because core does not import this package; the shapes are this module's, so there is one copy of every operator's rule.
graphFromStored
A stored graph as one the runtime runs, half-precision tensors decoded to single; validated, and refused naming what is wrong — an operator the runtime lacks is a fact about the model, and this is when a caller learns it.
graphFromWeights
graphRegisterCount
The highest register the graph writes, plus one.
graphShapes
Every value's shape — inputs, tensors and intermediates — refused, with the reason, if invalid.
halfPrecisionErrorBound
How far the half-precision evaluation of this network, at this input, can sit from the single-precision one.
halfWeights
A whole weight array as half-precision bits, each weight rounded on its own.
hashTile
FNV-1a over 64 bits, carried as two 32-bit halves because JavaScript has no 64-bit integer.
internTile
Give this tile a slot, reusing the one its content already has.
isColour
Whether this channel carries colour, and therefore whether a transfer curve applies to it.
journalLength
latentLerpWeights
The two keys surrounding this time, and how far between them it sits.
latentTileGrid
Cut a latent and its chain into content-addressed tiles.
layerNorm
Each row normalised to zero mean and unit variance, then scaled by gamma and shifted by beta.
layerOf
leastRecentlyUsed
The least recently used resident tiles, oldest first, excluding anything touched since since.
linearToSrgb
markRequested
markResident
matmul
out[m×n] = a[m×k] · b, where b is k×n, or n×k read as its transpose when transposeB. The offsets are where each matrix starts in its array, which is how one head of many is taken.
maxPool2d
out[channels][oh][ow], each the largest of its kernel-square window at stride, with oh = ⌊(h − kernel)/stride⌋ + 1: no padding, and a ragged last row or column dropped, as PyTorch's max_pool2d does without ceil_mode.
needsVarianceMips
Whether mipping this channel must preserve the normal distribution. See mipNdf.ts.
networkWeightCount
How many weights and biases a shape needs, laid out layer by layer.
nodeA
nodeB
nodeOp
nodeOut
normaliseSample
Write one raw channel value into its component of out, with its convention already applied.
occupiedPages
How many pages are held. What a profiler panel shows beside the resident tile count.
overlayTileCount
How many tiles hold a written texel. What a memory readout shows.
overlayTiles
The distinct content hashes of the written tiles, into out. Returns how many.
pageDecoded
pageSlot
patchEmbed
A patch embedding: a convolution with stride and kernel both patch, written token-major — out[tokens][dim], tokens row by row — which is the order a transformer reads them in.
predictViews
Fill out with one view matrix per predicted frame, and leave the simulation exactly as found.
progressiveOrder
Fill out with the order to send tileCount tiles in. Returns how many were written.
pumpStreamer
Ask for the first count tiles of batch that are worth asking for. Returns how many were sent.
queueSize
recordOverlayWrite
Record a write. Stored as f32, which is what makes the encoding round-trip exactly.
reduceNormalMip
Reduce a block of normals to one, writing both the direction and the roughness it implies.
releasePage
Give a page back. Its slot is free for the next acquisition, and its bytes are not kept.
residentCount
resize
out[channels][outH][outW] resized from input[channels][inH][inW]. step, without aligned corners, is the source pixels a destination pixel covers, vertically and then horizontally, where it is not the ratio of the sizes.
rewindOverlay
Put the overlay back to how it was at upToFrame: clear, then replay.
roundHalf
The nearest half-precision value, as a number.
runPrediction
Advance the simulation, ask the predictor what each predicted view needs, and put it back.
sampleOverlay
Read every channel at a coordinate into out. False where nothing has been written there.
semanticAt
The semantic an index names, or null where a file names one from a later version.
semanticIndex
Where a semantic sits in that order, or −1 for one this build does not know.
setDecodeMode
Change where the decode happens, invalidating every page that was decoded under the old rule.
slotFor
softmax
Each row of x to a distribution, stably: the row's largest value is subtracted before the exponential, so logits near a thousand give their logistic rather than Infinity / Infinity.
srgbToLinear
The exact sRGB transfer function, piecewise, not the 2.2 power approximation.
streamerInFlight
takeBatch
Take the next batch, soonest first, within a byte budget.
takeEvicted
Drain the hashes whose pages have been taken, into out. Returns how many.
tilesForView
Fill out with the tiles this view would sample, most important first, at most budget of them. Returns how many.
tileSlotCount
tileState
toHalfBits
The sixteen bits a value rounds to, as an unsigned integer.
toksvigRoughness
How much roughness a shortened average normal implies.
touchTile
Say this tile is in use now, so eviction will not take it.
truncateJournalFrom
Forget every entry from frame onward. What a rollback owes the journal.
usableAt
What level this many received bytes supports.
validateDecodeGraph
Whether this graph is one an interpreter can run.
validateGraph
Null when the graph can run; otherwise the reason, naming what it is about.
writeOverlay
Write value into one channel of every texel within radius of (u, v).
writtenMaskAt
Which channels have been written at a coordinate, as a bit per channel. Zero for none.

Types

Architecture
A definition: it reads its weights, adds its nodes, and says what goes in and comes out.
Attributes
AttributeValue
What every operator table shares: the shape of an operator, and the few helpers they all read their attributes and shapes with.
ChannelSemantic
What a channel is, declared rather than conventional.
DecodeMode
Where the decode happens. See the header for which risk the second one is the answer to.
DecodeOp
PageDecode
How a page's bytes are produced. Supplied by the caller: a cache cannot know a format.

Constants

ADDRESS_CLAMP
ADDRESS_MODE
Where a coordinate lands, and what happens outside the unit square.
ADDRESS_MODE_COUNT
How many address modes there are. A graph asking for this many or more is refused.
ADDRESS_WRAP
CHANNEL_SEMANTICS
Every semantic, in the order a file stores them by.
CONSTANT_PREFIX
What a constant's name begins with: a table of the shapes, never a weight.
DECODE_OP
A texture's decoder, as data.
HALF_MAX
The largest finite half-precision value.
JOURNAL_ENTRY_BYTES
Bytes an entry takes on the wire: two u32 and four f32.
JOURNAL_MAGIC
"DOVJ", little-endian, as every other record in this package spells its magic.
JOURNAL_VERSION
LEVEL_MARGIN
How close to a level boundary, in levels, an estimate names the finer level as well.
MAX_REGISTERS
Registers the interpreter has, each a four-component vector.
NODE_STRIDE
Words per node: op, a, b, out.
OPERATORS
OVERLAY_CHANNELS
How many channels a texel carries. One bit each in the written mask, so this cannot exceed 8.
REMAP_SEMANTICS
The order REMAP_CHANNEL packs a semantic in, which is CHANNEL_SEMANTICS and not a copy of it.
TILE_ABSENT
What is here, what is on its way, and what is not.
TILE_REQUESTED
TILE_RESIDENT