• davexunit 2 hours ago

    WGSL is easily the worst part of WebGPU, which I like overall. The world did not need another high-level shading language. They could have just used SPIR-V bytecode if it wasn't for Apple sabotage. The GPU API in SDL3, by comparison, has chosen the only sane option and just asks you to pass whatever the native shader format is.

    • johnnyanmac 2 hours ago

      Why am I not surprised that it's Apple that continues to make the world of graphics programming even more difficult than it needs to be.

      > The GPU API in SDL3, by comparison, has chosen the only sane option and just asks you to pass whatever the native shader format is.

      I get why their don't do this, to be fair. That would mean they would need to have a proper parser for a half dozen shader models. Or at least try to promise they will make and maintain others soon.

      • dan-robertson 6 minutes ago

        I think apple contributed lots of things that make wgpu a nicer api for people. I’m not saying this particular contribution was good, just that it’s not so black and white.

        • davexunit 2 hours ago

          > That would mean they would need to have a proper parser for a half dozen shader models.

          It avoids this entirely. If you're on a system whose GPU driver only speaks DXBC and you hand it SPIR-V, that would be an error. This is what SDL GPU does. The SDL team conveniently made a small library that can cross-compile SPIR-V to the other major bytecode formats that you can integrate into your build pipeline.

          • mwkaufma 2 hours ago

            SDL3 offers a spir-v-cross reference impl as an optional auxiliary library.

          • bsder 36 minutes ago

            WebGPU was a total surrender to Apple, and Apple still didn't implement it.

            Given that Microsoft has also thrown in with SPIR-V and Apple still isn't shipping WebGPU, the next version of WebGPU should tell Apple to fuck off, switch to SPIR-V, and pick up Windows, XBox, and Linux at a stroke.

            • Rusky 2 hours ago

              They could not "just" have used SPIR-V bytecode. WebGL already had to do a bunch of work to restrict GLSL's semantics to work in the web sandbox; whatever WebGPU chose would have had the same problem.

              • modeless an hour ago

                In comparison to inventing a new language and three independent interoperable implementations from scratch, I think "just" is appropriate.

                • mwkaufma 2 hours ago

                  WGSL is defined as a "bijection" to a "subset" of spir-v -- they could have simply specced that subset.

              • alkonaut 3 hours ago

                This is from 2021 and the main issue the author has with wgsl has long since been fixed. There is a lot less <f32> needed in ~2014~. Edit: in 2024

                • kookamamie 3 hours ago

                  But, on the other hand, more time-travel required?

                • spookie 2 hours ago

                  The built-ins are named inconsistently, aren't visually any different from other parts of the code, and the change from sets to groups when there are workgroups makes no sense.

                  All around change for the sake of change.

                  • jsheard 2 hours ago

                    > All around change for the sake of change.

                    More like change for the sake of politics, Apple didn't want to use any Khronos IP so the WebGPU committee had to work backwards to justify inventing something new from scratch, despite the feedback from potential users being overwhelmingly against doing that.

                    Then after sending the spec on a multi-year sidequest to develop a shader language from scratch, Apple still hasn't actually shipped WebGPU in Safari, despite Google managing to ship it across multiple platforms over a year ago. Apple only needs to support Metal.

                    • davexunit 2 hours ago

                      Apple has been extremely slow about getting important features into Safari. They're about a year behind Chrome and Firefox on some WebAssembly things, too.

                      • jsheard an hour ago

                        Safari's limitations are baffling sometimes, like it's the only browser that doesn't support SVG favicons aside from a non-standard monochrome-only variant. Their engine supports SVG, just not in that context, and you'd think they would be all over resolution independent icons given their fixation on extremely high DPI displays.

                      • rahkiin an hour ago

                        I’ve read this is because they are in a legal conflict with Khronos for a while already

                        • flykespice an hour ago

                          Apple is the epitome of Not Invented Here syndrome.

                      • jesse__ 40 minutes ago

                        Fuck me .. as if we needed another shading language.

                        • andrewmcwatters 2 hours ago

                          Man, since the departure from OpenGL/OpenGL ES, graphics programming is such a pain in the butt. It's totally unfun and ridiculous.

                          • jms55 2 minutes ago

                            What part do you dislike? If it's the complexity of newer APIs (Vulkan in 8 years old at this point, DirectX12 9 years), then you might like WebGPU or any of the other userspace graphics APIs such as blade or sdl3 that have been invented over the past few years.

                            • davexunit an hour ago

                              The fragmentation has been really frustrating but if things like WebGPU and SDL GPU become well supported it will make doing modern graphics programming mostly pleasant. I love/hate OpenGL and will miss it in a strange way.

                              • 01HNNWZ0MV43FF an hour ago

                                I finally switched to WebGL 2, I think, to get nicer shadow maps. I'll ride that as far as I can. personally I liked gles2 a lot. Everything ran it.