1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
#[cfg(debug_assertions)] #[macro_export] macro_rules! debug_watcher_pso_cell_type { ($r_type:ty, $f_type:ty, pipe = $pipe_name:ident) => (WatcherPsoCell<$r_type, $f_type, $pipe_name::Init<'static>>) } #[cfg(debug_assertions)] #[macro_export] macro_rules! debug_watcher_pso_cell { (pipe = $pipe_name:ident, vertex_shader = $vs:expr, fragment_shader = $fs:expr, factory = $factory:expr) => {{ use std::path::Path; use $crate::WatcherPsoCellBuilder; match Path::new(file!()).canonicalize() { Ok(path) => match path.parent().ok_or("Could not find current dir") { Ok(dir) => { let vs = dir.join($vs); let fs = dir.join($fs); WatcherPsoCellBuilder::using($pipe_name::new()) .vertex_shader(vs) .fragment_shader(fs) .build($factory) }, Err(err) => Err(err.into()) }, Err(err) => Err(err.into()) } }} } #[cfg(not(debug_assertions))] #[macro_export] macro_rules! debug_watcher_pso_cell_type { ($r_type:ty, $f_type:ty, pipe = $pipe_name:ident) => (SimplePsoCell<$r_type, $f_type, $pipe_name::Init<'static>>) } #[cfg(not(debug_assertions))] #[macro_export] macro_rules! debug_watcher_pso_cell { (pipe = $pipe_name:ident, vertex_shader = $vs:expr, fragment_shader = $fs:expr, factory = $factory:expr) => {{ use $crate::SimplePsoCellBuilder; SimplePsoCellBuilder::using($pipe_name::new()) .vertex_shader(include_bytes!($vs)) .fragment_shader(include_bytes!($fs)) .build($factory) }} }