4 ms·
I was curious what shader language would be used for WebGPU and couldn't find an answer. From [1] it seems to be undecided for now. [1] https://gpuweb.github.i
by speps 7y ago
I was curious what shader language would be used for WebGPU and couldn't find an answer. From [1] it seems to be undecided for now.
[1] https://gpuweb.github.io/gpuweb/#typedefdef-gpushadercode https://gpuweb.github.io/gpuweb/#typedefdef-gpushadercode
> Note: While the choice of shader language is undecided, GPUShaderModuleDescriptor will temporarily accept both text and binary input.
- flohofwoe 7y agoI think not specifying the shader language / byte-code makes at least sense for those native WebGPU implementation libraries (of course not for the WebGPU standard itself). For instance, currently Dawn comes with a lot of code to translate and validate SPIRV to the underlying shader languages or byte-codes. When using Dawn as a native library to get a friendlier cross-platform API over Metal, Vulkan and D3D12, it might make sense to do the shader translation offline, and feed Dawn directly with Metal and D3D12 shader bytecode. The strict validation isn't really needed in such a use case, the shader translation doesn't need to happen at run time, and the executable can be a lot slimmer. Ideally I'd like to see both in web backend, SPIRV as base, but also have a quasi-standard textual language (might be WHLSL, I don't care, but just don't offer WHLSL as the only way to get shaders into WebGPU). Both D3D12 and Metal allow to either feed shader bytecode to the API, or translate from shader source during run time.
- Jasper_ 7y agoDawn, used offline, will almost certainly accept SPIR-V. Even if the WebGPU WG chooses an alternate approach, Google plans to use this internally for other projects, and I expect SPIR-V will remain a supported shader ingestion format.
- deleted 7y ago[deleted]