5 #ifndef FLUTTER_IMPELLER_RENDERER_BACKEND_GLES_TEXTURE_GLES_H_
6 #define FLUTTER_IMPELLER_RENDERER_BACKEND_GLES_TEXTURE_GLES_H_
10 #include "fml/logging.h"
42 static std::shared_ptr<TextureGLES>
WrapFBO(
43 std::shared_ptr<ReactorGLES> reactor,
60 std::shared_ptr<ReactorGLES> reactor,
75 std::shared_ptr<ReactorGLES> reactor,
88 [[nodiscard]]
bool Bind()
const;
109 std::optional<GLuint>
GetFBO()
const;
155 std::shared_ptr<ReactorGLES> reactor_;
158 mutable std::optional<HandleGLES> fence_ = std::nullopt;
159 mutable std::bitset<6> slices_initialized_ = 0;
160 const bool is_wrapped_;
161 const std::optional<GLuint> wrapped_fbo_;
163 bool is_valid_ =
false;
167 std::optional<GLuint> fbo,
168 std::optional<HandleGLES> external_handle);
171 void SetLabel(std::string_view label)
override;
174 void SetLabel(std::string_view label, std::string_view trailing)
override;
177 bool OnSetContents(
const uint8_t* contents,
179 size_t slice)
override;
182 bool OnSetContents(std::shared_ptr<const fml::Mapping> mapping,
183 size_t slice)
override;
186 ISize GetSize()
const override;
189 Scalar GetYCoordScale()
const override;
191 void InitializeContentsIfNecessary()
const;
Represents a handle to an underlying OpenGL object. Unlike OpenGL object handles, these handles can b...
static HandleGLES DeadHandle()
Creates a dead handle.
static std::shared_ptr< TextureGLES > WrapFBO(std::shared_ptr< ReactorGLES > reactor, TextureDescriptor desc, GLuint fbo)
Create a texture by wrapping an external framebuffer object whose lifecycle is owned by the caller.
void MarkContentsInitialized()
Indicates that all texture storage has already been allocated and contents initialized.
const HandleGLES & GetCachedFBO() const
Retrieve the cached FBO object, or a dead handle if there is no object.
std::optional< HandleGLES > GetSyncFence() const
bool IsSliceInitialized(size_t slice) const
@ kRenderBufferMultisampled
bool IsValid() const override
void SetFence(HandleGLES fence)
Attach a sync fence to this texture that will be waited on before encoding a rendering operation that...
void Leak()
Reset the internal texture state so that the reactor will not free the associated handle.
void SetCachedFBO(HandleGLES fbo)
bool SetAsFramebufferAttachment(GLenum target, AttachmentType attachment_type) const
static std::shared_ptr< TextureGLES > CreatePlaceholder(std::shared_ptr< ReactorGLES > reactor, TextureDescriptor desc)
Create a "texture" that is never expected to be bound/unbound explicitly or initialized in any way....
TextureGLES(std::shared_ptr< ReactorGLES > reactor, TextureDescriptor desc)
std::optional< GLuint > GetFBO() const
Type ComputeTypeForBinding(GLenum target) const
void MarkSliceInitialized(size_t slice) const
Indicates that a specific texture slice has been initialized.
std::optional< GLuint > GetGLHandle() const
static std::shared_ptr< TextureGLES > WrapTexture(std::shared_ptr< ReactorGLES > reactor, TextureDescriptor desc, HandleGLES external_handle)
Create a texture by wrapping an external OpenGL texture handle. Ownership of the texture handle is as...
A lightweight object that describes the attributes of a texture that can then used an allocator to cr...