feat(vulkan): add Android arm64 Vulkan support#268
Conversation
b11d267 to
7245d59
Compare
|
Thank you for this — the scope and quality of work here is impressive. Rust v29 semantic oracle, ELF dependency audits, dual cgo mode testing, and a clear prerequisite stack show serious engineering. Before we dive into the review: have you seen our Android research discussion? https://github.com/orgs/gogpu/discussions/31 — it covers the "Minimal CGO Bootstrap" approach and community feedback. Would be good to know if your design aligns with or diverges from what we outlined there. We will review the full stack (#264–#269, goffi#62, and this PR), but this is 10K+ LOC across multiple repositories touching core lifecycle, surface ownership, and a new platform. We take responsibility for every line that lands in the codebase, so this will take some time to do properly. We'll work through the prerequisites first and come back to the Android implementation after that. Thanks again for the thorough work and for being upfront about the merge path and remaining physical-device gates. Pinging people who may be interested in Android support or whose review would be valuable: Team: @lkmavi — 5 prerequisite lifecycle fixes affect all backends including Metal. Your review on surface ownership (#269) especially welcome. wgpu contributors: @samyfodil @amery — lifecycle/surface changes in prerequisites touch areas you've contributed to. goffi contributors: @jiyeyuran @tie @pekim — goffi#62 adds Bionic/Android arm64 platform loader. Your perspective on the FFI layer changes welcome. Android interested (from discussion #31 and #18): @JanGordon @beikege @celer @SideFx — this is an Android implementation candidate. Your input and testing interest welcome. |
|
One more thought — since you're driving the Android implementation and have hands-on experience with the Go mobile toolchain + NDK, would you be interested in starting a discussion on r/golang about adding mobile platform support to a Pure Go GPU stack? The community there is large and this could attract developers and testers who have Android/iOS devices and experience with Go on mobile. Getting early feedback and testing help from the broader Go community would help us reach enterprise-quality faster. Just an idea — totally up to you. |
Status
This is ready for maintainer review as a complete Android/arm64 Vulkan implementation candidate. It is intentionally stacked and cannot merge as-is: the canonical goffi dependency must ship, the WGPU prerequisites must merge, and this branch must then be rebased to its three Android-owned commits.
We need this Android path for Hearth, a Go game engine whose Android target depends on canonical WGPU/goffi support. This is not a drive-by patch: we are prepared to do whatever follow-up makes the implementation maintainable here—revise the shape, split or rebase work, add requested tests and device evidence, respond to review, and keep the Android matrix healthy after landing.
No
replace, committedgo.work, personal module path, or forked dependency is present. PR CI checks out one exact canonical goffi PR head and creates an ephemeral workspace.Android-owned implementation
libvulkan.so.Instance.CreateSurfaceignores the display handle and accepts only a non-null rawANativeWindow*, matching Rust wgpu v29.vkDestroySurfaceKHR; WGPU does not callANativeWindow_acquireorANativeWindow_release.SUBOPTIMAL.currentExtentis compositor-owned; variable extents are clamped.RGBA16Floatis advertised and selected only with extended-linear sRGB.The Android-owned range is three commits:
8160adc221122bca4de837d0c66223e78e281a8361cb8e12283509dcafd0c8cbce02d5526ad93ade7245d59850733b30ea218bb293e5cbde95660c6cThe range after the lifecycle prerequisite does not touch
core/instance.go,encoder_native.go, ortexture_native.go. The only desktop-named platform file ishal/vulkan/api_linux.go, whose one-line build constraint prevents Android from selecting Linux WSI sources.Rust wgpu v29 semantic oracle
The oracle is gfx-rs/wgpu v29.0.3 commit
4cbe6232b2d7c289b6e1a38416a6ae1461a22e81.a_native_windowonlywaitAll=trueR16G16B16A16_SFLOAT+ extended-linear sRGB onlyOwnership
core.Surfaceowns acquisition validity, so stale textures and retained views fail before HAL access. VulkanDeviceowns configured swapchain teardown; VulkanSurfaceowns onlyVkSurfaceKHR; no Vulkan instance child registry is needed.Exact prerequisite stack
0ed17064f8c977f35d9b49b5cde0d0c69e867ecfcc20faca8ff52e340f0a06c8e1b6599a03856d7fc74d1a2c2653bde97e4901ee76d9e5f587569c073b38114221c4e678daa26a3e839f94a12edce98e2496d96e5bd8d3cdd2fc34aff6e185eeeb02a278bf4caebf66310b6baad8c328dd87d51d3961a219487633c2c9f06bd5743e8f70aefd8ccaae72d877a7af0af4b628bf86e92536e27d88The previously published WGPU preview is preserved at
besmpl/archive/android-vulkan-preview-b11d267, exact headb11d2671e80081a191705c41c4e77e8b61472017.Verification
On the integrated, committed head:
GOWORK=off go test ./...GOWORK=off go test -race . ./core ./hal/vulkanGOWORK=off go vet . ./core ./hal/vulkanGOWORK=off go test -tags rust ./...GOWORK=off go mod verify0 issueslibc.so/libdl.sopluslibvulkan.sowhile rejecting glibc, standalone pthread, desktop WSI, GLES, and software fallbackA separate maintainer-oriented review found no remaining Android-owned correctness, Rust-v29 parity, public-contract, scope, or CI blockers.
Merge prerequisites and follow-through
This PR is ready for review, but the current stacked branch is deliberately not ready to merge. The remaining path is explicit:
Cross-build and binary-shape evidence does not substitute for that physical-device evidence, and this PR does not claim released Android support before those gates close. We will own the follow-through rather than leave that integration work to maintainers.
Hosted CI note: run 29444335410 is
action_requiredwith zero jobs until an upstream maintainer approves the fork workflow.