• Cloudef an hour ago

    I don't understand why WebGPU does not accept pre-compiled shaders. Every WebGPU implementation supports loading SPIR-V, but the spec just doesn't have it.

    • jsheard an hour ago

      It wasn't a technical decision. Apple decided to veto the use of any Khronos IP such as SPIR-V or GLSL due to a private legal dispute which was never elaborated on. That left the committee with no choice but to reinvent the wheel with WGSL, and now we're stuck with it forever.

      It's not the end of the world for web-only projects which can just target WGSL exclusively, but it's a pain in the ass for cross platform engines which now need to support Yet Another Shader Backend. Representatives from Adobe and Unity were practically begging the committee to just use SPIR-V, which they already supported.

      • landr0id 18 minutes ago

        From a previous thread on this topic: https://news.ycombinator.com/item?id=23089745

        >It's literally in past WebGPU meeting minutes: Apple objected to SPIR-V due to disputes with Khronos. Tint is a compromise, it doesn't matter who proposed it.

        >"MS: Apple is not comfortable working under Khronos IP framework, because of dispute between Apple Legal & Khronos which is private. Can’t talk about the substance of this dispute. Can’t make any statement for Apple to agree to Khronos IP framework. So we’re discussing, what if we don’t fork? We can’t say whether we’re (Apple) happy with that. NT: nobody is forced to come into Khronos’ IP framework."

        >https://docs.google.com/document/d/1F6ns6I3zs-2JL_dT9hOkX_25...

        • Cloudef an hour ago

          So apple's making graphics apis worse this time around :)

        • torginus 31 minutes ago

          SPIR-V is not precompiled in any meaningful sense of the word. It's just a SSA graph representation of the source code, and only saves you the lexing, parsing and SSA gen steps. The real meat of the compilation happens after that, when the GPU driver compiles the representation into actual GPU shader assembly.

          • l11d an hour ago

            One of the problems is that libraries consuming SPIR-V are generally not robust enough to handle untrusted web shaders. Also, DirectX doesn't (yet) accept SPIR-V shaders so you'd mandate some translation to HLSL, which in turn would be compiled by dxcompiler.dll

            • lights0123 4 minutes ago

              You could always translate to DXIL directly, though the Chromium team has brought up drivers are used to DXC's output