Working
This commit is contained in:
55
SHADER_CONTRACT.md
Normal file
55
SHADER_CONTRACT.md
Normal file
@@ -0,0 +1,55 @@
|
||||
# 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, video decode, 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`
|
||||
- `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 RGBA video from the live DeckLink input.
|
||||
Reference in New Issue
Block a user