Reference for post-processing APIs shared by the Svelte adapter and core entrypoints.
Entrypoints
| Entrypoint | Exports |
|---|---|
@motion-core/motion-gpu/svelte | ShaderPassBlitPassCopyPass |
@motion-core/motion-gpu | ShaderPassBlitPassCopyPass |
Shared pass options
| Option | Default | Description |
|---|---|---|
enabled | true | Whether pass participates in current frame plan |
needsSwap | true | Swap sourcetarget |
input | 'source' | Input slot (sourcetarget |
output | 'target' | Output slot (sourcetargetcanvas |
clear | false | Clear output before drawing |
clearColor | [0, 0, 0, 1] | RGBA clear color |
preserve | true | Preserve output after pass |
ShaderPass
ShaderPassProgrammable post-process pass.
Required shader contract:
fn shade(inputColor: vec4f, uv: vec2f) -> vec4ffn shade(inputColor: vec4f, uv: vec2f) -> vec4fAdditional option:
| Option | Type | Description |
|---|---|---|
fragment | string | Required WGSL shader source |
filter | GPUFilterMode | Texture sampling mode |
Runtime update API:
setFragment(nextFragment: string): voidsetFragment(nextFragment: string): voidBlitPass
BlitPassFullscreen texture sample pass with configurable
filter'linear''nearest'CopyPass
CopyPassAttempts direct GPU texture copy (
copyTextureToTextureDirect-copy path requires all of:
clear === falsepreserve === true- source and output are different textures
- neither surface is
canvas - matching dimensions and format
Slot constraints
| Rule | Effect |
|---|---|
needsSwap: trueinput: 'source'output: 'target' | Invalid combinations throw |
canvas | input: 'canvas' |
Named targets must exist in renderTargets | Unknown target names throw |
| Named targets must be written before read in frame plan | Read-before-write throws |