#wgsl #shader #glsl #parser #spir-v

shader_to_spirv

Get SPIR-V's output easier than ever!

2 releases

0.1.1 Dec 3, 2021
0.1.0 Dec 3, 2021

#34 in #wgsl

MIT/Apache

7KB
120 lines

shader_to_spirv usage

shader_to_spirv crate provides very easy way to create a SPIR-V's output.

But it's still in development could be bugs and some species of issues. If you found one of them, please, report or make PR! Always are welcome.

Supported Shader Languages

  • WGSL
  • GLSL
  • HLSL

Examples

let vs_shader: Vec<u32> = SpirvBuilder::new(
    "../path/to/my_shader.vert",
    ShaderType::Glsl,
    ShaderInfo::new(ShaderStage::Vertex, "main"),
    )
    .unwrap();
let fs_shader: Vec<u32> = SpirvBuilder::new(
    "../path/to/my_shader.wgsl",
    ShaderType::Wgsl,
    ShaderInfo::new(ShaderStage::Fragment, "fs_main"),
    )
    .unwrap();

Also, you can do like this:

let vs_shader: Vec<u32> = SpirvBuilder::new(
    "../path/to/my_shader.frag",
    ShaderType::Glsl,
    ShaderInfo::new(ShaderStage::Vertex, "main"),
    )
    .with_shader_type(ShaderStage::Fragment)
    .unwrap();

Dependencies

~7–14MB
~181K SLoC