rend3 icon indicating copy to clipboard operation
rend3 copied to clipboard

Use Naga for shader compilation

Open MindSwipe opened this issue 4 years ago • 4 comments

This would make the entire tech stack pure Rust, it would also make it easier to compile the shaders, no more reliance on external and no more Makefile.toml

Since wgpu now uses naga for all of it's shader compilation/ translation needs I think its stable and feature rich enough to be used here as well, admittedly wgpu's shaders are written in WGSL and these are GLSL, but according to naga's readme, their GLSL front-end is supported

If naga fails to compile all the shaders, this issue could be used as a tracker (that is, if we decide to use naga of course)

MindSwipe avatar Sep 17 '21 18:09 MindSwipe

This is definitely on my radar, and long term will likely end up switching over to WGSL entirely. That being said, the gpu mode is still completely unsupported by naga because I use descriptor indexing, so I need the ability to use SPIRV_PASSTHROUGH and an independent shader compiler. It will be possible to support in naga, will just take a lot of work.

cwfitzgerald avatar Sep 17 '21 19:09 cwfitzgerald

Just posting to say thanks for putting the spirv's in the repo so we don't need shaderc.

Slyklaw avatar Oct 11 '21 10:10 Slyklaw

I hate shaderc as much as y'all do 😉

cwfitzgerald avatar Oct 11 '21 19:10 cwfitzgerald

As of the wasm bench being merged, we still write all shaders in glsl and use shaderc to convert to spirv, but we now use Naga to convert the spirv to wgsl to give it to wgpu. This is a first step towards using Naga for everything.

cwfitzgerald avatar Nov 21 '21 14:11 cwfitzgerald