Galactica/crates/render/src/shaderprocessor.rs

19 lines
468 B
Rust

use crate::globaluniform::GlobalUniform;
// TODO: better preprocessor, build script?
// Not yet, this is ok for now.
/// 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),
);
return shader;
}