3 ms·
> Such wrapper APIs are not exactly rocket science, they can be both efficient and safe, yet still abstract over platform differences. I would suggest this is
by horsawlarway 4y ago
> Such wrapper APIs are not exactly rocket science, they can be both efficient and safe, yet still abstract over platform differences.
I would suggest this is not nearly as easy as you claim.
Game engines are actually fine example of exactly what I'm talking about - Unreal might have an abstraction that wraps over system differences, but to access low level apis devs bail on it.
Take a recent game: Atomic Heart. Built with Unreal Engine 4, which claims to support: Windows, macOS, and Linux PCs; PlayStation 4, PlayStation 5, Xbox One, Xbox Series X, and Nintendo Switch; and iOS and Android mobile devices.
Platforms that they actually released on? Xbox Series X|S, Xbox One, Windows 10/11, PS4/5.
Why? Because the abstraction turned out to not abstract so well, and they didn't bother to do the platform work required for the others.
Does it run on Linux? Sort of... it runs on linux presenting the same abi as Windows through proton/wine.
And even then, they have a ton of reported issues with performance (stuttering, frame drops, screens failing to load, unable to pause) on xbox consoles.
Which they've explicitly spent time and effort on making sure the game at least sort of works.
---
Basically - No, this sort of abstraction is hardly easy. Realistically, it's right on up there with rocket science.
Last note: What hardware do you think an M1/2 mac is running on? Or an iphone? Or an old BSD machine? Or a Windows machine? Because I've spotted about three different entire ARCHITECTUREs there (x86, x64, ARM64). Not even accounting for differences based with the GPU (or lack thereof). The OS is already trying pretty hard to paper over those differences for you as a application developer...
So I'm excited to see where we get with webGPU, but if you think it's equivalent to a low level api... I'm not really sure I agree. Plus it's explicitly not functional on... basically anything right now. Take a peak: https://caniuse.com/webgpu https://caniuse.com/webgpu
- flohofwoe 4y ago> Platforms that they actually released on? Xbox Series X|S, Xbox One, Windows 10/11, PS4/5. > Why? ... ...not really, these are business reasons, plain and simple. The problem with games on Linux is that the market is too small, the technical problems could be overcome if there would be a will and enough money thrown at it (see Steam Deck and Proton where this approach works pretty well) - for instance the technical problems for games on Android are arguably worse, yet the market is big enough that game developers have enough incentives to deal with those problems. Also WebGPU is not released yet, so looking at caniuse is not really useful. As for the last point: the CPU's ISA is the least of the problems. Most applications are no longer coded by hand in assembly. Apart from being slightly faster, I see no difference between coding on an M1 Mac versus an Intel Mac or even a Windows or Linux machine (exactly because I hardly code in assembly these days). My (same) code runs on all of those, plus the web, iOS and Android (granted I wrote my own set of wrapper libs to make this easy: https://github.com/floooh/sokol https://github.com/floooh/sokol - but it's not like that's the only slim solution for cross-platform code).
- horsawlarway 4y agoSo you're basically conceding that the abstraction for those game engines is leaky... and it's not sufficient to make the program work without considerable technical work specific to the platform? Guess we're agreeing?