Flutter Impeller
impeller::BlitCopyTextureToTextureCommandGLES Struct Reference

#include <blit_command_gles.h>

Inheritance diagram for impeller::BlitCopyTextureToTextureCommandGLES:
impeller::BlitEncodeGLES impeller::BlitCopyTextureToTextureCommand impeller::BackendCast< BlitEncodeGLES, BlitCommand > impeller::BlitCommand

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 74 of file blit_command_gles.cc.

75  {
76  const auto& gl = reactor.GetProcTable();
77 
78  // glBlitFramebuffer is a GLES3 proc. Since we target GLES2, we need to
79  // emulate the blit when it's not available in the driver.
80  if (!gl.BlitFramebuffer.IsAvailable()) {
81  // TODO(157064): Emulate the blit using a raster draw call here.
82  VALIDATION_LOG << "Texture blit fallback not implemented yet for GLES2.";
83  return false;
84  }
85 
86  GLuint read_fbo = GL_NONE;
87  GLuint draw_fbo = GL_NONE;
88  fml::ScopedCleanupClosure delete_fbos([&gl, &read_fbo, &draw_fbo]() {
89  DeleteFBO(gl, read_fbo, GL_READ_FRAMEBUFFER);
90  DeleteFBO(gl, draw_fbo, GL_DRAW_FRAMEBUFFER);
91  });
92 
93  {
94  auto read = ConfigureFBO(gl, source, GL_READ_FRAMEBUFFER);
95  if (!read.has_value()) {
96  return false;
97  }
98  read_fbo = read.value();
99  }
100 
101  {
102  auto draw = ConfigureFBO(gl, destination, GL_DRAW_FRAMEBUFFER);
103  if (!draw.has_value()) {
104  return false;
105  }
106  draw_fbo = draw.value();
107  }
108 
109  gl.Disable(GL_SCISSOR_TEST);
110  gl.Disable(GL_DEPTH_TEST);
111  gl.Disable(GL_STENCIL_TEST);
112 
113  const auto destination_right =
115  const auto destination_bottom =
117 
118  gl.BlitFramebuffer(source_region.GetX(), // srcX0
119  source_region.GetY(), // srcY0
120  source_region.GetRight(), // srcX1
121  source_region.GetBottom(), // srcY1
122  destination_origin.x, // dstX0
123  destination_origin.y, // dstY0
124  destination_right, // dstX1
125  destination_bottom, // dstY1
126  GL_COLOR_BUFFER_BIT, // mask
127  GL_NEAREST // filter
128  );
129 
130  return true;
131 };
static std::optional< GLuint > ConfigureFBO(const ProcTableGLES &gl, const std::shared_ptr< Texture > &texture, GLenum fbo_type)
static void DeleteFBO(const ProcTableGLES &gl, GLuint fbo, GLenum type)
std::shared_ptr< ReactorGLES > reactor
std::shared_ptr< Texture > destination
Definition: blit_command.h:21
std::shared_ptr< Texture > source
Definition: blit_command.h:20
constexpr auto GetBottom() const
Definition: rect.h:391
constexpr Type GetY() const
Returns the Y coordinate of the upper left corner, equivalent to |GetOrigin().y|.
Definition: rect.h:371
constexpr Type GetHeight() const
Returns the height of the rectangle, equivalent to |GetSize().height|.
Definition: rect.h:381
constexpr Type GetX() const
Returns the X coordinate of the upper left corner, equivalent to |GetOrigin().x|.
Definition: rect.h:367
constexpr auto GetRight() const
Definition: rect.h:389
constexpr Type GetWidth() const
Returns the width of the rectangle, equivalent to |GetSize().width|.
Definition: rect.h:375
#define VALIDATION_LOG
Definition: validation.h:91

References impeller::ConfigureFBO(), impeller::DeleteFBO(), impeller::BlitCopyTextureToTextureCommand::destination, impeller::BlitCopyTextureToTextureCommand::destination_origin, impeller::TRect< T >::GetBottom(), impeller::TRect< T >::GetHeight(), impeller::TRect< T >::GetRight(), impeller::TRect< T >::GetWidth(), impeller::TRect< T >::GetX(), impeller::TRect< T >::GetY(), reactor, 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 70 of file blit_command_gles.cc.

70  {
71  return label;
72 }

References impeller::BlitCommand::label.


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