Live data from Hacker News

WebKit switching to Skia for 2d graphics rendering

blogs.igalia.com

61–70 of 181 posts

Re: WebKit switching to Skia for 2d graphics rendering

#61

Skia is a great library, but as all things Google it's a pain to build. They don't use CMake and building it from source takes 20-30 minutes on a modern laptop. Furthermore, it's constantly changing its APIs and much of it is undocumented and unclear on how to use optimally. Most of the decisions taken by development team aren't discussed in the open and this makes it hard to understand the codebase. I wish there was…

I have an open source project that uses Skia, and I just keep static libraries for all target platforms because the Skia build process is so painful.

Maybe once a year I bite the bullet, do a new Skia build on all the platforms, and then I have to figure out how the C++ API has changed. At least that’s just rote work of fixing compiler errors by looking at the new header files.

Even though it’s a pain in the ass, I still use Skia because it’s got the best combination of performance and features. Sadly Cairo doesn’t quite compete. Skia gives my project a pretty good guarantee that 2D graphics render like in Chrome, and that’s important for this use case.

Re: WebKit switching to Skia for 2d graphics rendering

#62

Earlier quoted context omitted.

Yes, from 2023 Jul 21 blog entry, https://medium.com/@wartelski/impeller-rendering-engine-is-i... : "Impeller is a new Flutter rendering engine that the Flutter team claims solves the early-onset jank problem. It is designed as a replacement for Skia, with the goal of enabling better animations and addressing the jank issue, while also potentially providing support for 3D, which was not previously possible with Skia,…

>Unlike Skia, Impeller compiles shaders during the build process instead of at runtime. This wouldn't work on most platforms as graphic driver updates can break compatibility with previously compiled shaders.

There's often multiple compilation steps, first compiling some application specific representation down to HLSL/GLSL/MSL source code, then compiling that down to DXIL/SPIRV/Metal bytecode, and then handing that off to the driver for compilation to native code. The first two steps at least can be done ahead of time, the bytecode is stable.

Metal and CUDA actually let you AOT compile native binaries since they have relatively few hardware targets to support, with a fallback to compiling bytecode to native at runtime for forwards compatibility.

Re: WebKit switching to Skia for 2d graphics rendering

#63

Earlier quoted context omitted.

> I wish there was a nice and small vector graphics library with GPU acceleration. I'm personally skeptical about GPU acceleration being the answer to 2D rendering for various reasons. I'm looking forward to Blend2D https://blend2d.com/ > which is JIT based maturing and being the preferred solution.

What happened to Cairo the 2d graphics tool?

Nothing happened to it. It’s just slow.

Re: WebKit switching to Skia for 2d graphics rendering

#64

Earlier quoted context omitted.

Out of interest what's difficult about it to build? In my experience CMake isn't exactly a great developer experience, and many projects of this size take similar times to build. Is the problem specific to Skia or Google open source projects, or is it more based on the (necessary) size of the project?

> In my experience CMake isn't exactly a great developer experience o_O unlike GN? Have you used it much? https://gn.googlesource.com/gn/

I haven't used GN, I'm mostly thinking of Bazel, but was also just interested in the specifics.

Re: WebKit switching to Skia for 2d graphics rendering

#65

Skia is a great library, but as all things Google it's a pain to build. They don't use CMake and building it from source takes 20-30 minutes on a modern laptop. Furthermore, it's constantly changing its APIs and much of it is undocumented and unclear on how to use optimally. Most of the decisions taken by development team aren't discussed in the open and this makes it hard to understand the codebase. I wish there was…

I was skeptical of your claims about building it so I went ahead and downloaded skia and built it myself. It was simple and on my 4 year old desktop (8 cores) it took under a minute to compile skia after it had downloaded its dependencies. All I did was run 2 commands ./tools/git-sync-deps and bazel build //:skia_public. This was not painful at all.

Re: WebKit switching to Skia for 2d graphics rendering

#67
post #62

Earlier quoted context omitted.

>Unlike Skia, Impeller compiles shaders during the build process instead of at runtime. This wouldn't work on most platforms as graphic driver updates can break compatibility with previously compiled shaders.

There's often multiple compilation steps, first compiling some application specific representation down to HLSL/GLSL/MSL source code, then compiling that down to DXIL/SPIRV/Metal bytecode, and then handing that off to the driver for compilation to native code. The first two steps at least can be done ahead of time, the bytecode is stable. Metal and CUDA actually let you AOT compile native binaries since they have rel…

The bytecode compilation doesn't really matter, it's still gonna jank. Maybe not as badly, but it will. The only way to get rid of jank is to cache not the bytecode and not even the native code, but the PSOs. Realistically, that is only possible on the target machine, unless you have a ginormous farm of machines representing all the permutations of hardware and drivers. That's basically what Steam does with its mass of users.

The alternative is to just not have that many shader permutations, and potentially take a performance hit from that. This seems to be the strategy that Impeller is following.

Re: WebKit switching to Skia for 2d graphics rendering

#68

Skia is a great library, but as all things Google it's a pain to build. They don't use CMake and building it from source takes 20-30 minutes on a modern laptop. Furthermore, it's constantly changing its APIs and much of it is undocumented and unclear on how to use optimally. Most of the decisions taken by development team aren't discussed in the open and this makes it hard to understand the codebase. I wish there was…

I was skeptical of your claims about building it so I went ahead and downloaded skia and built it myself. It was simple and on my 4 year old desktop (8 cores) it took under a minute to compile skia after it had downloaded its dependencies. All I did was run 2 commands ./tools/git-sync-deps and bazel build //:skia_public. This was not painful at all.

How long did downloading dependencies take? That's part of the build process.

As a maintainer of a project that includes another popular library from Google, here's why it's difficult to build:

- building requires downloading Googles custom toolchain and build system

- dependencies are huge, so you have lenghty download times even on fast connections

- it usually works if you are using a recent versions of OS and Python, but if you try running the same command in a year or two it might fail because they changed the requirements

- if anything fails you have to dig through multiple levels of abstractions to figure out where it failed and why

- if you want to maintain software for a few years, you'll have to keep fixing the build process because the build will suddenly stop working for unknown reasons once a year or so

Re: WebKit switching to Skia for 2d graphics rendering

#69

Earlier quoted context omitted.

I was skeptical of your claims about building it so I went ahead and downloaded skia and built it myself. It was simple and on my 4 year old desktop (8 cores) it took under a minute to compile skia after it had downloaded its dependencies. All I did was run 2 commands ./tools/git-sync-deps and bazel build //:skia_public. This was not painful at all.

How long did downloading dependencies take? That's part of the build process. As a maintainer of a project that includes another popular library from Google, here's why it's difficult to build: - building requires downloading Googles custom toolchain and build system - dependencies are huge, so you have lenghty download times even on fast connections - it usually works if you are using a recent versions of OS and Pyt…

>How long did downloading dependencies take?

Around 5 minutes.

>That's part of the build process.

It's dependent on one's internet speed so I didn't think it made much sense to time it. If it took 20 to 30 minutes to download I would have mentioned it.

Re: WebKit switching to Skia for 2d graphics rendering

#70

I was curious how Igalia was funded and this was a surprisingly good interview on how they’re structured, how they work with the major browser companies, etc… Apparently many Apple, Google, Firefox engineers left to work for them. https://thenewstack.io/igalia-the-open-source-powerhouse-you...

Igalia and Collabora seem like pretty interesting places to work if you're doing open source. I've seen nothing but good come coming from there.
Post reply on HN