Files
video-shader-toys/SHADER_CONTRACT.md
2026-05-02 16:40:21 +10:00

898 B

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:

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.