mach icon indicating copy to clipboard operation
mach copied to clipboard

Browser support

Open emidoots opened this issue 3 years ago • 6 comments

Meta issue related to https://github.com/hexops/mach/issues/21

emidoots avatar Nov 21 '21 15:11 emidoots

(moved my comment from #18 to here)

@slimsag I think it's promising not just for games but for cross-platform graphics of every kind. 👍🏽

Re: "Browser implementation of gpu.Interface", I am curious if you are planning to use Emscripten to build the Javascript <-> WASM glue code? I think that's the only way, currently, because in browser, only Javascript exposes the WebGPU driver.

Also it seems there is definitely interest in using WebGPU for General Purpose GPU (Compute), across native platforms, in browser, and in WASI as well. Some related links, which might provide some ideas for more bespoke things involving shader pipelines etc

  • https://tvm.apache.org/2020/05/14/compiling-machine-learning-to-webassembly-and-webgpu
  • https://github.com/WebAssembly/WASI/issues/285

guidorice avatar Apr 02 '22 06:04 guidorice

Relevant proposal over here: https://github.com/ziglang/zig/issues/10836

guidorice avatar Apr 12 '22 04:04 guidorice

@guidorice you can use freestanding wasm32 and js glue code to access all js resources in zig, no emscripten needed.

See for examples:

  1. https://github.com/bootradev/cupcake/
  2. https://github.com/masterq32/zero-graphics

iddev5 avatar Apr 18 '22 07:04 iddev5

Hello! May I ask what's the status of Browser support for now?

glyh avatar May 31 '23 05:05 glyh

@glyh this is my top priority; before we implement it we need to make sysjs provide bindgen-like capability (https://github.com/hexops/mach/issues/691) which is what I'm working on now.

Once we have that, we should be able to auto-generate browser bindings and then Mach will work seamlessly in the browser.

emidoots avatar Jun 02 '23 20:06 emidoots

As a quick and dirty solution can't we utilize emscripten/binaryen? Perhaps by generating a C file for emscripten to compile?

mateli avatar Aug 13 '23 09:08 mateli