3 ms·
I believe 2D canvas rendering is performed on the CPU rather than the GPU.
by skeoh 9y ago
I believe 2D canvas rendering is performed on the CPU rather than the GPU.
- ZenPsycho 9y agomuch of it is offloaded to the GPU by recent browsers
- slavik81 9y agoThe important bit is getting the metaball function into the fragment shader. I'm not really a web guy, but I know you can do that with WebGL. For a canvas with a more limited API, you can still do it if images are GPU accelerated with a composite mode like "lighter". If that's the case, you can do basically the same thing by first rendering the metaball function to an image once, and then drawing that image for each metaball. Doing it via an image introduces extra aliasing artifacts, but might get around the API limitations. Edit: I suppose you would still want to find a GPU-accelerated threshold function for the step after that.
- Franciscouzo 9y agoYou wouldn't use a 2d context, you can use WebGL shaders instead. Besides that, most operations on a 2d context are performed on the GPU.
- fyrstenberg 9y agoMost is done on the GPU nowadays - only getImageData() and putImageData() has to go via the CPU. You can BTW also "cheat" your way to meta-balls: https://stackoverflow.com/questions/17177748/increasing-real-time-performance-on-canvas-effects/17178445#17178445 https://stackoverflow.com/questions/17177748/increasing-real...