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.
38 lines
949 B
TOML
38 lines
949 B
TOML
[package]
|
|
name = "oak_bridge"
|
|
version = "0.1.0"
|
|
edition.workspace = true
|
|
authors = ["Oak <oak@users.noreply.github.com>"]
|
|
description = "macOS video-frame bridge: wgpu Metal textures to IOSurface-backed CVPixelBuffers for gpui's Surface element"
|
|
publish = true
|
|
license = "Apache-2.0"
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[dependencies]
|
|
anyhow.workspace = true
|
|
|
|
[target.'cfg(target_os = "macos")'.dependencies]
|
|
core-foundation.workspace = true
|
|
core-video.workspace = true
|
|
gpui_media = { path = "../gpui_media" }
|
|
metal.workspace = true
|
|
wgpu.workspace = true
|
|
|
|
[target.'cfg(target_os = "macos")'.dev-dependencies]
|
|
gpui = { workspace = true }
|
|
gpui_platform = { workspace = true, features = ["font-kit"] }
|
|
metal.workspace = true
|
|
pollster.workspace = true
|
|
wgpu.workspace = true
|
|
|
|
[[example]]
|
|
name = "surface_bridge"
|
|
path = "examples/surface_bridge.rs"
|
|
required-features = ["demo"]
|
|
|
|
[features]
|
|
# The FPS demo example needs a windowing backend; it is opt-in.
|
|
demo = []
|