Skip to main content

Module shader_src

Module shader_src 

Source
Expand description

The engine’s WGSL sources, assembled at compile time.

Every shader lives in crates/frust-engine/shaders/ as its own .wgsl file and reaches Rust through include_str! — never as an inline string literal — so the downlevel lint that scans that directory (frust_gpu::lint::lint_wgsl_dir, driven by frust-gpu’s downlevel_rules test) sees every line the GPU ever compiles.

§The helper prelude

The sources are ported from a WESL reference whose entry-point modules pull shared code in with import package::helpers::.... WESL’s own resolver is not available here — its crate family needs a newer toolchain than this workspace’s MSRV — so the import graph is resolved two ways: within HELPERS by hand-inlining, and between an entry-point module and its helpers by concat!, exactly the shape frust-render’s shader-effect VERTEX_PRELUDE uses.

Prepending the whole helper file to every entry-point module is safe because HELPERS declares no @group/@binding global: a helper that reads a texture takes it as a parameter. An entry-point module’s derived bind-group layout is therefore exactly what its own bindings say, with or without the prelude. FILTER_KERNELS is a second prelude on the same terms, prepended to FILTER alone.

Every module the engine compiles is assembled here and nowhere else, so MODULES is the whole list — the one crate::gpu::pipelines::EngineShaders::register walks, and the one the validation tests below walk.

Constants§

CLEAR
Region and fullscreen clears of an intermediate texture: vs_main / vs_main_fullscreen + fs_main.
CLEAR_NAME
The name CLEAR is registered under in the shader library.
COPY
Rectangular region copies between intermediate textures: vs_main + fs_main.
COPY_NAME
The name COPY is registered under in the shader library.
DROP_SHADOW_KERNELS
The drop-shadow passes FILTER’s fragment stage dispatches into beyond what FILTER_KERNELS already covers: the shadow’s own device-space shift, and the recolour from a blurred alpha mask into the shadow’s premultiplied colour.
FILTER
One filter pass over one destination page: vs_main + fs_main, one pipeline (see crate::gpu::pipelines::EnginePipeline::Filter).
FILTER_KERNELS
The Gaussian-blur kernels FILTER’s fragment stage dispatches into: the two rescaling steps a decimated blur is built from, and the separable convolution run between them.
FILTER_NAME
The name FILTER is registered under in the shader library.
HELPERS
Binding-free helper functions shared by every entry-point module: packing, quad geometry, extend modes, encoded-paint accessors, gradient and blur evaluation, and atlas/external image sampling.
MODULES
Every module the engine compiles, as (name, source) pairs — the list crate::gpu::pipelines::EngineShaders::register walks, and the list the validation tests walk.
STRIP
The sparse-strip rasterizer: vs_main + fs_main, four pipeline variants (see crate::gpu::pipelines).
STRIP_NAME
The name STRIP is registered under in the shader library.