Inline SPIR-V
inline-spirv
ease the way you write shaders. Although as game developers, we usually compile a permutation of shader stages for different objects and materials at runtime for the best flexibility; sometimes we do want to try out some new ideas and start up dirty. This crate helps you compile GLSL/HLSL shader in your Rust code, or in external files, into SPIR-V; and embed them right inside the binary, so you are freed from all the compilation hassle.
How to Use
To inline shader source:
use include_spirv;
let spv: &'static = inline_spirv!;
To include a external shader source file:
use include_spirv;
let spv: &'static = include_spirv!;
For the full list of options please refer to the documentation.
Tips
The macro can be verbose especially you have a bunch of #include
s, so please be aware of that you can alias and define a more customized macro for yourself:
use include_spirv as include_spirv_raw;
// ...
let vert: & = include_spirv!;
License
This project is licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.