Skip to content

Commit 05e9439

Browse files
committed
examples: fix ash searching shaders relative to cwd instead of its Cargo.toml
1 parent 0da80f8 commit 05e9439

File tree

1 file changed

+22
-19
lines changed

1 file changed

+22
-19
lines changed

examples/runners/ash/src/main.rs

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -242,25 +242,28 @@ pub fn compile_shaders() -> Vec<SpvFile> {
242242
std::env::set_var("OUT_DIR", env!("OUT_DIR"));
243243
std::env::set_var("PROFILE", env!("PROFILE"));
244244

245-
SpirvBuilder::new("examples/shaders/sky-shader", "spirv-unknown-vulkan1.1")
246-
.print_metadata(MetadataPrintout::None)
247-
.shader_panic_strategy(spirv_builder::ShaderPanicStrategy::DebugPrintfThenExit {
248-
print_inputs: true,
249-
print_backtrace: true,
250-
})
251-
// HACK(eddyb) needed because of `debugPrintf` instrumentation limitations
252-
// (see https://github.com/KhronosGroup/SPIRV-Tools/issues/4892).
253-
.multimodule(true)
254-
.build()
255-
.unwrap()
256-
.module
257-
.unwrap_multi()
258-
.iter()
259-
.map(|(name, path)| SpvFile {
260-
name: format!("sky_shader::{name}"),
261-
data: read_spv(&mut File::open(path).unwrap()).unwrap(),
262-
})
263-
.collect()
245+
SpirvBuilder::new(
246+
concat!(env!("CARGO_MANIFEST_DIR"), "/../../shaders/sky-shader"),
247+
"spirv-unknown-vulkan1.1",
248+
)
249+
.print_metadata(MetadataPrintout::None)
250+
.shader_panic_strategy(spirv_builder::ShaderPanicStrategy::DebugPrintfThenExit {
251+
print_inputs: true,
252+
print_backtrace: true,
253+
})
254+
// HACK(eddyb) needed because of `debugPrintf` instrumentation limitations
255+
// (see https://github.com/KhronosGroup/SPIRV-Tools/issues/4892).
256+
.multimodule(true)
257+
.build()
258+
.unwrap()
259+
.module
260+
.unwrap_multi()
261+
.iter()
262+
.map(|(name, path)| SpvFile {
263+
name: format!("sky_shader::{name}"),
264+
data: read_spv(&mut File::open(path).unwrap()).unwrap(),
265+
})
266+
.collect()
264267
}
265268

266269
#[derive(Debug)]

0 commit comments

Comments
 (0)