| 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 43 of file blit_command_gles.h.

## Constructor & Destructor Documentation

## ◆ ~BlitCopyTextureToBufferCommandGLES()

impeller::BlitCopyTextureToBufferCommandGLES::~BlitCopyTextureToBufferCommandGLES | ( |  | ) |
| overridedefault

## Member Function Documentation

## ◆ Encode()

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

Implements impeller::BlitEncodeGLES.

Definition at line 309 of file blit_command_gles.cc.

310 {
311 if (source->GetTextureDescriptor().format != PixelFormat::kR8G8B8A8UNormInt) {
312 VALIDATION_LOG << "Only textures with pixel format RGBA are supported yet.";
313 return false;
314 }
315
316 const auto& gl = reactor.GetProcTable();
317
318 GLuint read_fbo = GL_NONE;
319 fml::ScopedCleanupClosure delete_fbos(
320 [&gl, &read_fbo]() { DeleteFBO(gl, read_fbo, GL_READ_FRAMEBUFFER); });
321
322 {
323 auto read = ConfigureFBO(gl, source, GL_READ_FRAMEBUFFER);
324 if (!read.has_value()) {
325 return false;
326 }
327 read_fbo = read.value();
328 }
329
330 DeviceBufferGLES::Cast(*destination)
331 .UpdateBufferData([&gl, this](uint8_t* data, size_t length) {
332 gl.ReadPixels(source_region.GetX(), source_region.GetY(),
333 source_region.GetWidth(), source_region.GetHeight(),
334 GL_RGBA, GL_UNSIGNED_BYTE, data + destination_offset);
335 });
336
337 return true;
338 };

References impeller::BackendCast< DeviceBufferGLES, DeviceBuffer >::Cast(), impeller::ConfigureFBO(), data, impeller::DeleteFBO(), impeller::BlitCopyTextureToBufferCommand::destination, impeller::BlitCopyTextureToBufferCommand::destination_offset, impeller::TRect< T >::GetHeight(), impeller::ReactorGLES::GetProcTable(), impeller::TRect< T >::GetWidth(), impeller::TRect< T >::GetX(), impeller::TRect< T >::GetY(), impeller::kR8G8B8A8UNormInt, impeller::BlitCopyTextureToBufferCommand::source, impeller::BlitCopyTextureToBufferCommand::source_region, impeller::DeviceBufferGLES::UpdateBufferData(), and VALIDATION_LOG.

## ◆ GetLabel()

std::string impeller::BlitCopyTextureToBufferCommandGLES::GetLabel | ( |  | ) | const
| overridevirtual

Implements impeller::BlitEncodeGLES.

Definition at line 305 of file blit_command_gles.cc.

305 {
306 return label;
307 }

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::DeleteFBO
static void DeleteFBO(const ProcTableGLES &gl, GLuint fbo, GLenum type)
Definition: blit_command_gles.cc:19
data
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63
impeller::ConfigureFBO
static std::optional< GLuint > ConfigureFBO(const ProcTableGLES &gl, const std::shared_ptr< Texture > &texture, GLenum fbo_type)
Definition: blit_command_gles.cc:26
impeller::PixelFormat::kR8G8B8A8UNormInt
@ kR8G8B8A8UNormInt
impeller::TRect::GetX
constexpr Type GetX() const
Returns the X coordinate of the upper left corner, equivalent to |GetOrigin().x|.
Definition: rect.h:327
impeller::TRect::GetHeight
constexpr Type GetHeight() const
Returns the height of the rectangle, equivalent to |GetSize().height|.
Definition: rect.h:341
impeller::BlitCommand::label
std::string label
Definition: blit_command.h:15
impeller::TRect::GetWidth
constexpr Type GetWidth() const
Returns the width of the rectangle, equivalent to |GetSize().width|.
Definition: rect.h:335
impeller::BlitCopyTextureToBufferCommand::destination_offset
size_t destination_offset
Definition: blit_command.h:34
impeller::BlitCopyTextureToBufferCommand::destination
std::shared_ptr< DeviceBuffer > destination
Definition: blit_command.h:32
impeller::DeviceBufferGLES::UpdateBufferData
void UpdateBufferData(const std::function< void(uint8_t *, size_t length)> &update_buffer_data)
Definition: device_buffer_gles.cc:129
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:91
impeller::BackendCast< DeviceBufferGLES, DeviceBuffer >::Cast
static DeviceBufferGLES & Cast(DeviceBuffer &base)
Definition: backend_cast.h:13
impeller::BlitCopyTextureToBufferCommand::source
std::shared_ptr< Texture > source
Definition: blit_command.h:31
impeller::TRect::GetY
constexpr Type GetY() const
Returns the Y coordinate of the upper left corner, equivalent to |GetOrigin().y|.
Definition: rect.h:331
impeller::BlitCopyTextureToBufferCommand::source_region
IRect source_region
Definition: blit_command.h:33