alpha2_render/
shader_inventory.rs1use alpha2_shaders::{
7 CANVAS_PRESENT_WGSL, COMPOSITE_WGSL, FULLSCREEN_TEXTURE_QUAD_WGSL, READBACK_PACK_WGSL,
8 RGB_TO_YUV420_WGSL, RGBA_PRESENT_WGSL, YUV_REPACK_WGSL, YUV_TO_LINEAR_WGSL,
9 YUV16_TO_LINEAR_WGSL,
10};
11
12use crate::EffectDef;
13use crate::registry::build_shader;
14
15#[must_use]
17pub fn effect_wgsl(definition: &EffectDef) -> String {
18 build_shader(definition)
19}
20
21#[must_use]
24pub fn builtin_wgsl_modules() -> Vec<(String, String)> {
25 let mut modules = [
26 ("canvas-present", CANVAS_PRESENT_WGSL),
28 ("fullscreen-quad", FULLSCREEN_TEXTURE_QUAD_WGSL),
29 ("composite", COMPOSITE_WGSL),
30 ("readback-pack", READBACK_PACK_WGSL),
31 ("rgba-present", RGBA_PRESENT_WGSL),
32 ("rgb-to-yuv420", RGB_TO_YUV420_WGSL),
33 ("yuv-repack", YUV_REPACK_WGSL),
34 ("yuv-to-linear", YUV_TO_LINEAR_WGSL),
35 ("yuv16-to-linear", YUV16_TO_LINEAR_WGSL),
36 ]
37 .map(|(label, source)| (label.to_owned(), source.to_owned()))
38 .to_vec();
39 modules.push(("vector".to_owned(), crate::vector::vector_wgsl()));
40 let mut definitions = crate::builtins::internal_effect_definitions();
41 definitions.extend(crate::builtin_effect_definitions());
42 definitions.extend(crate::builtin_transition_definitions());
43 modules.extend(
44 definitions
45 .iter()
46 .map(|definition| (definition.id.clone(), effect_wgsl(definition))),
47 );
48 modules
49}
50
51#[cfg(test)]
52#[path = "shader_inventory_tests.rs"]
53mod tests;