7#include "flutter/fml/closure.h"
18 gl.BindFramebuffer(
type, GL_NONE);
19 gl.DeleteFramebuffers(1u, &fbo);
25 const std::shared_ptr<Texture>&
texture,
28 if (!handle.has_value()) {
35 gl.BindFramebuffer(fbo_type, 0);
40 gl.GenFramebuffers(1u, &fbo);
41 gl.BindFramebuffer(fbo_type, fbo);
50 if (gl.CheckFramebufferStatus(fbo_type) != GL_FRAMEBUFFER_COMPLETE) {
72 if (!gl.BlitFramebuffer.IsAvailable()) {
74 FML_LOG(
ERROR) <<
"Texture blit fallback not implemented yet for GLES2.";
78 GLuint read_fbo = GL_NONE;
79 GLuint draw_fbo = GL_NONE;
81 DeleteFBO(gl, read_fbo, GL_READ_FRAMEBUFFER);
82 DeleteFBO(gl, draw_fbo, GL_DRAW_FRAMEBUFFER);
87 if (!
read.has_value()) {
90 read_fbo =
read.value();
95 if (!
draw.has_value()) {
98 draw_fbo =
draw.value();
101 gl.Disable(GL_SCISSOR_TEST);
102 gl.Disable(GL_DEPTH_TEST);
103 gl.Disable(GL_STENCIL_TEST);
130 VALIDATION_LOG <<
"Only textures with pixel format RGBA are supported yet.";
136 GLuint read_fbo = GL_NONE;
138 [&gl, &read_fbo]() {
DeleteFBO(gl, read_fbo, GL_READ_FRAMEBUFFER); });
142 if (!
read.has_value()) {
145 read_fbo =
read.value();
166 if (!texture_gles->GenerateMipmap()) {
static bool read(SkStream *stream, void *buffer, size_t amount)
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Wraps a closure that is invoked in the destructor unless released by the caller.
static TextureGLES & Cast(Texture &base)
void UpdateBufferData(const std::function< void(uint8_t *, size_t length)> &update_buffer_data)
The reactor attempts to make thread-safe usage of OpenGL ES easier to reason about.
const ProcTableGLES & GetProcTable() const
Get the OpenGL proc. table the reactor uses to manage handles.
bool SetAsFramebufferAttachment(GLenum target, AttachmentType attachment_type) const
std::optional< GLuint > GetGLHandle() const
#define FML_LOG(severity)
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)
~BlitCopyTextureToBufferCommandGLES() override
bool Encode(const ReactorGLES &reactor) const override
std::string GetLabel() const override
std::shared_ptr< DeviceBuffer > destination
std::shared_ptr< Texture > source
size_t destination_offset
bool Encode(const ReactorGLES &reactor) const override
std::string GetLabel() const override
~BlitCopyTextureToTextureCommandGLES() override
IPoint destination_origin
std::shared_ptr< Texture > destination
std::shared_ptr< Texture > source
virtual ~BlitEncodeGLES()
~BlitGenerateMipmapCommandGLES() override
bool Encode(const ReactorGLES &reactor) const override
std::string GetLabel() const override
std::shared_ptr< Texture > texture
constexpr Type GetY() const
Returns the Y coordinate of the upper left corner, equivalent to |GetOrigin().y|.
constexpr Type GetHeight() const
Returns the height of the rectangle, equivalent to |GetSize().height|.
constexpr Type GetX() const
Returns the X coordinate of the upper left corner, equivalent to |GetOrigin().x|.
constexpr Type GetWidth() const
Returns the width of the rectangle, equivalent to |GetSize().width|.