From 05e9439bd4e4d8dbe7f281bb7cea570e63d85998 Mon Sep 17 00:00:00 2001 From: Firestar99 Date: Mon, 18 Nov 2024 12:31:43 +0100 Subject: [PATCH] examples: fix ash searching shaders relative to cwd instead of its Cargo.toml --- examples/runners/ash/src/main.rs | 41 +++++++++++++++++--------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/examples/runners/ash/src/main.rs b/examples/runners/ash/src/main.rs index 0edfa8daad..03ee7b6add 100644 --- a/examples/runners/ash/src/main.rs +++ b/examples/runners/ash/src/main.rs @@ -242,25 +242,28 @@ pub fn compile_shaders() -> Vec { std::env::set_var("OUT_DIR", env!("OUT_DIR")); std::env::set_var("PROFILE", env!("PROFILE")); - SpirvBuilder::new("examples/shaders/sky-shader", "spirv-unknown-vulkan1.1") - .print_metadata(MetadataPrintout::None) - .shader_panic_strategy(spirv_builder::ShaderPanicStrategy::DebugPrintfThenExit { - print_inputs: true, - print_backtrace: true, - }) - // HACK(eddyb) needed because of `debugPrintf` instrumentation limitations - // (see https://github.com/KhronosGroup/SPIRV-Tools/issues/4892). - .multimodule(true) - .build() - .unwrap() - .module - .unwrap_multi() - .iter() - .map(|(name, path)| SpvFile { - name: format!("sky_shader::{name}"), - data: read_spv(&mut File::open(path).unwrap()).unwrap(), - }) - .collect() + SpirvBuilder::new( + concat!(env!("CARGO_MANIFEST_DIR"), "/../../shaders/sky-shader"), + "spirv-unknown-vulkan1.1", + ) + .print_metadata(MetadataPrintout::None) + .shader_panic_strategy(spirv_builder::ShaderPanicStrategy::DebugPrintfThenExit { + print_inputs: true, + print_backtrace: true, + }) + // HACK(eddyb) needed because of `debugPrintf` instrumentation limitations + // (see https://github.com/KhronosGroup/SPIRV-Tools/issues/4892). + .multimodule(true) + .build() + .unwrap() + .module + .unwrap_multi() + .iter() + .map(|(name, path)| SpvFile { + name: format!("sky_shader::{name}"), + data: read_spv(&mut File::open(path).unwrap()).unwrap(), + }) + .collect() } #[derive(Debug)]