| Flutter Impeller |

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

`#include <blit_command_gles.h>`

Inheritance diagram for impeller::BlitResizeTextureCommandGLES:

## Public Member Functions
| ~BlitResizeTextureCommandGLES () 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::BlitResizeTextureCommand
std::shared_ptr< Texture > | source
std::shared_ptr< Texture > | destination
Public Attributes inherited from impeller::BlitCommand
std::string | label

## Detailed Description

Definition at line 62 of file blit_command_gles.h.

## Constructor & Destructor Documentation

## ◆ ~BlitResizeTextureCommandGLES()

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

## Member Function Documentation

## ◆ Encode()

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

Implements impeller::BlitEncodeGLES.

Definition at line 364 of file blit_command_gles.cc.

364 {
365 const auto& gl = reactor.GetProcTable();
366
367 // glBlitFramebuffer is a GLES3 proc. Since we target GLES2, we need to
368 // emulate the blit when it's not available in the driver.
369 if (!gl.BlitFramebuffer.IsAvailable()) {
370 // TODO(135818): Emulate the blit using a raster draw call here.
371 VALIDATION_LOG << "Texture blit fallback not implemented yet for GLES2.";
372 return false;
373 }
374
375 GLuint read_fbo = GL_NONE;
376 GLuint draw_fbo = GL_NONE;
377 fml::ScopedCleanupClosure delete_fbos([&gl, &read_fbo, &draw_fbo]() {
378 DeleteFBO(gl, read_fbo, GL_READ_FRAMEBUFFER);
379 DeleteFBO(gl, draw_fbo, GL_DRAW_FRAMEBUFFER);
380 });
381
382 {
383 auto read = ConfigureFBO(gl, source, GL_READ_FRAMEBUFFER);
384 if (!read.has_value()) {
385 return false;
386 }
387 read_fbo = read.value();
388 }
389
390 {
391 auto draw = ConfigureFBO(gl, destination, GL_DRAW_FRAMEBUFFER);
392 if (!draw.has_value()) {
393 return false;
394 }
395 draw_fbo = draw.value();
396 }
397
398 gl.Disable(GL_SCISSOR_TEST);
399 gl.Disable(GL_DEPTH_TEST);
400 gl.Disable(GL_STENCIL_TEST);
401
402 const IRect source_region = IRect::MakeSize(source->GetSize());
403 const IRect destination_region = IRect::MakeSize(destination->GetSize());
404
405 gl.BlitFramebuffer(source_region.GetX(), // srcX0
406 source_region.GetY(), // srcY0
407 source_region.GetWidth(), // srcX1
408 source_region.GetHeight(), // srcY1
409 destination_region.GetX(), // dstX0
410 destination_region.GetY(), // dstY0
411 destination_region.GetWidth(), // dstX1
412 destination_region.GetHeight(), // dstY1
413 GL_COLOR_BUFFER_BIT, // mask
414 GL_LINEAR // filter
415 );
416
417 return true;
418 }

References impeller::ConfigureFBO(), impeller::DeleteFBO(), impeller::BlitResizeTextureCommand::destination, impeller::TRect< T >::GetHeight(), impeller::ReactorGLES::GetProcTable(), impeller::TRect< T >::GetWidth(), impeller::TRect< T >::GetX(), impeller::TRect< T >::GetY(), impeller::TRect< T >::MakeSize(), impeller::BlitResizeTextureCommand::source, and VALIDATION_LOG.

## ◆ GetLabel()

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

Implements impeller::BlitEncodeGLES.

Definition at line 360 of file blit_command_gles.cc.

360 {
361 return "Resize Texture";
362 }

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::BlitResizeTextureCommand::destination
std::shared_ptr< Texture > destination
Definition: blit_command.h:27
impeller::DeleteFBO
static void DeleteFBO(const ProcTableGLES &gl, GLuint fbo, GLenum type)
Definition: blit_command_gles.cc:19
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::BlitResizeTextureCommand::source
std::shared_ptr< Texture > source
Definition: blit_command.h:26
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:91
impeller::TRect::MakeSize
constexpr static TRect MakeSize(const TSize< U > &size)
Definition: rect.h:150
impeller::IRect
IRect64 IRect
Definition: rect.h:779