2.0 KiB
2.0 KiB
Shader Package Contract
Each shader package lives under shaders/<id>/ and includes:
shader.jsonshader.slang
Manifest fields
shader.json defines:
idnamedescriptioncategoryentryPointparameters- optional
temporal
Supported parameter types:
floatvec2colorboolenum
Temporal manifests
Shaders can optionally declare temporal history needs:
{
"temporal": {
"enabled": true,
"historySource": "source",
"historyLength": 4
}
}
Supported temporal history sources:
source- decoded source-video history from previous framespreLayerInput- history of the input arriving at that layer before the shader runs
historyLength is requested by the shader and clamped by config/runtime-host.json via maxTemporalHistoryFrames.
Temporal history resets automatically when:
- layers are added, removed, or reordered
- a layer bypass state changes
- a layer changes to a different shader
- a shader is reloaded or recompiled
Slang contract
The runtime owns the fragment entry point, the UYVY-to-RGBA decode pass, and final mix/bypass behavior.
Your shader.slang file implements:
float4 shadeVideo(ShaderContext context)
{
return context.sourceColor;
}
Available built-ins through ShaderContext:
uvsourceColor- the already-decoded full-resolution RGBA video color atuvinputResolutionoutputResolutiontimeframeCountmixAmountbypasssourceHistoryLengthtemporalHistoryLength
Manifest parameters are exposed to the shader as globals named by their id.
Helper function:
sampleVideo(float2 uv)returns decoded full-resolution RGBA video from the live DeckLink input.sampleSourceHistory(int framesAgo, float2 uv)samples the most recent available source history frame, clamping to the oldest available frame if needed.sampleTemporalHistory(int framesAgo, float2 uv)samples the most recent available pre-layer history frame for temporal shaders, clamping to the oldest available frame if needed.