Forum Discussion
HotCakeX
Mar 27, 2020MVP
Which one is better? Skia API as the graphics API or OpenGL ES
I'm looking for pros and cons of each API, because Edge Canary version 83.0.467.0 has a new flag called:
Skia API for compositing
If enabled, the display compositor will use Skia as the graphics API instead of OpenGL ES. – Windows
#enable-skia-rendererand I want to know what are the benefits of Skia API over OpenGL ES if i turn it on?
Actually, the flag has been there for a while, although sometimes temporary removed due to graphical issues and glitches.
Really depends on the context. The Platform you are using, the OS, Skia's Backend and finally your use cases can all affect Skia's performance.
Also, Skia itself has a few backends; you could make it use OpenGL ES (called Ganesh).
It's worth mentioning that Skia is already used in most of Chromium's Graphical components, similar to WebRender in Firefox.
Comparing Skia to other graphics libraries:
Skia, compared to GDI+ is definitely faster, GDI+ is not even hardware accelerated anymore after Windows Vista.
Compared to Cairo, Skia seems to be faster, many projects are switching from Cairo to Skia (or other alternatives) aswell.
Compared to Direct2D which is only available on windows and therefore not cross-platform, both are fast; but Skia is available on a wide variety of devices and operating systems, so it will stay in use by chrome.
CPU-based rendering (Especially for 3D) is slow, and the OpenGL ES backend is mostly used for embedded devices like smartphones. Since flags are not even accessible by default on mobile devices, I'll assume OpenGL on Desktop.
It should generally be faster; for MacOS Though, I'm not sure what will happen after Metal and full deprecation of OpenGL.
To conclude, GPU-accelerated Skia should be faster. if you encounter any graphical painting issues or bugs you could turn it off.
- ThraetaonaIron Contributor
Actually, the flag has been there for a while, although sometimes temporary removed due to graphical issues and glitches.
Really depends on the context. The Platform you are using, the OS, Skia's Backend and finally your use cases can all affect Skia's performance.
Also, Skia itself has a few backends; you could make it use OpenGL ES (called Ganesh).
It's worth mentioning that Skia is already used in most of Chromium's Graphical components, similar to WebRender in Firefox.
Comparing Skia to other graphics libraries:
Skia, compared to GDI+ is definitely faster, GDI+ is not even hardware accelerated anymore after Windows Vista.
Compared to Cairo, Skia seems to be faster, many projects are switching from Cairo to Skia (or other alternatives) aswell.
Compared to Direct2D which is only available on windows and therefore not cross-platform, both are fast; but Skia is available on a wide variety of devices and operating systems, so it will stay in use by chrome.
CPU-based rendering (Especially for 3D) is slow, and the OpenGL ES backend is mostly used for embedded devices like smartphones. Since flags are not even accessible by default on mobile devices, I'll assume OpenGL on Desktop.
It should generally be faster; for MacOS Though, I'm not sure what will happen after Metal and full deprecation of OpenGL.
To conclude, GPU-accelerated Skia should be faster. if you encounter any graphical painting issues or bugs you could turn it off.
Thanks, turned it on and so far no issues,
so Chrome uses Skia just because it's multi platform?
I think Direct2D or Direct3D should be faster on Windows compared to Skia but they can't be used on Linux and Mac and that's why Google is not using them?- ThraetaonaIron ContributorYou're welcome,
In addition to being performant, yes; writing platform specific code to use the fastest API on each target is going to need a lot of maintenance and most likely introduce many bugs.
Both Direct2D and Skia are fairly fast; also OpenGL calls in windows end up being translated to their DirectX counterparts through ANGLE anyway.
But if they wanted to avoid that very little overhead they could just write a DirectX backend for Skia rather than abandoning it and switching to Direct2D completely.
Or even better, a Vulkan backed, given how its cross-platform and much faster than any other alternative. Best choice for mobile devices, too.