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,
80 bool threadsafe =
false);
90 [[nodiscard]]
bool Bind()
const;
111 std::optional<GLuint>
GetFBO()
const;
157 std::shared_ptr<ReactorGLES> reactor_;
160 mutable std::optional<HandleGLES> fence_ = std::nullopt;
161 mutable std::bitset<6> slices_initialized_ = 0;
162 const bool is_wrapped_;
163 const std::optional<GLuint> wrapped_fbo_;
165 bool is_valid_ =
false;
170 std::optional<GLuint> fbo,
171 std::optional<HandleGLES> external_handle);
174 void SetLabel(std::string_view label)
override;
177 void SetLabel(std::string_view label, std::string_view trailing)
override;
180 bool OnSetContents(
const uint8_t* contents,
182 size_t slice)
override;
185 bool OnSetContents(std::shared_ptr<const fml::Mapping> mapping,
186 size_t slice)
override;
189 ISize GetSize()
const override;
192 Scalar GetYCoordScale()
const override;
194 void InitializeContentsIfNecessary()
const;
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....
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...