4 ms·
> ¹² If I were a cynical, paranoid conspiracy theorist, I would float the theory here that Apple at some point decided they wanted to leave open the capability
by Laaas 3y ago
> ¹² If I were a cynical, paranoid conspiracy theorist, I would float the theory here that Apple at some point decided they wanted to leave open the capability to sue the other video card developers on the Khronos board, so they are aggressively refusing to let their code touch anything that has touched the Vulkan patent pool to insulate themselves from counter-suits. Or that is what I would say if I were a cynical, paranoid conspiracy theorist. Hypothetically.
Such a shame that they lobbied against SPIR-V on the web. Textual formats are evil.
- flohofwoe 3y agoThe entire web has been built on textual formats though, and quite successfully so. Even without Apple in the way, SPIRV as it is wouldn't have been usable for WebGPU: http://kvark.github.io/spirv/2021/05/01/spirv-horrors.html http://kvark.github.io/spirv/2021/05/01/spirv-horrors.html
- Laaas 3y agoI wonder whether you could have used a slightly modified WebAssembly instead.
- flohofwoe 3y agoThat wouldn't have been all that different from WGSL though, the most important thing is that whatever WebGPU uses for its shaders can be translated to and from SPRIV (e.g. via https://dawn.googlesource.com/tint https://dawn.googlesource.com/tint and https://github.com/gfx-rs/naga https://github.com/gfx-rs/naga).
- Jasper_ 3y agoeh, I think the game is given away when kvark self-admits in that post that he's never written a compiler before, or done parsing before. Yes, SPIR-V is weird and confusing... if you've never worked on a compiler. A lot of it is relatively standard if you have. Some of the messy control flow stuff got pretty massively cleaned up by the POPL paper. [0] The issue is that Naga wants to support SPIR-V, but doesn't want to grow to become a full compiler. e.g. > When writing SPIR-V, you can’t have two integer types of the same width. This makes compilers much easier as now you can guarantee that all types are uniquely comparable by index. Just shove the type in an array, done. > However, it can also declare an output “interface struct” with a bunch of special built-ins and an empty name… Perhaps, it’s a mechanism that helps with tessellation shaders. But for us in Naga land that caused more trouble than good. No clue why you would care, unless you just blindly broadcast names when translating from SPIR-V. But also, don't do that? It's fine for things to have no names. > Later I was pointed to the fact that all the existing production tools for generating SPIR-V (namely, glslang and dxc) only do so for a concrete entry point. So the multiple entry points is there in spirit, but discriminated in practice by the driver bugs, as well as this little validation rule. Yeah, this is unfortunate. Multiple entry points are one of those things that make it seem easy to write a translator. Unfortunately, they're under-tested, not in the CTS, as glslang/DXC don't support them, and aren't how most shader pipelines tend to work. Anyway, I don't want to enumerate all of this. SPIR-V has issues, sure, but it can be simultaneously true that SPIR-V isn't flawless, while also being true that it's the best version of this that anyone's seen yet. [0] https://www.doc.ic.ac.uk/~afd/homepages/papers/pdfs/2023/POPL.pdf https://www.doc.ic.ac.uk/~afd/homepages/papers/pdfs/2023/POP...
- jitl 3y agoWASM is very much binary-first, and quite popular.
- ladberg 3y agoUnfortunately WASM is not popular in the slightest outside of the HN community. Less than 1% of websites use it, and those that do often use it for malicious purposes.
- DonHopkins 3y ago[flagged]
- ladberg 3y agoPlease source where on Wikipedia it says >1% of websites use WASM. I don't really know what the most trusted / canonical sources would be on this topic, but the first few results from Google all suggest <1% of websites use it: https://w3techs.com/technologies/details/cp-webassembly https://w3techs.com/technologies/details/cp-webassembly https://almanac.httparchive.org/en/2022/webassembly https://almanac.httparchive.org/en/2022/webassembly https://www.zdnet.com/article/half-of-the-websites-using-webassembly-use-it-for-malicious-purposes/ https://www.zdnet.com/article/half-of-the-websites-using-web...
- edflsafoiewq 3y agoTextual formats are great. You can build shaders by pasting strings together and using #define and #ifdef.