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 graphic...
- Mar 28, 2020
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.
HotCakeX
Mar 28, 2020MVP
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?
Thraetaona
Mar 28, 2020Iron Contributor
You'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.
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.
- HotCakeXMar 28, 2020MVPIn games that I've played DirectX 12 is slightly better than Vulkan but if it's between DirectX 11 and Vulkan then Vulkan is a better choice.
so even though browsers need far less power than AAA games but using Vulkan in Chromium would result in better performance
Operating system support: Android, Linux, Windows, Nintendo Switch, Stadia, Tizen, macOS
it's interesting Vulkan has only been around for 4 years yet it managed to be almost on par with DirectX12 from Microsoft with years of development and experience behind the project- ThraetaonaMar 28, 2020Iron ContributorDepends on hardware, for example on AMD Vulkan usually outperforms D3DX12.
Combined with consoles, cloud gaming, mobile and desktop support of Vulkan, where AMD or ARM based hardware are mostly used.
It also depends on how the code is written, while both are relatively low level, they work different in some cases, so only knowledge of a single API isn't enough to write optimized-efficient code for the other.
WebGPU is a new addition to the web platform, successor to WebGL 2 (2.1).
That should make Graphically intensive (not necessarily AAA) games possible.
WebGPU will probably have several backends (modern OpenGL, DirectX11/12 and Vulkan), Using Vulkan also allows for less power consumption or higher performance on low-end underpowered devices.
Well Microsoft has had a lot of experience with previous versions of DirectX and knew the underlying OS/hardware very well.
For years OpenGL has been far superior to DirectX, up until the DirectX 7-8.1 era; Vulkan which was initially called 'OpenGL next' is aiming to provide a performant and standardized interface (Which OpenGL unfortunately lacked until recently) across the industry.