You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would also like wasm-support, but I disagree with your bonus-points
Emscripten, especially nowadays, does a decent job of making light wasm, especially with WASM=1. the alternative would be to implement all of our own memory-management and hooks back to canvas. Other little gotchas exist, like stdio. you need to implement all that yourself (and make hooks in the host) or use something like wasi-sdk, which assumes the host will have a specific shape of imports (WASI) but the outputted WASM ends up a little less optimized, and you still need the host functions (I know because I made a browser host WASI.) I don't really see the point of this, even though I often avoid emscripten, especially when doing non-web stuff that doesn't need IO or web things, but I think it will just mean more work that needs to be done here, without any real payoff.
have you done speed tests with a 2D canvas on webgl? the speed is actually a bit better in my testing, with 2D canvas for a framebuffer, on web. it's also a more "regular way" to do a 2D canvas on the web. it seems a bit silly to setup a 2D canvas shader, and copy memory in/out of the GPU manually, when the browser already does this better, for you.
Anyway, I made a PR that does 2D canvas with imagedata. I think it's probly about as good as you will get, in terms of performance.
Activity
konsumer commentedon Feb 16, 2025
I would also like wasm-support, but I disagree with your bonus-points
WASM=1. the alternative would be to implement all of our own memory-management and hooks back to canvas. Other little gotchas exist, like stdio. you need to implement all that yourself (and make hooks in the host) or use something like wasi-sdk, which assumes the host will have a specific shape of imports (WASI) but the outputted WASM ends up a little less optimized, and you still need the host functions (I know because I made a browser host WASI.) I don't really see the point of this, even though I often avoid emscripten, especially when doing non-web stuff that doesn't need IO or web things, but I think it will just mean more work that needs to be done here, without any real payoff.Anyway, I made a PR that does 2D canvas with imagedata. I think it's probly about as good as you will get, in terms of performance.