Skip to main content

cranpose_ui_graphics/
framework_shaders.rs

1//! WGSL sources for the framework's rendering pipelines.
2//!
3//! They live in this pure data crate so every renderer backend — the wgpu
4//! renderer at runtime, and the slim Vulkan backend's build script — reads
5//! the identical text, packaged with a crate they already depend on.
6
7/// Batched shape shader. The uniform array lengths in the source are the
8/// wasm/downlevel defaults; native pipelines rewrite them per device class.
9pub const SHAPE_WGSL: &str = include_str!("../shaders/shape.wgsl");
10/// Trimmed-varying solid entries (`CRANPOSE_SOLID_TRIM_VARYINGS` opt-in),
11/// appended to [`SHAPE_WGSL`] by the shape pipeline builders when the trim
12/// is on. Never compiled alone.
13pub const SHAPE_SOLID_TRIM_WGSL: &str = include_str!("../shaders/shape_solid_trim.wgsl");
14pub const IMAGE_WGSL: &str = include_str!("../shaders/image.wgsl");
15pub const GLYPH_ATLAS_WGSL: &str = include_str!("../shaders/glyph_atlas.wgsl");
16
17/// Fullscreen-triangle vertex stage shared by the post-process shaders.
18pub const FULLSCREEN_QUAD_VS_WGSL: &str = include_str!("../shaders/fullscreen_quad_vs.wgsl");
19/// SDF rounded-rectangle helper shared by shape masking and blits.
20pub const SDF_ROUNDED_RECT_FN_WGSL: &str = include_str!("../shaders/sdf_rounded_rect_fn.wgsl");
21/// Box-filtered composite sampling helper shared by the blit shaders.
22pub const COMPOSITE_SAMPLE_FN_WGSL: &str = include_str!("../shaders/composite_sample_fn.wgsl");
23
24pub const BLUR_FS_WGSL: &str = include_str!("../shaders/blur_fs.wgsl");
25pub const BLUR_ROUNDED_MASK_FS_WGSL: &str = include_str!("../shaders/blur_rounded_mask_fs.wgsl");
26pub const OFFSET_FS_WGSL: &str = include_str!("../shaders/offset_fs.wgsl");
27pub const BLIT_FS_WGSL: &str = include_str!("../shaders/blit_fs.wgsl");
28pub const BLIT_FS_MAIN_WGSL: &str = include_str!("../shaders/blit_fs_main.wgsl");
29pub const PROJECTIVE_BLIT_FS_WGSL: &str = include_str!("../shaders/projective_blit_fs.wgsl");
30pub const PROJECTIVE_BLIT_MAIN_WGSL: &str = include_str!("../shaders/projective_blit_main.wgsl");
31
32/// RuntimeShader source for GPU text brush effects (gradient/stroked text).
33pub const GPU_TEXT_BRUSH_EFFECT_WGSL: &str = include_str!("../shaders/gpu_text_brush_effect.wgsl");