4 ms·
The shader language you write in does not matter, as it can be converted into whatever format the API expects. wgpu historically accepts SPIR-V, but the latest
by lights0123 5y ago
The shader language you write in does not matter, as it can be converted into whatever format the API expects.
wgpu historically accepts SPIR-V, but the latest version released ~a month ago has moved to WGSL as much as it can in the examples. Have you upgraded yet?
- longstation 5y agoI haven't. I didn't realize the move. Looks like I need to find some new learning material. BTW, do you know any up-to-date tutorials?
- raphlinus 5y ago"Does not matter" is overstating the case. There are lots of tools for converting between shader languages (naga, spirv-cross, glslangValidator, dxc), but these conversions aren't 100% lossless and not all shader languages have the same capabilities. To give one example, HLSL (Shader Model 6) has a fairly complete set of subgroup (wave) operations, but is missing nonuniform shuffle. Another gap is that only GLSL (Vulkan flavor) has support for explicit memory semantics. Of course, WGSL currently has none of this, as it's something of a lowest common denominator. In the game world, it is very common to write shaders in HLSL because of good support on Windows, and then use the tools mentioned above to translate into other shader languages. I explored this for my own work but ultimately settled on GLSL because it allows access to advanced features. Fans of shader languages should also be aware of rust-gpu, which promises to be considerably higher level; most existing shader languages show their clear lineage to C (through Cg).