Galactica/crates/render/src/shaderprocessor.rs

19 lines
468 B
Rust
Raw Normal View History

2024-01-10 17:53:27 -08:00
use crate::globaluniform::GlobalUniform;
2024-01-23 21:21:31 -08:00
// TODO: better preprocessor, build script?
// Not yet, this is ok for now.
2024-01-10 17:53:27 -08:00
/// 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;
}