-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Open
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work liste: impellerImpeller rendering backend issues and features requestsImpeller rendering backend issues and features requestsengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.team-engineOwned by Engine teamOwned by Engine teamtriaged-engineTriaged by Engine teamTriaged by Engine team
Description
We already have places where we need to transfer texture data to the host. For example, the Metal golden tests: https://github.com/flutter/engine/blob/41912e7be15a96e410febcf62952ab4cf13e5706/impeller/golden_tests/metal_screenshoter.mm#L27-L55
Example of what retrieving a texture drawn by Impeller looks like with the GLES backend:
auto canvas = impeller::Canvas();
// ... Record something into the canvas ...
auto picture = canvas.EndRecordingAsPicture();
std::shared_ptr<impeller::Image> image = picture.ToImage(your_aiks_context, impeller::ISize{800, 600});
std::shared_ptr<impeller::Texture> texture = image->GetTexture();
// From here, you're on your own. :(
auto& texture_gl = impeller::TextureGLES::Cast(texture);
std::optional<GLuint> texture_handle = texture_gl.GetGLHandle();
glBindTexture(GL_TEXTURE_2D, texture_handle.get());
auto size = texture.GetSize();
std::vector<uint8_t> pixels(size.width, size.height * 4);
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels.data());Correct-Syntax
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work liste: impellerImpeller rendering backend issues and features requestsImpeller rendering backend issues and features requestsengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.team-engineOwned by Engine teamOwned by Engine teamtriaged-engineTriaged by Engine teamTriaged by Engine team