Proposal: public “adopt external GPU texture” API for Makepad Texture
Hi — we’d like to propose a thin, platform-specific API to adopt an externally owned GPU surface into an existing Makepad Texture, so apps can sample it through normal DrawVars::set_texture / shader sample paths without a CPU round-trip.
Makepad already does this internally today (VideoExternal on Windows, OES / blit on Android, CVMetal / SharedBGRAu8 / IOSurface on Apple). What’s missing is a stable app-facing way to do the same thing for app-owned decoders, cameras, and GPU effect pipelines.
Why this matters (use cases)
Hardware video decode → UI (primary) Windows: D3D11VA / Media Foundation → ID3D11Texture2D / SRV Android: MediaCodec → SurfaceTexture → GL_TEXTURE_EXTERNAL_OES Apple: VideoToolbox / AVFoundation → CVPixelBuffer / MTLTexture For 4K / high frame-rate playback, download→upload kills bandwidth, latency, and battery. The decoder already produced a GPU surface; the UI only needs to show it.
Camera / live preview Same pattern: camera → platform surface → Makepad widget. Preview needs low latency; CPU paths are a poor fit.
GPU effect chains Beauty / filter SDKs (e.g. texture-in / texture-out) and custom compute/blit passes. Input and output stay on the GPU; Makepad only adopts the final texture for drawing.
Embedding another renderer A game engine, map engine, or WebView/compositor draws into a shared RT; Makepad embeds that frame as a normal control texture (related to today’s SharedBGRAu8 / GL bridge ideas).
None of these need Makepad to own demux/decode. They need Makepad to accept a texture the app already has.
Source: makepad/makepad