Description
Note
This is a quasi-placeholder issue, as I only learned what a "Surface Texture" is ~5 minutes ago, so part of the resolution will be updating this issue with actual useful information. Thanks for your patience 😄
An Android SurfaceTexture
is a combination of a surface and an OpenGL ES (GLES) texture 1.
For example, this would be used to display frames from a camera plugin:
On newer devices (or is it APIs? I'm not sure), Android provides a backend-agnostic hardware buffer that can be used (directly) by Vulkan but on older devices we'll receive an OpenGL-backed surface texture, and need to adapt it for use within Vulkan - that will involve creating a new OpenGL context, and some interop.
Some possible references:
- https://stackoverflow.com/questions/56970011/how-to-pass-a-texture-between-opengl-es-and-vulkan
- https://stackoverflow.com/questions/38907764/how-to-render-to-opengl-from-vulkan?rq=3
As an initial look, I'll try package:camera
in an Impeller+Vulkan demo. It might also be worth looking into Skia's codebase to see how they handle this.
/cc @jonahwilliams @johnmccutchan (feel free to edit this description if inaccurate!)