News for hackers. Stuff that matters.
Re:Wasmer: A Python library for executing WebAssembly binaries by flohofwoe on Tuesday April 16, 2019 @05:16AM (#19672205)
I have an actual real-world use case for this :)

Shader-cross-compilation for 3D frameworks:

https://floooh.github.io/2017/05/15/oryol-spirv.html

I'm hooking python scripts as custom-build-jobs into C/C++ projects which (for instance) takes care of compiling GLSL shader code into HLSL (D3D), MSL (Metal) and various GLSL versions (for GLES2, GLES3 and desktop GL).

Khronos provides C++ projects which help with this stuff:

https://github.com/KhronosGroup/glslang

https://github.com/KhronosGroup/SPIRV-Cross

So I'm using Python to hook my custom build jobs into the C/C++ build system (via cmake), but I still need to invoke native command line tools (or DLLs) which wrap around those Khronos libraries. Currently this means building (at least) 3 executables for Windows, macOS and Linux, and "distribute" those precompiled exes with my python code.

It looks like with this python+wasmer solution, I can instead compile the Khronos libraries into WASM modules, and the result runs "anywhere" where wasmer runs (e.g. also Raspberry Pi, BSDs etc...).

That's really cool stuff :)

There are no comments on this comment yet.