hexops / mach

zig game engine & graphics toolkit
https://machengine.org
Other
3.17k stars 154 forks source link

Browser support #90

Open slimsag opened 2 years ago

slimsag commented 2 years ago

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

guidorice commented 2 years ago

(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

guidorice commented 2 years ago

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

iddev5 commented 2 years ago

@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

glyh commented 1 year ago

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

slimsag commented 1 year ago

@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.

mateli commented 1 year ago

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