Vulkano: Including a shader at compile time

Created on 3 Sep 2017  路  2Comments  路  Source: vulkano-rs/vulkano

The problem is that I want to include shaders at compile time, but the #[src = include_str!("myfile.glsl")] doesn't seem to work. Is there any way to include shaders directly in the binary, while having the actual shader in a seperate file? Thanks.

error: src/graphics/shaders/mod.rs:43: proc-macro derive panicked
help: src/graphics/shaders/mod.rs:43: message: called `Result::unwrap()` on an `Err` value: "failed to parse macro input: \"#[ty = \\\"vertex\\\"]\\n#[src = include_str ! ( \\\"v_utm_line.glsl\\\" )]\\nstruct VertUtmLine;\""

Most helpful comment

This should probably be mentioned in the tutorial. Having to write the shader in-line is just yukky.

All 2 comments

Nevermind, just discovered that you can use #[path = "myshader.glsl"] instead.

This should probably be mentioned in the tutorial. Having to write the shader in-line is just yukky.

Was this page helpful?
0 / 5 - 0 ratings