3 ms·
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 johnnyanmac 2y 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.
- mwkaufma 2y agoSDL3 offers a spir-v-cross reference impl as an optional auxiliary library.
- modeless 2y agoAlso DirectX is adopting SPIR-V, so that will help in the future as well. Yes, it's true! https://devblogs.microsoft.com/directx/directx-adopting-spir-v/ https://devblogs.microsoft.com/directx/directx-adopting-spir...
- NekkoDroid 2y agoDXC can already compile to SPIR-V (with some missing features/limitations IIRC), this just effectivly replaces DXIL with SPIR-V in future shader models and makes it THE language the compiler speaks. They are also slowly but surely porting their DXC compiler (forked from Clang 3.6 I think) to upstream Clang.
- vrighter 2y agoIt's not a question of whether it can compile to spir-v, but a question of whether dx12 can consume spir-v
- davexunit 2y 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.
- LinAGKar 2y agoThat obviously wouldn't work for the web though, since it would make webpages OS-specific
- vetinari 2y agoNot only that; passtrough to real gpu hardware on the web is a quick way to get 0wned. The GPU drivers - and a bunch of hardware too - are not robust enough to be exposed this way. So WebGL and WebGPU filter and check anything between webpage and the real hardware.
- beeflet 2y agoWebGL and WebGPU are still major vectors for device fingerprinting. In an ideal world, GPU access would result in a browser popup like location services and notifications currently do. But admittedly this is not the only major vector for fingerprinting. I would also say that User-agent shouldn't be a header but an autofilliable form input, and that cookies should be some transparently manageable tab in the address bar (and should be renamed to something more comprehensible to the average person like "tokens" or "tickets").
- davexunit 2y agoIf only there were a shader IR that was made with portability in mind!
- beeflet 2y agoWebGL sort of makes webpages API-specific already by pretty much forcing them to implement OpenGLES. I think if anything SPIR-V is less imposing on the OS because you don't have to implement the whole GLSL front of the compiler and you can just deal with the intermediary. You end up with a strange situation where a company like apple doesn't want to support OpenGL or provide a translation layer in their OS, but they effectively end up doing so in their browser anyways. But the downside of GLSL I think is that you make the web less "open" because GLSL (or whatever SL) isn't immediately transparent to the user. In the same way we usually expect to open up a webpage and inspect the javascript (because it is typically not minified by convention) whereas the introduction of WASM will require a decompiler to do the same. The web so far has been a kind of a strange bastion for freedom with adblockers and other types of plugins being able to easily modify webpages. In the future this will be more difficult with web apps as it would amount to decompiling and patching a portable executable (flutter, etc).
- dan-robertson 2y agoI 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 2y agoApple and all the big players bring a lot of engineering knowledge to the table, but they also indulge in corporate sabotage on a regular basis.