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

## Constructor & Destructor Documentation

## ◆ ~BlitCopyTextureToTextureCommandGLES()

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

## Member Function Documentation

## ◆ Encode()

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

Implements impeller::BlitEncodeGLES.

Definition at line 66 of file blit_command_gles.cc.

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

References impeller::ConfigureFBO(), impeller::DeleteFBO(), impeller::BlitCopyTextureToTextureCommand::destination, impeller::BlitCopyTextureToTextureCommand::destination_origin, impeller::ReactorGLES::GetProcTable(), impeller::TSize< T >::height, impeller::TRect< T >::origin, impeller::TRect< T >::size, impeller::BlitCopyTextureToTextureCommand::source, impeller::BlitCopyTextureToTextureCommand::source_region, impeller::TSize< T >::width, impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

## ◆ GetLabel()

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

Implements impeller::BlitEncodeGLES.

Definition at line 62 of file blit_command_gles.cc.

62 {
63 return label;
64 }

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::BlitCopyTextureToTextureCommand::destination
std::shared_ptr< Texture > destination
Definition: blit_command.h:19
impeller::BlitCopyTextureToTextureCommand::destination_origin
IPoint destination_origin
Definition: blit_command.h:21
impeller::BlitCommand::label
std::string label
Definition: blit_command.h:14
impeller::TRect::origin
TPoint< Type > origin
Definition: rect.h:23
impeller::BlitCopyTextureToTextureCommand::source
std::shared_ptr< Texture > source
Definition: blit_command.h:18
impeller::TSize::width
Type width
Definition: size.h:21
impeller::TPoint::x
Type x
Definition: point.h:23
impeller::BlitCopyTextureToTextureCommand::source_region
IRect source_region
Definition: blit_command.h:20
impeller::TSize::height
Type height
Definition: size.h:22