cyborg/examples/shader_namespace.rs

16 lines
459 B
Rust

use std::fs::read_to_string;
use cyborg::shader::{parse_wgsl, generate_wgsl, add_includes};
fn main() {
// Generate a shader and preprocess it
let mut source = read_to_string("src/shader.wgsl").unwrap();
source = add_includes(&source);
// Parse the WGSL into a usable module
let module = parse_wgsl(&source);
// Generate a valid WGSL string from the module
let gen_wgsl = generate_wgsl(&module);
println!("{:?}", module);
}