Amazon Developer

as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
Ring
AWS
Documentation
Support
Contact Us
My Cases
Get Started
Design and Develop
Publish
Reference
Support
Native
Skip to main content

Interface IRuntimeShader

interface IRuntimeShader
Extends IShader A shader compiled from source at runtime, enabling custom GPU visual effects. Supports two rendering modes: Shaders are compiled once and reused across frames. Uniforms are updated per-frame without recompilation for animation. A uniform that is declared in the shader source but never set defaults to zero (0 for scalars, all-zero components for vector types); leaving a uniform unset is not an error and does not throw. IPaint::setShader and IGraphicsModule7::makeRuntimeShaderImageFilter capture a snapshot of the current uniform values - mutating uniforms after binding does not affect already-issued draw calls. All methods must be called on the UI thread; no external synchronization is needed.

Methods

setUniformFloat()

void setUniformFloat(string name, float value)
Sets a float uniform value.

Parameters

name
string — Required The uniform name matching the shader source declaration.
value
float — Required The float value.

Throws

  • InvalidArgumentError — If the uniform name is not found or empty, or the type does not match the shader declaration.

setUniformFloat2()

void setUniformFloat2(string name, float v1, float v2)
Sets a float2 uniform value.

Parameters

name
string — Required The uniform name matching the shader source declaration.
v1
float — Required First component.
v2
float — Required Second component.

Throws

  • InvalidArgumentError — If the uniform name is not found or empty, or the type does not match the shader declaration.

setUniformFloat3()

void setUniformFloat3(string name, float v1, float v2, float v3)
Sets a float3 uniform value.

Parameters

name
string — Required The uniform name matching the shader source declaration.
v1
float — Required First component.
v2
float — Required Second component.
v3
float — Required Third component.

Throws

  • InvalidArgumentError — If the uniform name is not found or empty, or the type does not match the shader declaration.

setUniformFloat4()

void setUniformFloat4(string name, float v1, float v2, float v3, float v4)
Sets a float4 uniform value.

Parameters

name
string — Required The uniform name matching the shader source declaration.
v1
float — Required First component.
v2
float — Required Second component.
v3
float — Required Third component.
v4
float — Required Fourth component.

Throws

  • InvalidArgumentError — If the uniform name is not found or empty, or the type does not match the shader declaration.

setUniformInt()

void setUniformInt(string name, i32 value)
Sets an integer uniform value.

Parameters

name
string — Required The uniform name matching the shader source declaration.
value
i32 — Required The integer value.

Throws

  • InvalidArgumentError — If the uniform name is not found or empty, or the type does not match the shader declaration.

setUniformInt2()

void setUniformInt2(string name, i32 v1, i32 v2)
Sets an int2 uniform value.

Parameters

name
string — Required The uniform name matching the shader source declaration.
v1
i32 — Required First component.
v2
i32 — Required Second component.

Throws

  • InvalidArgumentError — If the uniform name is not found or empty, or the type does not match the shader declaration.

setUniformInt3()

void setUniformInt3(string name, i32 v1, i32 v2, i32 v3)
Sets an int3 uniform value.

Parameters

name
string — Required The uniform name matching the shader source declaration.
v1
i32 — Required First component.
v2
i32 — Required Second component.
v3
i32 — Required Third component.

Throws

  • InvalidArgumentError — If the uniform name is not found or empty, or the type does not match the shader declaration.

setUniformInt4()

void setUniformInt4(string name, i32 v1, i32 v2, i32 v3, i32 v4)
Sets an int4 uniform value.

Parameters

name
string — Required The uniform name matching the shader source declaration.
v1
i32 — Required First component.
v2
i32 — Required Second component.
v3
i32 — Required Third component.
v4
i32 — Required Fourth component.

Throws

  • InvalidArgumentError — If the uniform name is not found or empty, or the type does not match the shader declaration.

setInputShader()

void setInputShader(string name, IShader? shader)
Binds a child shader input for composition. The name must match a child shader declaration in the source. The child shader is evaluated in the source via childName.eval(coord). Replaces any previously bound shader for that name. Passing null clears the binding — unbound children produce transparent black. Note: Null here differs from null in IGraphicsModule7::makeRuntimeShaderImageFilter. In the image filter pipeline, a null imageFilter means “use source content directly.” In setInputShader, null clears the binding, producing transparent black for that child.

Parameters

name
string — Required The child shader name matching the shader source declaration.
shader
IShader? — Optional The shader to bind, or null to clear.

Throws


isChildBound()

bool isChildBound(string name)
Checks whether a child shader has been bound via IRuntimeShader::setInputShader. Returns true if the named child has a non-null shader bound. Returns false if the child has never been bound, was cleared by passing null to setInputShader, or if the name does not match any child shader declaration. Image filter bindings made via IGraphicsModule7::makeRuntimeShaderImageFilter or IGraphicsModule7::makeMultiInputRuntimeShaderImageFilter are separate and do not affect this result — those bindings happen internally at the filter pipeline level.

Parameters

name
string — Required The child shader name matching the shader source declaration.

Returns

bool True if the child shader is bound via IRuntimeShader::setInputShader, false otherwise.
Last modified on October 29, 2026