Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
impeller::BlitResizeTextureCommandGLES Struct Reference

#include <blit_command_gles.h>

Inheritance diagram for impeller::BlitResizeTextureCommandGLES:
impeller::BlitEncodeGLES impeller::BlitResizeTextureCommand impeller::BackendCast< BlitEncodeGLES, BlitCommand > impeller::BlitCommand

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 BlitEncodeGLESCast (BlitCommand &base)
 
static const BlitEncodeGLESCast (const BlitCommand &base)
 
static BlitEncodeGLESCast (BlitCommand *base)
 
static const BlitEncodeGLESCast (const BlitCommand *base)
 
- Public Attributes inherited from impeller::BlitResizeTextureCommand
std::shared_ptr< Texturesource
 
std::shared_ptr< Texturedestination
 
- 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 ( )
overridedefault

Member Function Documentation

◆ Encode()

bool impeller::BlitResizeTextureCommandGLES::Encode ( const ReactorGLES reactor) const
overridevirtual

Implements impeller::BlitEncodeGLES.

Definition at line 355 of file blit_command_gles.cc.

355 {
356 const auto& gl = reactor.GetProcTable();
357
358 // glBlitFramebuffer is a GLES3 proc. Since we target GLES2, we need to
359 // emulate the blit when it's not available in the driver.
360 if (!gl.BlitFramebuffer.IsAvailable()) {
361 // TODO(157064): Emulate the blit using a raster draw call here.
362 VALIDATION_LOG << "Texture blit fallback not implemented yet for GLES2.";
363 return false;
364 }
365
366 destination->SetCoordinateSystem(source->GetCoordinateSystem());
367
368 GLuint read_fbo = GL_NONE;
369 GLuint draw_fbo = GL_NONE;
370 fml::ScopedCleanupClosure delete_fbos([&gl, &read_fbo, &draw_fbo]() {
371 DeleteFBO(gl, read_fbo, GL_READ_FRAMEBUFFER);
372 DeleteFBO(gl, draw_fbo, GL_DRAW_FRAMEBUFFER);
373 });
374
375 {
376 auto read = ConfigureFBO(gl, source, GL_READ_FRAMEBUFFER);
377 if (!read.has_value()) {
378 return false;
379 }
380 read_fbo = read.value();
381 }
382
383 {
384 auto draw = ConfigureFBO(gl, destination, GL_DRAW_FRAMEBUFFER);
385 if (!draw.has_value()) {
386 return false;
387 }
388 draw_fbo = draw.value();
389 }
390
391 gl.Disable(GL_SCISSOR_TEST);
392 gl.Disable(GL_DEPTH_TEST);
393 gl.Disable(GL_STENCIL_TEST);
394
395 const IRect source_region = IRect::MakeSize(source->GetSize());
396 const IRect destination_region = IRect::MakeSize(destination->GetSize());
397
398 gl.BlitFramebuffer(source_region.GetX(), // srcX0
399 source_region.GetY(), // srcY0
400 source_region.GetWidth(), // srcX1
401 source_region.GetHeight(), // srcY1
402 destination_region.GetX(), // dstX0
403 destination_region.GetY(), // dstY0
404 destination_region.GetWidth(), // dstX1
405 destination_region.GetHeight(), // dstY1
406 GL_COLOR_BUFFER_BIT, // mask
407 GL_LINEAR // filter
408 );
409
410 return true;
411}
Wraps a closure that is invoked in the destructor unless released by the caller.
Definition closure.h:32
static std::optional< GLuint > ConfigureFBO(const ProcTableGLES &gl, const std::shared_ptr< Texture > &texture, GLenum fbo_type)
IRect64 IRect
Definition rect.h:825
static void DeleteFBO(const ProcTableGLES &gl, GLuint fbo, GLenum type)
std::shared_ptr< Texture > destination
std::shared_ptr< Texture > source
static constexpr TRect MakeSize(const TSize< U > &size)
Definition rect.h:150
#define VALIDATION_LOG
Definition validation.h:91

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
overridevirtual

Implements impeller::BlitEncodeGLES.

Definition at line 351 of file blit_command_gles.cc.

351 {
352 return "Resize Texture";
353}

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