shadertoy-cli 2.3.0

Agent-friendly ShaderToy project, rendering, debugging, and live-preview CLI
Shader sources are compiled with a host-provided ShaderToy-compatible GLSL
prelude. User source is inserted after a #line 1 directive, so compile errors
normally report line numbers relative to the shader file rather than the
generated wrapper.

Entry points
------------

Image and buffer fragment passes:

  void mainImage(out vec4 fragColor, in vec2 fragCoord)

Cubemap fragment passes:

  void mainCubemap(
      out vec4 fragColor,
      in vec2 fragCoord,
      in vec3 rayOrigin,
      in vec3 rayDirection)

Compute passes:

  void mainCompute(ivec2 coord)

The compute wrapper bounds-checks coord against iResolution before calling
mainCompute.

Common uniforms
---------------

Fragment and compute passes receive:

  vec3  iResolution
  float iTime
  float iTimeDelta
  float iFrameRate
  int   iFrame
  vec4  iMouse
  vec4  iDate
  vec3  iChannelResolution[4]
  float iChannelTime[4]

Compute passes additionally receive:

  int iIteration

Configured inputs are declared as iChannel0 through iChannel3. Their GLSL
sampler type is derived from the input kind:

  sampler2D    pass/buffer/compute output, texture, keyboard, music, video, webcam
  samplerCube  cubemap
  sampler3D    volume

Only configured channels are declared.

Compute outputs
---------------

Compute output 0 is:

  image2D iOutput

For extra_outputs, the host declares image2D iOutput1 through iOutput7 as
needed, each with the matching image format qualifier and binding.

Fragment multiple-render-target outputs are not predeclared. Output 0 is the
mainImage result; declare additional locations yourself, for example:

  layout(location = 1) out vec4 normalVelocity;

Audio helpers and semantic uniforms
-----------------------------------

The prelude provides:

  float sampleAudioSpectrum(sampler2D channel, float x)
  float sampleAudioWaveform(sampler2D channel, float x)

x is clamped to 0..1. The waveform helper maps the stored 0..1 texture sample
back to -1..1.

The shader-facing audio aliases are:

  iAudioLoudness
  iAudioBass
  iAudioMid
  iAudioTreble
  iAudioOnset
  iAudioKick
  iAudioSnare
  iAudioHihat
  iAudioBpm
  iAudioBeatPhase
  iAudioBeatConfidence
  iAudioBeatStrength
  iAudioStereoWidth
  iAudioStereoBalance
  iAudioStereoCorrelation
  iAudioEnergyTrend
  iAudioDrop
  iAudioSectionChange
  iAudioSpectralCentroid
  iAudioSpectralFlux
  iAudioAvailable
  iAudioSilence
  iAudioSampleRate

For the keyboard/music texture layouts, see:

  shadertoy docs channels

For target formats, iterations, MRTs, and SSBOs, see:

  shadertoy docs passes