mirror of
https://github.com/griffi-gh/kubi.git
synced 2024-11-22 06:48:43 -06:00
wip
This commit is contained in:
parent
8b16081a68
commit
88a767368b
|
@ -8,14 +8,20 @@ pub struct Shaders {
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! shaders {
|
macro_rules! shaders {
|
||||||
{$renderer: expr, $dir: literal, $($name: ident -> $path: literal),*} => {
|
{($renderer: expr, $dir: literal), $($name: ident : $path: literal),*} => {
|
||||||
{
|
{
|
||||||
use super::Renderer;
|
use super::Renderer;
|
||||||
let renderer: &Renderer = $renderer;
|
let renderer: &Renderer = $renderer;
|
||||||
$({
|
$(
|
||||||
|
let $name = {
|
||||||
let _is_string_literal: &str = $path;
|
let _is_string_literal: &str = $path;
|
||||||
renderer.device.create_shader_module(wgpu::include_wgsl!(concat!($dir, "/", $path)));
|
let shader_descriptor = wgpu::include_wgsl!(concat!($dir, "/", $path));
|
||||||
})*
|
renderer.device.create_shader_module(shader_descriptor)
|
||||||
|
};
|
||||||
|
)*
|
||||||
|
Shaders {
|
||||||
|
$($name,)*
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -25,7 +31,7 @@ pub fn compile_shaders(
|
||||||
) {
|
) {
|
||||||
let renderer = &storages.borrow::<NonSendSync<UniqueView<Renderer>>>().unwrap();
|
let renderer = &storages.borrow::<NonSendSync<UniqueView<Renderer>>>().unwrap();
|
||||||
shaders! {
|
shaders! {
|
||||||
renderer, "../../shaders",
|
(renderer, "../../shaders"),
|
||||||
world -> "world.wgsl"
|
world: "world.wgsl"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue