The Future of wasi-gfx and wasi:webgpu

43 points
1/21/1970
6 days ago
by mendyberger

Comments


flohofwoe

Makes sense to move the window system glue parts on a different 'track'.

IME the window system glue is the actually ugly and maintenance heavy part when writing a cross-platform 3D API wrapper. The various core 3D APIs (D3D, Metal, Vulkan, even GL) all map to the same hardware so it's quite trivial to get them to do the same thing.

But for the window system glue it gets ugly. Different platforms and window systems don't agree on how 3D rendered surfaces should be presented and how frame-pacing is supposed to work, there's a fundamental conflict between event-driven UI apps and frame-driven 'game-y' apps, the window system glue generally seems to get less attention than the core 3D APIs (maybe because it sits exactly between areas of responsibility), there are sometimes subtle behaviour changes between operating system updates (especially on macOS), and let's not even mention Wayland.

The result is that the code which sits between the window system and 3D rendering becomes an accumulation of experiments, hacks and workarounds, has a very high churn and in the end those 10% of the code base suck up 90% of the work :/

3 days ago

cyber_kinetist

I thought SDL3 covers everything on that front though? Don't think we need to reinvent the wheel too much for window management.

2 days ago

flohofwoe

...and GLFW, winit, RayLib, SFML, sokol_app.h etc etc... ;)

It just offloads all the pain and hassle to the SDL maintainers. Also SDL is a pretty big beast (partly because it needs to accumulate a lot of hacks and workaround for buggy drivers and window systems). It would be nice when all those accumulated hacks wouldn't be needed in the first place.

For the idea of portable gfx applications in WASI it's also not really an option to base the window system glue standard on SDL (I guess though that SDL could be the base for one specific implementation of the WASI window system glue interface).

13 hours ago

pseudosavant

It is amazing to see what is happening with wasm/wasi lately and that is all grew out of asm.js.

asm.js, like JSON, is a strict subset of the JavaScript grammar that turned out to be very useful in a certain way. Obviously, a text encoding like asm.js wasn't an efficient way to distribute a bytecode, but it proved enough to make wasm the obvious next step.

3 days ago

pjmlp

Everyone keeps forgetting NaCL and PNaCL predates it, and asm.js only exists because Mozilla didn't want to adopt it.

3 days ago

flohofwoe

And this was the one time Mozilla was right ;)

3 days ago

p_l

Somewhat dubious claim if it was right or not, the only benefit was that asm.js was backwards compatible and set the stage for Mozilla to lose out by simply having the slower JS engine whereas NaCL/PNaCL proposal was "performance neutral" between browsers.

3 days ago

pjmlp

For what, Firefox is for all practical purposes irrelevant in a Chrome dominated Web, Google can steer WebAssembly into whatever direction fits Chrome.

2 days ago

flohofwoe

That's the situation today, but in 2013 when asm.js was invented Firefox was still relevant.

2 days ago

pjmlp

Yes, and the question in retrospective is was it worth it?

2 days ago

flohofwoe

IMHO: totally. Asm.js developed into WASM, which is better in any aspect than PNaCl (e.g. just one disadvantage is that PNaCl was an ossified subset of LLVM bitcode, this would resulted in the same quagmire that the DX team found themselves in when they based the DXC shader compiler and HLSL bytecode (DXIL) on a snapshot of the LLVM toolchain and bitcode - in the end the only realistic way out for D3D was to switch to a SPIRV flavour).

2 days ago

pjmlp

Yeah but that has nothing to do with bytecode formats, rather the wrong decisions on how to keep up with upstream FOSS projects within commercial entities.

Also they would not have such problem, had they used their own MSIL like bytecode instead, like the Phoenix compiler toolchain from MSR that was supposed to eventually replace VC++, in a LLVM like tooling, but ended up being cancelled.

2 days ago

shevy-java

I have finally realised that the year of true WebAssembly breakthrough will coincide with Desktop Linux of the year and GNU Hurd installed on every toaster. It will be a strange year ...

3 days ago

pjmlp

The Year of Desktop Linux already arrived, except not as originally expected.

It turned out to be The Year of Desktop Linux VMs/containers, on someone's else desktop OS.

2 days ago