Zubnix/skia-wasm-port

Awesome work!

reed-at-google opened this issue · 4 comments

Very impressed. Would love to hear any problems or complaints you have with Skia; changes we could do to make this library easier to build and/or smaller/faster.

Mike Reed
reed@google.com

Thanks for the heads up!

As for suggestions:
The first thing that comes to mind is I had to make some changes to the original skia build script to get some options disable/enabled that were automatically enable/disable on linux but were needed when compiling to wasm (llvm bitcode actually). I'll see if I can diff them (it's been a while since I worked on this port). Would you like me to put them here, or as a separate bug on the skia project site?

Hi reed,

I did not try the GL backend, although I would really like to plug skia into webgl.

Ideally 🦄 I'd like to have skia render in an offscreen webgl canvas in a webworker. But that's mostly because of my own personal agenda 😉

I've created a quick gist of the changes I did to give you some idea: https://gist.github.com/Zubnix/8e63ee2e0f1ceffc9ad266596d5f5197

There are basically 2 changes.

  • Enable the custom font manager when compiling for wasm. This one speaks for itself I think.
  • Disable the entire gpu support. If I remember correctly, this was done because skia seems to pull in a lot of external GL related libraries that are either not desired nor available when targeting the browser. As I was focussing on getting things to work first, I did not put any effort into getting things to work with WebGL. I assume some effort is required ❓ to have skia build using only wasm (or rather emscripten) compatible egl+gles2 & friends.

A deliberate C-api would absolute make things much easier when creating bindings. 👍