Skip to content

Sample platform textures as scene textures - #290

Open
bdero wants to merge 1 commit into
masterfrom
bdero/external-textures
Open

Sample platform textures as scene textures#290
bdero wants to merge 1 commit into
masterfrom
bdero/external-textures

Conversation

@bdero

@bdero bdero commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Resolves #179.

Adds ExternalTexture, a TextureSource fed by a platform texture id, so video, camera preview, and anything else a plugin registers with Flutter's texture registry can be assigned to a material texture slot. Frames are captured through the compositor, which means an Android external OES texture or a biplanar NV12 buffer arrives as an ordinary RGBA texture and no material needs a variant. Capture is driven by the frames that sample the source rather than by a ticker, so a source nothing draws costs nothing, and captures are throttled to one in flight.

Verified on Android Impeller GLES with both video_player and a live camera preview, rendering on geometry with the source's colors and frame-to-frame motion intact.

macOS and iOS capture an empty frame today. EmbedderExternalTextureMetal::ResolveTexture gates its Impeller branch on a non-null aiks context and otherwise falls back to a Skia path that is inactive under Impeller, and LayerTree::Flatten never populates that field, so a snapshot cannot resolve a texture id there. A debug build warns when it sees an empty first capture, the class documents it, and WidgetTexture around the plugin's preview widget still works on those platforms. Upstream fix to follow.

New example, "External Texture", switches between a bundled test-pattern video and the device camera and puts the feed on a screen and a spinning cube with live material controls.

Resolves #179.

Adds `ExternalTexture`, a `TextureSource` fed by a platform texture id, so
video, camera preview, and anything else a plugin registers with Flutter's
texture registry can be assigned to a material texture slot. Frames are
captured through the compositor, so an Android external OES texture or a
biplanar NV12 buffer arrives as an ordinary RGBA texture and no material
needs a variant. Capture is driven by the frames that sample the source
rather than by a ticker, so an unused source costs nothing.

macOS and iOS capture an empty frame today, because the engine resolves
external textures for a snapshot without an Impeller context; a debug build
warns when it sees this, and `WidgetTexture` still works there.
@bdero bdero added the rendering Behavior when preparing or drawing geometry to the screen. label Aug 2, 2026
@argos-ci

argos-ci Bot commented Aug 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
android_gles (Inspect) ⚠️ Changes detected (Review) 1 added Aug 2, 2026, 10:29 AM
android_vulkan (Inspect) ⚠️ Changes detected (Review) 1 added Aug 2, 2026, 11:13 AM
linux (Inspect) ⚠️ Changes detected (Review) 1 added Aug 2, 2026, 10:23 AM
web (Inspect) ⚠️ Changes detected (Review) 1 added Aug 2, 2026, 10:23 AM
windows (Inspect) ⚠️ Changes detected (Review) 1 added Aug 2, 2026, 10:25 AM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rendering Behavior when preparing or drawing geometry to the screen.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support External Textures (Flutter Texture / Android SurfaceTexture) as Scene Textures

1 participant