| Flutter Impeller |

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

`#include <blit_command_gles.h>`

Inheritance diagram for impeller::BlitCopyTextureToTextureCommandGLES:

## Public Member Functions
| ~BlitCopyTextureToTextureCommandGLES () 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::BlitCopyTextureToTextureCommand
std::shared_ptr< Texture > | source
std::shared_ptr< Texture > | destination
IRect | source_region
IPoint | destination_origin
Public Attributes inherited from impeller::BlitCommand
std::string | label

## Detailed Description

Definition at line 33 of file blit_command_gles.h.

## Constructor & Destructor Documentation

## ◆ ~BlitCopyTextureToTextureCommandGLES()

impeller::BlitCopyTextureToTextureCommandGLES::~BlitCopyTextureToTextureCommandGLES | ( |  | ) |
| overridedefault

## Member Function Documentation

## ◆ Encode()

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

Implements impeller::BlitEncodeGLES.

Definition at line 69 of file blit_command_gles.cc.

70 {
71 const auto& gl = reactor.GetProcTable();
72
73 // glBlitFramebuffer is a GLES3 proc. Since we target GLES2, we need to
74 // emulate the blit when it's not available in the driver.
75 if (!gl.BlitFramebuffer.IsAvailable()) {
76 // TODO(135818): Emulate the blit using a raster draw call here.
77 VALIDATION_LOG << "Texture blit fallback not implemented yet for GLES2.";
78 return false;
79 }
80
81 GLuint read_fbo = GL_NONE;
82 GLuint draw_fbo = GL_NONE;
83 fml::ScopedCleanupClosure delete_fbos([&gl, &read_fbo, &draw_fbo]() {
84 DeleteFBO(gl, read_fbo, GL_READ_FRAMEBUFFER);
85 DeleteFBO(gl, draw_fbo, GL_DRAW_FRAMEBUFFER);
86 });
87
88 {
89 auto read = ConfigureFBO(gl, source, GL_READ_FRAMEBUFFER);
90 if (!read.has_value()) {
91 return false;
92 }
93 read_fbo = read.value();
94 }
95
96 {
97 auto draw = ConfigureFBO(gl, destination, GL_DRAW_FRAMEBUFFER);
98 if (!draw.has_value()) {
99 return false;
100 }
101 draw_fbo = draw.value();
102 }
103
104 gl.Disable(GL_SCISSOR_TEST);
105 gl.Disable(GL_DEPTH_TEST);
106 gl.Disable(GL_STENCIL_TEST);
107
108 gl.BlitFramebuffer(source_region.GetX(), // srcX0
109 source_region.GetY(), // srcY0
110 source_region.GetWidth(), // srcX1
111 source_region.GetHeight(), // srcY1
112 destination_origin.x, // dstX0
113 destination_origin.y, // dstY0
114 source_region.GetWidth(), // dstX1
115 source_region.GetHeight(), // dstY1
116 GL_COLOR_BUFFER_BIT, // mask
117 GL_NEAREST // filter
118 );
119
120 return true;
121 };

References impeller::ConfigureFBO(), impeller::DeleteFBO(), impeller::BlitCopyTextureToTextureCommand::destination, impeller::BlitCopyTextureToTextureCommand::destination_origin, impeller::TRect< T >::GetHeight(), impeller::ReactorGLES::GetProcTable(), impeller::TRect< T >::GetWidth(), impeller::TRect< T >::GetX(), impeller::TRect< T >::GetY(), impeller::BlitCopyTextureToTextureCommand::source, impeller::BlitCopyTextureToTextureCommand::source_region, VALIDATION_LOG, impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

## ◆ GetLabel()

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

Implements impeller::BlitEncodeGLES.

Definition at line 65 of file blit_command_gles.cc.

65 {
66 return label;
67 }

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::TPoint::y
Type y
Definition: point.h:31
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::BlitCopyTextureToTextureCommand::destination
std::shared_ptr< Texture > destination
Definition: blit_command.h:20
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::BlitCopyTextureToTextureCommand::destination_origin
IPoint destination_origin
Definition: blit_command.h:22
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::BlitCopyTextureToTextureCommand::source
std::shared_ptr< Texture > source
Definition: blit_command.h:19
impeller::TPoint::x
Type x
Definition: point.h:30
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:91
impeller::BlitCopyTextureToTextureCommand::source_region
IRect source_region
Definition: blit_command.h:21
impeller::TRect::GetY
constexpr Type GetY() const
Returns the Y coordinate of the upper left corner, equivalent to |GetOrigin().y|.
Definition: rect.h:331