Skip to main content

register_window_shader

Function register_window_shader 

Source
pub fn register_window_shader(passes: &[&str]) -> Option<u8>
Expand description

Register a multi-pass GLSL shader with the compositor.

Each element of passes is a complete sample_to_rgba(vec2 texcoord) function. The compositor chains them so that pass i samples the output of pass i-1:

  • Pass 0tex is the window’s content texture; tex_source is the same.
  • Pass i (i > 0)tex is the output of pass i-1; tex_source is always the original window content, useful for combining a processed result with the untouched original (e.g. bloom = blur + original).
  • Final pass — the alpha mask, rounded-corner SDF, and window transform are applied after sample_to_rgba returns, exactly as with a single-pass shader.
  • surfaceSize (the window size in pixels) is available in every pass.

Returns the shader ID on success (pass to crate::window::Window::set_shader), or None if registration failed.