shaders

Compile and store a shader

Compile an SkSL source into the GLSL and WGSL variants the render engines run, and store it. Use the returned id as effects[].shader.id on a video, image, shape, frame or instance; POST /v1/shaders/{id}/probe renders one frame of it first.

post/v1/shaders

Request

  • Base URL: https://api.framelane.io
  • URL: https://api.framelane.io/v1/shaders
  • Auth: HTTP bearer

Request body

namestring required

A label, carried into renders as the entry's name.

lang'sksl'

The source language; SkSL is the only one.

sourcestring required

The SkSL body: half4 main(float2 uv) (uv 0 to 1 from the top-left), or Jitter's half4 jitterMain(float2 uv). No uniform declarations: uniforms come from the prelude and params.

jitterboolean nullable

Compile in Jitter's dialect. Omitted: when the source defines jitterMain.

Example request

{
  "params": [
    {
      "name": "speed"
    }
  ]
}

Response

Successful Response

idstring required

Its id, for effects[].shader.id.

namestring required
langstring required
hashstring required

SHA-256 of "sksl\n" + source, 64 lowercase hex digits: the entry's identity.

jitterboolean required

Compiled in Jitter's dialect.

status'compiled' | 'failed' required

failed shaders cannot render; errors says why.

variant_hashesobject

SHA-256 of each variant (glsl330, glsles300, wgsl), as the engines check them.

sharedboolean required

A shared shader every workspace can use, and none can delete.

sourcestring nullable

The SkSL source (?view=full).

variantsobject nullable

The compiled variants' text (?view=full).

created_atstring date-time required
updated_atstring date-time required

Example response

{
  "id": "sh_01J8QR2K5VKDGN2T4FBM3CZYX7",
  "params": [
    {
      "name": "speed"
    }
  ]
}

Changes

No recorded changes to this operation across all 1 revision of this API.