Inline SPIR-V

Crate Documentation

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:

```rust use inlinespirv::includespirv;

let spv: &'static [u32] = inlinespirv!(r#" #version 450 core void main() { glPosition = vec4(0, 0, 0, 1); } "#, vert); ```

To include a external shader source file:

```rust use inlinespirv::includespirv;

let spv: &'static [u32] = include_spirv!("assets/vert.hlsl", vert, hlsl, entry="Main"); ```

For the full list of options please refer to the documentation.

License

This project is licensed under either of

at your option.