use crate::globaluniform::GlobalUniform; // TODO: build script? /// Basic wgsl preprocesser pub(crate) fn preprocess_shader( shader: &str, global_uniform: &GlobalUniform, global_uniform_group: u32, ) -> String { // Insert dynamically-generated global definitions let shader = shader.replace( "// INCLUDE: global uniform header", &global_uniform.shader_header(global_uniform_group), ); // Insert common functions let shader = shader.replace( "// INCLUDE: anchor.wgsl", &include_str!(concat!( env!("CARGO_MANIFEST_DIR"), "/shaders/include/", "anchor.wgsl" )), ); return shader; }