by kvark · 7y ago · 0 comments
For shading languages, it's not clear to me why GLSL-to-SPIRV would be so slow. Would be great to hear back from Google. Side note: we are currently experimenting [1] with Rust-based SPIR-V generation, and the transformation is looking to be mostly trivial - there is no reason it should be slow.
A bigger question though that needs to be resolved is how to specialize SPIR-V shaders. Without this, there is no good alternative to text-based cut-and-paste that the blog argues to be the best approach.
The first thing you read is: "WebGPU is a new API being developed by Apple and others in the W3C which enables high-performance 3D graphics and data-parallel computation on the Web."
Off the top of my head:
- glslang supports all previous GLSL versions and profiles, which adds many checks and corner cases throughout the code
- it's tricky to generate correct SPIR-V; for instance, it took me a while to properly understand the constraints around basic-block ordering
Disclaimer: I left Google in 2016 and haven't looked at glslang/shaderc since. I am only offering personal opinions here.
Is the OpSpecConstant family not enough? Those exist specifically for specialisation.