Sample platform textures as scene textures - #290
Open
bdero wants to merge 1 commit into
Open
Conversation
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.
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #179.
Adds
ExternalTexture, aTextureSourcefed 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_playerand 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::ResolveTexturegates its Impeller branch on a non-null aiks context and otherwise falls back to a Skia path that is inactive under Impeller, andLayerTree::Flattennever 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, andWidgetTexturearound 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.