Skip to main content

Module render_effect

Module render_effect 

Source
Expand description

Render effects that can be applied to graphics layers.

Matches the Jetpack Compose RenderEffect API with extensions for custom WGSL shaders (RuntimeShader).

Structs§

BlurredEdgeTreatment
Controls blur behavior outside source bounds.
DrawSpecialization
The pipeline specialization one draw of a RuntimeShader compiles, chosen by RuntimeShader::draw_specialization.
PlaceholderShape
A rounded rectangle within a layer.
RuntimeShader
A custom WGSL shader effect, analogous to Android’s RuntimeShader.
ShaderPlaceholder
What a renderer draws in place of a shader’s effect while the shader’s pipelines compile, so no frame waits for them.
ShaderWarmUp
A runtime shader to compile before its first draw, at the target it will draw to, so a renderer’s background compiler builds the pipeline at start instead of inside the frame that first needs it.

Enums§

RenderEffect
A render effect applied to a graphics layer’s rendered content.
RuntimeShaderUniformError
Error returned when a shader uniform write targets renderer-owned storage.
ShaderTarget
Where a runtime shader’s pipeline draws, which decides how its output blends: Page composites the shader over what lies beneath (a backdrop effect, or a render effect the renderer draws straight onto the page), Layer renders into the layer’s own texture, whose content the shader replaces (a render effect under a blend mode or clip the page draw cannot apply, such as a DstOut mask).
SubstrateSpec
A low-frequency copy of a shader’s source the renderer packs beside it and hands the shader through a reserved substrate region slot.
TileMode
Edge treatment for blur effects at the boundary of the blurred region.

Constants§

MAX_SUBSTRATES
The most substrates one shader may declare.
RUNTIME_SHADER_PRELUDE_WGSL
The vertex stage and bindings every runtime shader starts from: a quad whose uv spans the effect’s rect, the input texture and sampler at group 0, and the 64 uniform vectors at group 1, which both stages read. A shader source is this prelude followed by an effect_fs fragment stage.

Functions§

runtime_shader_overrides_hash
The hash DrawSpecialization::overrides_hash gives a non-empty override set, its overrides in name order.
runtime_shader_source_hash
The hash RuntimeShader::source_hash gives a shader built from source.