4 ms·
How does text rendering on images work on different platforms? Do you always get the same result regardless of the platform? I'm asking because usually Skia pr
by pier25 6y ago
How does text rendering on images work on different platforms? Do you always get the same result regardless of the platform?
I'm asking because usually Skia produces different aliasing results on different platforms (eg: Windows vs macOS).
- paraboul 6y agoNot the author, but user of Skia on daily basis. It depends. Skia can either be used as software or GPU renderer. GPU AA rendering can slightly differs when using MSAA. When MSAA is turned on, Skia has different path renderer strategies (that could be CPU-based, like SDF, or GPU-based using coverage counting). In that case (msaa turned off), AA result should be identical on all platforms, at the cost of performance.
- mtklein 6y agoHaving looked at Skia against a lot of different OS/GPU/driver combinations, I would be surprised to see bit identical results from GPU rendering except perhaps across different nvidia cards. I wouldn't even necessarily expect identical results in replicated runs on the same machine. Worth keeping in mind that what Skia's GPU backend decides to do depends on GPU features, and sometimes on GPU workarounds. There's no guaranteed way to force it to render identically on all platforms short of something like swiftshader.
- deleted 6y ago[deleted]
- paraboul 6y agohey thanks for answering! You're one of the main skia contributor right? I thought GrGlCaps was supposed to fallback most of the time to equivalents. Also thought that golden images baseline where pixel tested against a large set of different hardware. But yeah, Skia blacklists MSAA for Intel GPU, so if you opt-in for sampling, you're not guaranted it's going to be enabled and therefore observe differences
- Dork1234 6y agoCan you force CPU only and control MSAA or are you always restricted by the hardware of the host system in some ways?
- paraboul 6y agoyou can force CPU only and also disable MSAA on the GPU renderer. Enabling the GPU renderer doesn't guarantee that everything will be generated on the GPU. Skia can still decide to rasterize a path on the CPU before uploading it on the GPU.
- c-smile 6y agoIf by "on different platforms" you mean "on different server platforms" then result will be different but close enough. On Windows, for example, Skia will render text closer to Direct2D/DirectWrite. On MacOS to CoreText. For the reference, here is rendering of the same UI (HTML/CSS) in Sciter using Direct2D (left) and Skia/OpenGl (right): https://sciter.com/wp-content/uploads/2020/09/d2d-vs-skia.png https://sciter.com/wp-content/uploads/2020/09/d2d-vs-skia.pn...
- pier25 6y ago> On Windows, for example, Skia will render text closer to Direct2D/DirectWrite. On MacOS to CoreText. So what you're saying is that Skia changes the aliasing to look like the platform it's running on? Damn, I wish I could make Chrome on Windows render text like it does macOS.
- deleted 6y ago[deleted]
- c-smile 6y agoI do not see any significant difference (other than different system fonts): Here is MacOS rendering https://sciter.com/wp-content/uploads/2020/09/mac-os-front.png https://sciter.com/wp-content/uploads/2020/09/mac-os-front.p...
- pier25 6y agoMaybe not when using Sciter, but on Chrome the differences are massive. I will try to make some screenshots later.
- jahewson 6y agoYou might want to check out MacType https://github.com/snowie2000/mactype/wiki/Google-Chrome https://github.com/snowie2000/mactype/wiki/Google-Chrome
- paraboul 6y agoAlso depends what you mean by rendering. Skia also uses system library for font shaping (CoreText on macOS and direct2d on windows), but also has support for using harfbuzz instead (which works on any platform, even for WebAssembly).