#include <texture_gles.h>
Public Types | |
enum class | Type { kTexture , kTextureMultisampled , kRenderBuffer , kRenderBufferMultisampled } |
enum class | AttachmentType { kColor0 , kDepth , kStencil } |
Public Member Functions | |
TextureGLES (std::shared_ptr< ReactorGLES > reactor, TextureDescriptor desc) | |
~TextureGLES () override | |
bool | IsValid () const override |
std::optional< GLuint > | GetGLHandle () const |
bool | Bind () const |
bool | GenerateMipmap () |
bool | SetAsFramebufferAttachment (GLenum target, AttachmentType attachment_type) const |
Type | GetType () const |
bool | IsWrapped () const |
void | Leak () |
Reset the internal texture state so that the reactor will not free the associated handle. More... | |
std::optional< GLuint > | GetFBO () const |
void | MarkContentsInitialized () |
Indicates that all texture storage has already been allocated and contents initialized. More... | |
void | MarkSliceInitialized (size_t slice) const |
Indicates that a specific texture slice has been initialized. More... | |
bool | IsSliceInitialized (size_t slice) const |
void | SetFence (HandleGLES fence) |
Attach a sync fence to this texture that will be waited on before encoding a rendering operation that references it. More... | |
void | SetCachedFBO (HandleGLES fbo) |
const HandleGLES & | GetCachedFBO () const |
Retrieve the cached FBO object, or a dead handle if there is no object. More... | |
std::optional< HandleGLES > | GetSyncFence () const |
Type | ComputeTypeForBinding (GLenum target) const |
![]() | |
virtual | ~Texture () |
bool | SetContents (const uint8_t *contents, size_t length, size_t slice=0, bool is_opaque=false) |
bool | SetContents (std::shared_ptr< const fml::Mapping > mapping, size_t slice=0, bool is_opaque=false) |
bool | IsOpaque () const |
size_t | GetMipCount () const |
const TextureDescriptor & | GetTextureDescriptor () const |
void | SetCoordinateSystem (TextureCoordinateSystem coordinate_system) |
TextureCoordinateSystem | GetCoordinateSystem () const |
bool | NeedsMipmapGeneration () const |
Static Public Member Functions | |
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. More... | |
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 assumed by the reactor. More... | |
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. It only exists to setup a render pass description. More... | |
![]() | |
static TextureGLES & | Cast (Texture &base) |
static const TextureGLES & | Cast (const Texture &base) |
static TextureGLES * | Cast (Texture *base) |
static const TextureGLES * | Cast (const Texture *base) |
Additional Inherited Members | |
![]() | |
Texture (TextureDescriptor desc) | |
![]() | |
bool | mipmap_generated_ = false |
Definition at line 18 of file texture_gles.h.
|
strong |
Enumerator | |
---|---|
kColor0 | |
kDepth | |
kStencil |
Definition at line 92 of file texture_gles.h.
|
strong |
Enumerator | |
---|---|
kTexture | |
kTextureMultisampled | |
kRenderBuffer | |
kRenderBufferMultisampled |
Definition at line 21 of file texture_gles.h.
impeller::TextureGLES::TextureGLES | ( | std::shared_ptr< ReactorGLES > | reactor, |
TextureDescriptor | desc | ||
) |
Definition at line 185 of file texture_gles.cc.
Referenced by WrapFBO(), and WrapTexture().
|
override |
Definition at line 226 of file texture_gles.cc.
References impeller::HandleGLES::IsDead().
bool impeller::TextureGLES::Bind | ( | ) | const |
Definition at line 511 of file texture_gles.cc.
References GetGLHandle(), impeller::Texture::GetTextureDescriptor(), kRenderBuffer, kRenderBufferMultisampled, kTexture, kTextureMultisampled, impeller::ToTextureTarget(), type, and VALIDATION_LOG.
Referenced by GenerateMipmap().
TextureGLES::Type impeller::TextureGLES::ComputeTypeForBinding | ( | GLenum | target | ) | const |
Definition at line 405 of file texture_gles.cc.
References kTexture, and kTextureMultisampled.
Referenced by SetAsFramebufferAttachment().
|
static |
Create a "texture" that is never expected to be bound/unbound explicitly or initialized in any way. It only exists to setup a render pass description.
[in] | reactor | The reactor |
[in] | desc | The description |
Definition at line 179 of file texture_gles.cc.
References WrapFBO().
Referenced by impeller::SurfaceGLES::WrapFBO().
bool impeller::TextureGLES::GenerateMipmap | ( | ) |
Definition at line 560 of file texture_gles.cc.
References Bind(), GetGLHandle(), impeller::Texture::GetTextureDescriptor(), IsValid(), impeller::kTexture2D, impeller::kTexture2DMultisample, impeller::kTextureCube, impeller::kTextureExternalOES, impeller::Texture::mipmap_generated_, impeller::ToTextureType(), impeller::TextureDescriptor::type, type, and VALIDATION_LOG.
const HandleGLES & impeller::TextureGLES::GetCachedFBO | ( | ) | const |
Retrieve the cached FBO object, or a dead handle if there is no object.
Definition at line 688 of file texture_gles.cc.
Referenced by impeller::EncodeCommandsInReactor().
std::optional< GLuint > impeller::TextureGLES::GetFBO | ( | ) | const |
Definition at line 670 of file texture_gles.cc.
Referenced by impeller::EncodeCommandsInReactor().
std::optional< GLuint > impeller::TextureGLES::GetGLHandle | ( | ) | const |
Definition at line 504 of file texture_gles.cc.
References IsValid().
Referenced by Bind(), impeller::ConfigureFBO(), impeller::BlitCopyBufferToTextureCommandGLES::Encode(), GenerateMipmap(), impeller::interop::ImpellerTextureGetOpenGLHandle(), and SetAsFramebufferAttachment().
std::optional< HandleGLES > impeller::TextureGLES::GetSyncFence | ( | ) | const |
Definition at line 680 of file texture_gles.cc.
TextureGLES::Type impeller::TextureGLES::GetType | ( | ) | const |
Definition at line 594 of file texture_gles.cc.
Referenced by impeller::BlitCopyBufferToTextureCommandGLES::Encode().
bool impeller::TextureGLES::IsSliceInitialized | ( | size_t | slice | ) | const |
Definition at line 556 of file texture_gles.cc.
Referenced by impeller::BlitCopyBufferToTextureCommandGLES::Encode().
|
overridevirtual |
Implements impeller::Texture.
Definition at line 238 of file texture_gles.cc.
Referenced by GenerateMipmap(), GetGLHandle(), and SetAsFramebufferAttachment().
bool impeller::TextureGLES::IsWrapped | ( | ) | const |
Definition at line 666 of file texture_gles.cc.
Referenced by impeller::ConfigureFBO(), impeller::BlitCopyBufferToTextureCommandGLES::Encode(), and impeller::EncodeCommandsInReactor().
void impeller::TextureGLES::Leak | ( | ) |
Reset the internal texture state so that the reactor will not free the associated handle.
Definition at line 233 of file texture_gles.cc.
References impeller::HandleGLES::DeadHandle().
void impeller::TextureGLES::MarkContentsInitialized | ( | ) |
Indicates that all texture storage has already been allocated and contents initialized.
This is similar to calling MarkSliceInitialized
with all slices.
Definition at line 546 of file texture_gles.cc.
void impeller::TextureGLES::MarkSliceInitialized | ( | size_t | slice | ) | const |
Indicates that a specific texture slice has been initialized.
[in] | slice | The slice to mark as being initialized. |
Definition at line 552 of file texture_gles.cc.
Referenced by impeller::BlitCopyBufferToTextureCommandGLES::Encode().
bool impeller::TextureGLES::SetAsFramebufferAttachment | ( | GLenum | target, |
AttachmentType | attachment_type | ||
) | const |
Definition at line 609 of file texture_gles.cc.
References ComputeTypeForBinding(), GetGLHandle(), IsValid(), kRenderBuffer, kRenderBufferMultisampled, kTexture, kTextureMultisampled, and impeller::ToAttachmentType().
Referenced by impeller::ConfigureFBO(), and impeller::EncodeCommandsInReactor().
void impeller::TextureGLES::SetCachedFBO | ( | HandleGLES | fbo | ) |
Store the FBO object for recycling in the 2D renderer.
The color0 texture used by the 2D renderer will use this texture object to store the associated FBO the first time it is used.
Definition at line 684 of file texture_gles.cc.
Referenced by impeller::EncodeCommandsInReactor().
void impeller::TextureGLES::SetFence | ( | HandleGLES | fence | ) |
Attach a sync fence to this texture that will be waited on before encoding a rendering operation that references it.
[in] | fence | A handle to a sync fence. |
Definition at line 674 of file texture_gles.cc.
|
static |
Create a texture by wrapping an external framebuffer object whose lifecycle is owned by the caller.
This is useful for creating a render target for the default window managed framebuffer.
[in] | reactor | The reactor |
[in] | desc | The description |
[in] | fbo | The fbo |
Definition at line 147 of file texture_gles.cc.
References TextureGLES().
Referenced by CreatePlaceholder(), and impeller::SurfaceGLES::WrapFBO().
|
static |
Create a texture by wrapping an external OpenGL texture handle. Ownership of the texture handle is assumed by the reactor.
[in] | reactor | The reactor |
[in] | desc | The description |
[in] | external_handle | The external handle |
Definition at line 159 of file texture_gles.cc.
References impeller::HandleGLES::GetType(), impeller::HandleGLES::IsDead(), impeller::kTexture, TextureGLES(), and VALIDATION_LOG.
Referenced by impeller::interop::ImpellerTextureCreateWithOpenGLTextureHandleNew().