7 ms·
I lost all hope for WebGPU after they decided to roll their own ad-hoc shader language that kinda looks like, but is totally not rust. At least with WebGL you
by j-pb 4y ago
I lost all hope for WebGPU after they decided to roll their own ad-hoc shader language that kinda looks like, but is totally not rust.
At least with WebGL you had C.
Without SPIR-V support this spec is just another tire on the fire that is the modern web.
- sirwhinesalot 4y agoUgh... why... (And I say this despite rust being my favorite language ATM)
- hutzlibu 4y ago"ad-hoc shader language that kinda looks like, but is totally not rust." But is that language actually bad, or is it just not your favourite language? What don't you like about it?
- illiarian 4y agoNo idea what the comment about Rust means, but we already have several shader languages. There was literally no reason to invent another incompatible one
- xchkr1337 4y agoMost current shader languages are very close to C in terms of syntax and behavior and these are some of the worst aspects of C as a language. I guess they could have went with SPIR-V but generally a compilation step shouldn't be required in web standards.
- pjmlp 4y agoMSL, HLSL and PSSL are C++ dialects.
- xchkr1337 4y agoLiterally all of these are owned by big corporations (Apple, Microsoft, Sony) and made specifically for their proprietary gpu APIs. C++ is just a superset of C which doesn't fix syntax problems. Making an open source standard with a modern syntax is a better idea than picking a favorite corporation.
- pjmlp 4y agoGuess what is the main shading language used in Vulkan, specially going forward as announced at Vulkanised 2023. C++ is a safer, more expressive superset of C89. Also those dialects aren't C++, they are based in C++, which isn't the same.
- adrian17 4y ago> What don't you like about it? AFAIK: It's a mostly-but-not-100% textual equivalent of SPIR-V that, syntax-wise, is a weird hodgepodge of all the other shader languages. At the same time, it's rare it'll be actually written by hand by humans - it'll mostly be generated from another language at application build time, and then it'll have to be compiled back into bytecode by the browser, which feels like really redundant work. Further, it's often said that the main reason the language exists in the first place is because Apple veto'd SPIR-V due to their legal disputes with Khronos. I'm assuming that's why the comment above called it "ad-hoc".
- enbugger 4y agoBecause it is too different from other C-like DSLs GLSL, HLSL. GLSL was doing its job perfectly and there was no reason to invent another one. With wgpu, I now need to spend time on searching through its reference pages for things that I already know how to do in shaders. Now all countless WebGL tutorials need to be migrated to completely new syntax. This could be much easier by just making a superset of GLSL. And I had't got any sane answer on "why it should look like Rust?"
- mkl95 4y agoThe language is called WGSL. It's not ad-hoc (I mean, all DSLs are to some extent?) and it has a pretty easy learning curve if you know GLSL. I don't get what the fuzz is about.
- gardaani 4y agoJavaScript is the programming language for the Web. WGSL syntax should have been based on JavaScript syntax. It would have made writing shaders easier for millions of existing Web developers. Now they have to learn a new syntax.
- flohofwoe 4y ago> At least with WebGL you had C. Huh? WebGL uses two (incompatible to each other) versions of GLSL, not C. The topic of the WebGPU shading language has been discussed to death already, with no new insights brought to the discussion for a very long time. If you have a SPIRV based shader pipeline, you can simply translate SPIRV to WGSL in an offline compilation step (and to get to SPIRV in the first place, you need an offline compilation step anyway). If you use one of the native WebGPU libraries outside the browser, you can load SPIRV directly.
- TazeTSchnitzel 4y ago> At least with WebGL you had C. WebGL's shading language was not C.
- orra 4y agoNo SPIR-V was the cost of getting Apple on board.
- flohofwoe 4y ago...it's not quite as simple: http://kvark.github.io/spirv/2021/05/01/spirv-horrors.html http://kvark.github.io/spirv/2021/05/01/spirv-horrors.html WebGPU would most likely have to create its own subset of SPIRV anyway to fulfill the additional safety and validation requirements of the web platform.
- madeofpalk 4y agoGetting Apple on board? Wasn't Apple the originators of the propsal? https://webkit.org/blog/7380/next-generation-3d-graphics-on-the-web/ https://webkit.org/blog/7380/next-generation-3d-graphics-on-... https://webkit.org/wp-content/uploads/webgpu-api-proposal.html https://webkit.org/wp-content/uploads/webgpu-api-proposal.ht...
- flohofwoe 4y agoApple has a Khronos allergy, and both SPIRV and GLSL are Khronos standards. Also the original 3D API proposal from Apple was essentially a 1:1 Javascript shim for Metal, which looked quite different from WebGPU. Apple also originally proposed a custom shading language which looked like - but wasn't quite - HLSL. Compared to that, WGSL is the saner solution (because translation from and to SPIRV is relatively straightforward).
- pjmlp 4y agoMostly caused by how Khronos has managed OpenCL, and ironically Vulkan is slowly adopting HLSL as the main shading language, as they don't plan to invest into improving GLSL any further.
- xchkr1337 4y agoSyntax-wise GLSL is a mess and having a new language to work with is like a breath of fresh air.