samizdatco / skia-canvas

A GPU-accelerated 2D graphics environment for Node.js
MIT License
1.7k stars 66 forks source link

Support GL and Vulkan backends #104

Closed samizdatco closed 2 years ago

samizdatco commented 2 years ago

These changes allow for DirectContexts to be created with either OpenGl or Vulkan and moves the selection between the two into a new module at src/gpu. If neither GPU backend is available, it will use CPU rendering as a fallback. The selection is exposed in Javascript on the Canvas object through a new method called gpuSupport().

It's unclear how large the performance benefits from GPU rendering are, but the output is much closer to that seen in browsers since the GPU pathway is what they actually use (meaning bugs like #88 that crop up in the CPU renderer frequently don't get noticed upstream).


Many thanks to @lucasmerlin for this fantastic work!