Start3 of 5
How to read the docs
The four kinds of page, the parts of a module page, and what the marks on a module's card state.
The label above a page’s title says which kind of page it is.
| Kind | Read it to | It assumes |
|---|---|---|
| Tutorial | build one example from an empty canvas, step by step | nothing: no shaders and no TypeGPU |
| Concept | learn how the kit works and why modules share one shape | the frame from Getting started |
| Recipe | combine several modules for one job, in code you can copy | the modules it names |
| Module | use one module: what it solves, how to call it, what it costs | TypeGPU basics |
If you are new to the kit, read Getting started, then How the kit works. Every module page builds on those two.
A page that builds on another names it under its title, after Read first. A module page names the concept behind it beside its label. Every page ends with the next page of its group.
A module page
Section titled “A module page”Every module page has its parts in the same order. It opens with one sentence on what the module does, a strip with its import and main call, and the problem it solves. Any figure and the module in use come next, then sections in the order you meet them. The reference card comes last.
- 1What it is. One sentence, under the kind of page and where the index holds it.
- 2At a glance. The import, the main call and the facts that differ from a plain module.
- 3The problem. What the module solves, before any API.
- 4A figure you can operate. Its caption says what to try.
- 5The module in use. One block, typechecked against the kit.
- 6Sections. In the order you meet them: setup, each frame, edge cases, teardown.
- 7Reference. The card with every call, option, member and fact.
A page that covers several modules gives each one a strip in its own section and gathers their cards under Reference.
The card
Section titled “The card”A card is generated from the module’s source, so it always matches the installed code. It lists every call with what each argument is, every option with its default, every member of what a call returns, and the module’s facts.
A fact is listed only where the module differs from a plain one. A plain module records into what you hand it, never submits, creates no GPU objects in a steady frame and needs no device feature. A card with few facts describes a module with few surprises.
Callsborrows, never destroystakesneeds a modulereturns
dof.create(root, view, { source, depth, pull?, region?, … }) → Dof
root- the root
view- cameras the camera that drew
depth source- the linear picture, read at every
record depth- the depth of the same picture, read at every
record pull?- how fast the focus follows
aim, per second region?- the part of the source that holds the picture, read at every
record Dof- depth of field you record every frame and destroy
takesOptions
7 fields
OptionssourceSourceProvides the linear picture: a rendered picture, such as
aa, or a function returning a texture.depth() => DepthReturns a sampled depth texture of the same picture, of any size, such as a half-resolution prepass.
radius?Radius'use gpu'Returns the signed blur radius at an eye distance and a point of the picture, from 0 to 1 over its region, as a fraction of the picture height: negative in front of the focus, positive behind it.Default
thinLensatfocus().pull?numberSets how fast the focus follows
aim, per second: each second closes1 - e^-pullof the way, evenly in blur rather than in distance.DefaultInfinity, which focuses at once from therecordafteraim.rings?2 | 3Sets the rings of taps in the gather, 3 for 49 taps or 2 for 25.Default 3.
region?SizeSourceSelects the source region from its top-left corner, such as
regions.hdrwhen drawing below full resolution.Default the region of a renderedsource, else the whole texture.
returnsDof
9 members
DofoutputFloatTextureProvides the full-size blurred
rgba16floatpicture.regionSizeSourceGives the region of
outputthatrecordwrites, matching the source region.partbindings.PartProvides the half-resolution picture and its regions for
dof.circle.inject()Fills
dof.circlefor pipelines created from the configuration it is piped into.aim(x, y)Focuses on what the depth holds at a point of the picture, from 0 to 1 over its region, such as under a tap.
initAsync()Compiles the depth of field pipelines.
record(target, options?)Records the prepare, tiles, reach, gather and composite passes after the source is written.
destroy()Destroys the textures and the focus buffer.
takesRecordOptions
record · 2 fields
RecordOptionsdt?numberSets the seconds the focus moves by.Default the frame's
dt, or all the way.timestampWrites?TimestampWrites | undefinedSupplies a timer's writes for the passes.Default none.
In a frame
Holds
- owns
targets ·2 buffers ·a sampler ·5 pipelines ·6 bind groups
The half-resolution picture, the tiles, their reach, the blur and the output; the settings and the regions; a group for each pass and one for the depth. With
pullor afteraim, also the focus and its step, the kernel moving it and its groups.- allocates
on resize
Targets for the new size and the bind groups of its passes; so does a new source or depth.
- lifecycle
initAsync()destroy()[Symbol.dispose]- binds
1 uniform
dof.circle, the regions, beside the texture.
Connects to
- injects
hook
The half-resolution picture and regions
dof.circlereads, from the part.
Exports
- GPU functions
distanceAtthinLensfocuscircle- schemas
Settings- constants
defaults- types
Radius
used byHex isleNight market
Underlines in a call
root- The root. The module uses it and never destroys it.
options- A value the call reads. The row under the call says what it is. An options object opens its fields.
camera- Another module. The name opens its page.
Result- What you get back. The name opens its members.
Labels
- records
- The methods that record into your frame, and what each one takes.
- submits
- It submits commands on its own, which no other module does.
- owns
- The GPU resources it allocates and frees in destroy().
- allocates
- It creates GPU objects after setup, which a steady frame otherwise never does.
- binds
- The buffers a shader stage binds when it reads the module.
- lifecycle
- What to await before the first frame, and what frees its resources.
- needs
- Other modules its factories take.
- reads
- Modules whose inject() must fill the pipeline that calls its functions.
- injects
- What its inject() fills in a pipeline that reads it.
- requires
- Device features it needs or uses.
- platform
- It runs on one platform only.
- stability
- Its names or shape may still change in a minor release.
- used by
- Examples that use it.
Kinds
- module
- Borrows the root and owns GPU resources.
- cpu
- No GPU.
- shader
- 'use gpu' functions only.
- platform
- Platform helpers.
- tool
- For development and tests.
Coral marks an exception to a rule every other module keeps: it submits on its own, it allocates after setup, or its API may still change. An exception is valid behaviour you design around, and its row says when it happens.
An option marked 'use gpu' on the card takes a function that runs in a shader, so pass it a 'use gpu' function. Any other function option runs on the CPU.
A name in a call opens its definition: the result opens its members, options its fields, an option its row, a module its page. A method named in a fact opens its member. Point at a label or a kind for its meaning.
Figures and code
Section titled “Figures and code”- In a figure, blue marks what is live, selected or new. The caption says what to try.
- A number in code with a dotted underline can be dragged, and the figure follows it.
- Every code block is typechecked against the kit. Point at a name to see its type.
- Lines a block needs to compile but that are not its subject are hidden. A tutorial shows every line you write.
A word with a dotted underline is one the docs use in a sense of their own, marked where a page first uses it. Point at it or tap it for its meaning and the section that teaches it.
- accessor
- An accessor is a typed value that shader code reads and that each pipeline can fill with a different resource.Modules connect through TypeGPU →
- atlas
- An atlas is one texture that holds many small pictures side by side, such as every glyph of a font or every view of a model.
- bind group
- A bind group is a set of buffers, textures and samplers that a pipeline reads, and a pipeline has room for four.
- binding
- A binding is one buffer, texture or sampler in a bind group, which a shader reads by its place there.
- cadence
- A cadence tells you on which frames work that runs less often than every frame is due.Cadences →
- capture
- A capture copies a buffer at one point in the frame, so the CPU can read it after the submit.Placing the capture →
- compound
- A compound is a drawing made of several pipelines, with resources of its own for each view it draws into.Compound drawings →
- definition
- A definition names a table's fields before any table exists, so shader code written over it works with every table made from it.Members and placeholders →
- dispatch
- A dispatch runs a kernel once over a number of threads, inside a compute pass.
- drawing
- A drawing is what a renderer hands to a pass description: what each vertex carries to its pixels, what a pixel looks like and the draw call.Every renderer is a drawing →
- factory
- A factory is the function that creates a module, which allocates what the module needs and returns its resources, functions and recording methods.A module borrows →
- fill
- A fill is the resource a pipeline binds for an accessor its shaders read.Members and placeholders →
- fixed step
- A fixed step advances a simulation by one set length of time, and each frame runs a whole number of them, so the result is the same at any frame rate.A fixed step →
- flush
- A flush uploads the rows the CPU changed since the last one.Rows →
- frame
- A frame is one turn of the loop, and the object your function gets for it, which holds the encoder, the time and the time since the last frame.You own the frame →
- HDR
- HDR, high dynamic range, is colour stored with more range than a screen shows, so a light can be brighter than white.A module borrows →
- hook
- A hook is a placeholder that each pipeline fills with its own choice, such as the camera it draws through.Members and placeholders →
- host
- A host runs a scene for you, which means it makes the device, the surface and the frame loop and frees them in order.Hosting scenes →
- impostor
- An impostor draws a distant model as one card that faces the camera, textured with pictures of the model taken in advance.Impostors →
- indirect draw
- An indirect draw reads how much to draw from a buffer, so a kernel can decide the count and the CPU never reads it.Indirect draws →
- inject
- A module's inject() returns the fills a pipeline needs before its shaders can read the module's placeholders.Modules connect through TypeGPU →
- instance
- An instance is one copy of a mesh with its own position, rotation, scale and material, kept as a row of a table.Instances →
- kernel
- A kernel is a compute function that the GPU runs many times at once, each run on its own thread.A frame in plain TypeGPU →
- kind
- A kind adds fields to the rows of a set of instances and replaces functions in the shaders that draw them.Kinds →
- linear light
- Linear light is colour as amounts of light, the form in which lighting adds up correctly, before the final pass encodes it for the screen.
- live list
- A live list is a list of the live rows of one group, made on the GPU each frame so that a draw covers only them.Only what is alive →
- member
- A member is a function or accessor on what a factory returns that reads that instance's own resources, so a pipeline that uses it needs no fill.Members and placeholders →
- mesh pool
- A mesh pool stores every mesh's vertices in shared buffers, so one pipeline can draw any mesh.Mesh pool →
- module
- A module is one piece of GPU work, made by a factory that borrows your root and returns resources, shader functions and methods that record into your frame.A module borrows →
- output
- An output is a value every drawing writes at each pixel beside its colour, such as motion or an id.Outputs every drawing writes →
- part
- A part is a set of resources that can be replaced, such as a texture that follows the screen size, which pipelines read through a layout they share.Resources that are replaced →
- pass description
- A pass description says once which textures a pass draws into and what each holds, and builds the pipeline for every drawing added to it.Scenes and passes →
- patch
- A patch uploads only the fields you pass and leaves the others as they are.Settings that change →
- placeholder
- A placeholder is an accessor with no resource of its own, which each pipeline fills through the inject() of the module it reads.Members and placeholders →
- readback
- A readback copies a buffer during a frame and hands it to the CPU a frame or two later, without making the frame wait.Results back →
- recorder
- The recorder is the function you give the frame loop, which records one frame into the encoder it is handed.
- recording method
- A recording method records a module's work into the pass, the encoder or the frame you hand it, and never submits.Recording methods →
- renderer
- A renderer draws one sort of thing, such as instances or particles, by handing a pass description a drawing.Every renderer is a drawing →
- row
- A row is one object's values in a buffer, such as one enemy, one particle or one light.Objects are rows in buffers →
- row id
- A row id names one row of a table for as long as the row lives, and stops working once the row is removed.Row ids →
- runtime
- A runtime is one JavaScript thread with its own memory, such as the page, a worker or a React Native worklet thread.
- sampler
- A sampler tells the GPU how to read a texture between its texels and past its edges, such as smoothly or in blocks.
- scene
- A scene is the function a scene file exports, which creates its modules and returns the function that records each frame.Hosting scenes →
- slot
- A slot is a row's place in its buffers, which a new row can take once the first is removed.Row ids →
- sRGB
- sRGB is the encoding screens and most image files use for colour, which a shader turns into linear light before it does maths on it.
- staging buffer
- A staging buffer is a buffer the CPU can map, which a result is copied into so that it can be read after the frame.
- steady frame
- A steady frame is any frame after setup, in which a module only records and creates no GPU objects.Nothing is hidden →
- storage buffer
- A storage buffer is GPU memory that shaders read by index and kernels can write, which is where the kit keeps rows.
- surface
- A surface is a canvas set up for your root, which keeps its drawing buffer the size the page shows it at.Surfaces →
- table
- A table is a buffer of rows with named fields, some written by the CPU and the others by kernels.Rows →
- target
- A target is a texture that a frame draws into.Scenes and passes →
- texel
- A texel is one cell of a texture, as a pixel is one cell of the screen.
- thread
- A thread is one run of a kernel, and the GPU starts many at once, each with its own number.Slime mould →
- tone curve
- A tone curve maps light of any brightness into the range a screen can show, keeping detail in the bright parts.
- workgroup
- A workgroup is a block of threads that the GPU starts together, and a dispatch runs as many workgroups as cover the work.Slime mould →
- worklet
- A worklet is a function that react-native-worklets can run on a thread other than the main JavaScript thread.
For coding agents
Section titled “For coding agents”Every page is also Markdown at its address with .md in place of the trailing slash, such as /kit/frames.md. /llms.txt lists them, and the kit ships the same pages in its package. Getting started sets an agent up with them.
© Software Mansion 2026. All trademarks and copyrights belong to their respective owners. Read about our Privacy Policy.