| Flutter Impeller |

Public Member Functions | List of all members
impeller::BlitCopyTextureToBufferCommandGLES Struct Reference

`#include <blit_command_gles.h>`

Inheritance diagram for impeller::BlitCopyTextureToBufferCommandGLES:

## Public Member Functions
| ~BlitCopyTextureToBufferCommandGLES () override
std::string | GetLabel () const override
bool | Encode (const ReactorGLES &reactor) const override
Public Member Functions inherited from impeller::BlitEncodeGLES
virtual | ~BlitEncodeGLES ()

## Additional Inherited Members
Static Public Member Functions inherited from impeller::BackendCast< BlitEncodeGLES, BlitCommand >
static BlitEncodeGLES & | Cast (BlitCommand &base)
static const BlitEncodeGLES & | Cast (const BlitCommand &base)
static BlitEncodeGLES * | Cast (BlitCommand *base)
static const BlitEncodeGLES * | Cast (const BlitCommand *base)
Public Attributes inherited from impeller::BlitCopyTextureToBufferCommand
std::shared_ptr< Texture > | source
std::shared_ptr< DeviceBuffer > | destination
IRect | source_region
size_t | destination_offset
Public Attributes inherited from impeller::BlitCommand
std::string | label

## Detailed Description

Definition at line 32 of file blit_command_gles.h.

## Constructor & Destructor Documentation

## ◆ ~BlitCopyTextureToBufferCommandGLES()

impeller::BlitCopyTextureToBufferCommandGLES::~BlitCopyTextureToBufferCommandGLES | ( |  | ) |
| override default

## Member Function Documentation

## ◆ Encode()

bool impeller::BlitCopyTextureToBufferCommandGLES::Encode | ( | const ReactorGLES & | reactor | ) | const
| override virtual

Implements impeller::BlitEncodeGLES.

Definition at line 127 of file blit_command_gles.cc.

128 {
129 if (source->GetTextureDescriptor().format != PixelFormat::kR8G8B8A8UNormInt) {
130 VALIDATION_LOG << "Only textures with pixel format RGBA are supported yet.";
131 return false;
132 }
133
134 const auto& gl = reactor.GetProcTable();
135
136 GLuint read_fbo = GL_NONE;
137 fml::ScopedCleanupClosure delete_fbos(
138 [&gl, &read_fbo]() { DeleteFBO(gl, read_fbo, GL_READ_FRAMEBUFFER); });
139
140 {
141 auto read = ConfigureFBO(gl, source, GL_READ_FRAMEBUFFER);
142 if (!read.has_value()) {
143 return false;
144 }
145 read_fbo = read.value();
146 }
147
148 DeviceBufferGLES::Cast(*destination)
149 .UpdateBufferData([&gl, this](uint8_t* data, size_t length) {
150 gl.ReadPixels(source_region.origin.x, source_region.origin.y,
151 source_region.size.width, source_region.size.height,
152 GL_RGBA, GL_UNSIGNED_BYTE, data + destination_offset);
153 });
154
155 return true;
156 };

References impeller::BackendCast< DeviceBufferGLES, DeviceBuffer >::Cast(), impeller::ConfigureFBO(), impeller::DeleteFBO(), impeller::BlitCopyTextureToBufferCommand::destination, impeller::BlitCopyTextureToBufferCommand::destination_offset, impeller::ReactorGLES::GetProcTable(), impeller::TSize< T >::height, impeller::kR8G8B8A8UNormInt, impeller::TRect< T >::origin, impeller::TRect< T >::size, impeller::BlitCopyTextureToBufferCommand::source, impeller::BlitCopyTextureToBufferCommand::source_region, impeller::DeviceBufferGLES::UpdateBufferData(), VALIDATION_LOG, impeller::TSize< T >::width, impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

## ◆ GetLabel()

std::string impeller::BlitCopyTextureToBufferCommandGLES::GetLabel | ( |  | ) | const
| override virtual

Implements impeller::BlitEncodeGLES.

Definition at line 123 of file blit_command_gles.cc.

123 {
124 return label;
125 }

References impeller::BlitCommand::label.

The documentation for this struct was generated from the following files:

- impeller/renderer/backend/gles/blit_command_gles.h
- impeller/renderer/backend/gles/blit_command_gles.cc

impeller::TRect::size
TSize< Type > size
Definition: rect.h:24
impeller::TPoint::y
Type y
Definition: point.h:24
impeller::DeleteFBO
static void DeleteFBO(const ProcTableGLES &gl, GLuint fbo, GLenum type)
Definition: blit_command_gles.cc:16
impeller::ConfigureFBO
static std::optional< GLuint > ConfigureFBO(const ProcTableGLES &gl, const std::shared_ptr< Texture > &texture, GLenum fbo_type)
Definition: blit_command_gles.cc:23
impeller::PixelFormat::kR8G8B8A8UNormInt
@ kR8G8B8A8UNormInt
impeller::BlitCommand::label
std::string label
Definition: blit_command.h:14
impeller::BlitCopyTextureToBufferCommand::destination_offset
size_t destination_offset
Definition: blit_command.h:28
impeller::BlitCopyTextureToBufferCommand::destination
std::shared_ptr< DeviceBuffer > destination
Definition: blit_command.h:26
impeller::TRect::origin
TPoint< Type > origin
Definition: rect.h:23
impeller::TSize::width
Type width
Definition: size.h:21
impeller::DeviceBufferGLES::UpdateBufferData
void UpdateBufferData(const std::function< void(uint8_t *, size_t length)> &update_buffer_data)
Definition: device_buffer_gles.cc:113
impeller::TPoint::x
Type x
Definition: point.h:23
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:60
impeller::BackendCast< DeviceBufferGLES, DeviceBuffer >::Cast
static DeviceBufferGLES & Cast(DeviceBuffer &base)
Definition: backend_cast.h:14
impeller::BlitCopyTextureToBufferCommand::source
std::shared_ptr< Texture > source
Definition: blit_command.h:25
impeller::TSize::height
Type height
Definition: size.h:22
impeller::BlitCopyTextureToBufferCommand::source_region
IRect source_region
Definition: blit_command.h:27