feat(oak_bridge): macOS wgpu Metal texture to IOSurface CVPixelBuffer bridge

W3 of the oak task list. SurfaceBridge wraps an engine wgpu (Metal) texture
into an IOSurface-backed CVPixelBuffer for gpui's Surface element: a reused
pixel buffer created with kCVPixelBufferIOSurfacePropertiesKey +
MetalCompatibility, aliased to a Metal texture via gpui_media's
CVMetalTextureCache, with a GPU-to-GPU MTLBlitCommandEncoder copy (a
device.poll(Wait) before the blit keeps the v1 path correct and
synchronous). A CPU readback fallback (stage_readback/finish_readback)
works on any backend. The surface_bridge demo (demo feature) streams a
moving test pattern through the bridge into a window and prints FPS;
smoke-verified on macOS at 1280x720. Windows/Linux paths are left for a
follow-up (noted in docs/zh). 2 tests pass.
This commit is contained in:
2026-08-09 05:54:58 +08:00
parent d72d2e8210
commit 66b05b0ebe
7 changed files with 652 additions and 3 deletions
Generated
+15
View File
@@ -4006,6 +4006,21 @@ dependencies = [
"libc",
]
[[package]]
name = "oak_bridge"
version = "0.1.0"
dependencies = [
"anyhow",
"core-foundation 0.10.0",
"core-video",
"gpui",
"gpui_media",
"gpui_platform",
"metal",
"pollster 0.4.0",
"wgpu",
]
[[package]]
name = "objc"
version = "0.2.7"