Skip to content

Shader

Paints validated WGSL with a bounded set of numeric shader parameters.

Loading interactive demo…

#Import

Import CustomShader from quickgui.

use quickgui::*;

#Usage

custom_shader(
    CustomShader::new(
        "fn quickgui_fragment(input: QuickGuiShaderInput) -> vec4<f32> { return vec4<f32>(input.uv.x, 0.3, input.uv.y, 1.0); }",
    )
    .expect("shader"),
)
.size(260.0, 150.0)

#API reference

Expand an entry for its description and complete signature. A dash means no declaration default is documented.

CustomShader

View source
pub fn new(source: impl AsRef<str>) -> Result<Self, CustomShaderError>
source_bytespub fn source_bytes(&self) -> usize—

Configures source bytes for this part.

pub fn source_bytes(&self) -> usize
View source

custom_shader

View source
pub fn custom_shader(shader: impl Into<CustomShader>) -> Element

Create a retained rectangle painted by validated application WGSL. Like the web canvas default, its initial size is 300 by 150 logical pixels. The shader remains still until application state invalidates the view or explicitly requests another frame.