Shader
Paints validated WGSL with a bounded set of numeric shader parameters.
Loading interactive demo…
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)#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 sourcepub fn new(source: impl AsRef<str>) -> Result<Self, CustomShaderError>source_bytespub fn source_bytes(&self) -> usize—
custom_shader
View sourcepub fn custom_shader(shader: impl Into<CustomShader>) -> ElementCreate 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.
