vercel-labs / vercel-labs/native
Linux: Cairo + Vulkan Backend for much needed performance improvement
Nobody has claimed this yet.
- Dominant language
- Zig
- Stars
- 7.7k
- Forks
- 314
- Avg merge
- 5h
- Merged PRs (30d)
- 13
Description
Problem
macOS rasterizes canvas on CPU (Core Graphics / Core Text) then presents via
Metal. Linux has no such split → no GPU present path, no CPU-raster fast path.
Fix
Same two halves on Linux:
- Vulkan presenter (
native_sdk_vk.c/.h) — Metal analog. gpu_surface view
scans out through SDK-owned Vulkan swapchain on a native child surface the
compositor composites directly:wl_subsurface(Wayland) or child
InputOutputwindow (X11). Shaders compiled inline via shaderc (mirrors
Metal host's inline MSL). No Vulkan surface → falls back.software. - Cairo/Pango packet renderer (
native_sdk_cairo.c, opt-inSCHEMIFY_CAIRO=1)
Core Graphics + Core Text analog. Immediate-mode 2D, driven command-by-command
from the canvas packet. Payload-structural dispatch: unpaintable command
refuses the frame → runtime falls back to reference renderer (correct, just
unaccelerated).
Both present through the descriptor-pointer GPU seam → correct under self-hosted x86_64.
Notes
root.zigreferences Cairo symbols unconditionally → every Linux link
(framework + each examplebuild.zig) must compilenative_sdk_cairo.c+
linkfreetype2.- Verified:
zig build test-webview-system-link -Dplatform=linux -Dweb-engine=system
compiles + linksgtk_host.c+native_sdk_vk.c+native_sdk_cairo.c
against gtk4 / webkitgtk-6.0 / cairo / pango / vulkan / shaderc / wayland / x11.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with root.zig and the referenced native_sdk_vk.c/.h and native_sdk_cairo.c files, then inspect the framework and example build.zig files. Run zig build test-webview-system-link -Dplatform=linux -Dweb-engine=system to establish the current link path. Done means the Linux Vulkan and opt-in Cairo paths compile and link with the stated fallback behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux, zig
- Domain
- computer-graphics, desktop, operating-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100