From 88a767368bab2d954c82a5896f76a72ddc0a7ad1 Mon Sep 17 00:00:00 2001 From: griffi-gh Date: Sat, 15 Jul 2023 22:17:22 +0200 Subject: [PATCH] wip --- kubi/src/rendering/shaders.rs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/kubi/src/rendering/shaders.rs b/kubi/src/rendering/shaders.rs index 2f07368..02bd72e 100644 --- a/kubi/src/rendering/shaders.rs +++ b/kubi/src/rendering/shaders.rs @@ -8,14 +8,20 @@ pub struct Shaders { } macro_rules! shaders { - {$renderer: expr, $dir: literal, $($name: ident -> $path: literal),*} => { + {($renderer: expr, $dir: literal), $($name: ident : $path: literal),*} => { { use super::Renderer; let renderer: &Renderer = $renderer; - $({ - let _is_string_literal: &str = $path; - renderer.device.create_shader_module(wgpu::include_wgsl!(concat!($dir, "/", $path))); - })* + $( + let $name = { + let _is_string_literal: &str = $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::>>().unwrap(); shaders! { - renderer, "../../shaders", - world -> "world.wgsl" + (renderer, "../../shaders"), + world: "world.wgsl" }; }