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