Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
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 ()
 
virtual std::string GetLabel () const =0
 
virtual bool Encode (const ReactorGLES &reactor) const =0
 

Additional Inherited Members

- Static Public Member Functions inherited from impeller::BackendCast< BlitEncodeGLES, BlitCommand >
static BlitEncodeGLESCast (BlitCommand &base)
 
static const BlitEncodeGLESCast (const BlitCommand &base)
 
static BlitEncodeGLESCast (BlitCommand *base)
 
static const BlitEncodeGLESCast (const BlitCommand *base)
 
- Public Attributes inherited from impeller::BlitCopyTextureToTextureCommand
std::shared_ptr< Texturesource
 
std::shared_ptr< Texturedestination
 
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 68 of file blit_command_gles.cc.

69 {
70 const auto& gl = reactor.GetProcTable();
71
72 // glBlitFramebuffer is a GLES3 proc. Since we target GLES2, we need to
73 // emulate the blit when it's not available in the driver.
74 if (!gl.BlitFramebuffer.IsAvailable()) {
75 // TODO(bdero): Emulate the blit using a raster draw call here.
76 FML_LOG(ERROR) << "Texture blit fallback not implemented yet for GLES2.";
77 return false;
78 }
79
80 GLuint read_fbo = GL_NONE;
81 GLuint draw_fbo = GL_NONE;
82 fml::ScopedCleanupClosure delete_fbos([&gl, &read_fbo, &draw_fbo]() {
83 DeleteFBO(gl, read_fbo, GL_READ_FRAMEBUFFER);
84 DeleteFBO(gl, draw_fbo, GL_DRAW_FRAMEBUFFER);
85 });
86
87 {
88 auto read = ConfigureFBO(gl, source, GL_READ_FRAMEBUFFER);
89 if (!read.has_value()) {
90 return false;
91 }
92 read_fbo = read.value();
93 }
94
95 {
96 auto draw = ConfigureFBO(gl, destination, GL_DRAW_FRAMEBUFFER);
97 if (!draw.has_value()) {
98 return false;
99 }
100 draw_fbo = draw.value();
101 }
102
103 gl.Disable(GL_SCISSOR_TEST);
104 gl.Disable(GL_DEPTH_TEST);
105 gl.Disable(GL_STENCIL_TEST);
106
107 gl.BlitFramebuffer(source_region.GetX(), // srcX0
108 source_region.GetY(), // srcY0
109 source_region.GetWidth(), // srcX1
110 source_region.GetHeight(), // srcY1
111 destination_origin.x, // dstX0
112 destination_origin.y, // dstY0
113 source_region.GetWidth(), // dstX1
114 source_region.GetHeight(), // dstY1
115 GL_COLOR_BUFFER_BIT, // mask
116 GL_NEAREST // filter
117 );
118
119 return true;
120};
static bool read(SkStream *stream, void *buffer, size_t amount)
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
Wraps a closure that is invoked in the destructor unless released by the caller.
Definition: closure.h:32
#define FML_LOG(severity)
Definition: logging.h:82
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)
gl
Definition: malisc.py:41
std::shared_ptr< Texture > destination
Definition: blit_command.h:20
std::shared_ptr< Texture > source
Definition: blit_command.h:19
constexpr Type GetY() const
Returns the Y coordinate of the upper left corner, equivalent to |GetOrigin().y|.
Definition: rect.h:327
constexpr Type GetHeight() const
Returns the height of the rectangle, equivalent to |GetSize().height|.
Definition: rect.h:337
constexpr Type GetX() const
Returns the X coordinate of the upper left corner, equivalent to |GetOrigin().x|.
Definition: rect.h:323
constexpr Type GetWidth() const
Returns the width of the rectangle, equivalent to |GetSize().width|.
Definition: rect.h:331
#define ERROR(message)
Definition: elf_loader.cc:260

◆ GetLabel()

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

Implements impeller::BlitEncodeGLES.

Definition at line 64 of file blit_command_gles.cc.

64 {
65 return label;
66}

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