56 lines
993 B
Markdown
56 lines
993 B
Markdown
# Shader Package Contract
|
|
|
|
Each shader package lives under `shaders/<id>/` and includes:
|
|
|
|
- `shader.json`
|
|
- `shader.slang`
|
|
|
|
## Manifest fields
|
|
|
|
`shader.json` defines:
|
|
|
|
- `id`
|
|
- `name`
|
|
- `description`
|
|
- `category`
|
|
- `entryPoint`
|
|
- `parameters`
|
|
|
|
Supported parameter types:
|
|
|
|
- `float`
|
|
- `vec2`
|
|
- `color`
|
|
- `bool`
|
|
- `enum`
|
|
|
|
## 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:
|
|
|
|
```slang
|
|
float4 shadeVideo(ShaderContext context)
|
|
{
|
|
return context.sourceColor;
|
|
}
|
|
```
|
|
|
|
Available built-ins through `ShaderContext`:
|
|
|
|
- `uv`
|
|
- `sourceColor` - the already-decoded full-resolution RGBA video color at `uv`
|
|
- `inputResolution`
|
|
- `outputResolution`
|
|
- `time`
|
|
- `frameCount`
|
|
- `mixAmount`
|
|
- `bypass`
|
|
|
|
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.
|