Feat/linux cairo vulkan backend - #176
Open
OmarSiwy wants to merge 3 commits into
Open
Conversation
…ilds to Debug Zig 0.16.0's self-hosted x86_64 backend mis-lowers the SysV C ABI for wide mixed signatures — interleaved f32/pointer args and long stack-spilled parameter lists land a slot off, corrupting safe-area insets and view descriptors. The build graph worked around this by forcing LLVM on x86_64 for every artifact, which also forced slow Release-style link steps on Debug rebuilds. Fix the seams instead of the backend: - Linux GTK host: create/update view and GPU-surface present cross the seam through a single descriptor struct pointer (GtkViewDesc, GtkViewPatch, GtkGpuPresentDesc); thin C wrappers unpack them into the existing wide functions (C->C, correctly lowered). - Mobile embed: native_sdk_app_viewport takes one native_sdk_viewport_t pointer instead of 11 interleaved f32s. iOS, Android, and the example hosts build the struct and pass its address. With the seams safe, drop the blanket useLlvmWorkaround. App builds default to Debug (safety checks + markup hot-reload) on Zig's self-hosted backend for faster rebuilds; Release still uses LLVM. Consumers pick the backend and optimize mode explicitly through AppOptions/MobileLibOptions. Not compiled in this environment: the iOS/Android host sources; a mobile build must confirm they compile against the updated headers. Signed-off-by: omare <ok.elsawy@gmail.com>
Mirror the macOS backend's two halves on Linux. macOS rasterizes the canvas on the CPU with Core Graphics / Core Text, then presents through Metal; the Linux backend does the same with Cairo + Pango and Vulkan. - Vulkan presenter (native_sdk_vk.c/.h): a gpu_surface view scans out through an SDK-owned Vulkan swapchain riding a native child surface the compositor composites directly — a wl_subsurface on Wayland or a child InputOutput window on X11. The reference renderer's RGBA8 uploads into a canvas image and presents via a full-screen quad (shaders compiled inline via shaderc, mirroring the Metal host's inline MSL). Falls back to software when no Vulkan surface backend applies. - Cairo/Pango packet renderer (native_sdk_cairo.c, opt-in SCHEMIFY_CAIRO=1): an immediate-mode 2D surface driven command-by-command from the canvas packet, with payload-structural dispatch — any unpaintable command refuses the frame and the runtime falls back to the reference renderer. Both present through the descriptor-pointer GPU seam, so they draw correctly under the self-hosted x86_64 backend. root.zig references the Cairo symbols unconditionally, so every Linux link (framework and each example build.zig) compiles native_sdk_cairo.c and links freetype2. Verified: `zig build test-webview-system-link -Dplatform=linux -Dweb-engine=system` compiles and links gtk_host.c + native_sdk_vk.c + native_sdk_cairo.c against gtk4 / webkitgtk-6.0 / cairo / pango / vulkan / shaderc / wayland / x11. Signed-off-by: omare <ok.elsawy@gmail.com>
|
@OmarSiwy is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
| }; | ||
| VkResult pr = vkQueuePresentKHR(ctx->queue, &pi); | ||
| if (pr == VK_ERROR_OUT_OF_DATE_KHR || pr == VK_SUBOPTIMAL_KHR) { | ||
| native_sdk_vk_build_swapchain(v, v->px_width > 0 ? (uint32_t)v->px_width : width, v->px_height > 0 ? (uint32_t)v->px_height : height); |
Drop the SCHEMIFY_CAIRO opt-in gate and the SCHEMIFY_CAIRO_DIAG diagnostic. The Cairo path (box-blur backdrop, pixman fills) is the accelerated draw path; the reference rasterizer's O(kernel^2) Gaussian was making every modal/overlay frame ~26ms on the CPU fallback.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See #175