#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, bool threadsafe=false) | |
| bool | IsValid () const override |
| std::optional< GLuint > | GetGLHandle () const |
| bool | Bind () |
| bool | GenerateMipmap () |
| bool | SetAsFramebufferAttachment (GLenum target, AttachmentType attachment_type, uint32_t mip_level=0, uint32_t slice=0) |
| Type | GetType () const |
| bool | IsWrapped () const |
| void | Leak () |
| Reset the internal texture state so that the reactor will not free the associated handle. | |
| std::optional< GLuint > | GetFBO () const |
| void | MarkContentsInitialized () |
| Indicates that all texture storage has already been allocated and contents initialized. | |
| void | MarkSliceInitialized (size_t slice) |
| Indicates that a specific texture slice has been initialized. | |
| bool | IsSliceInitialized (size_t slice) const |
| void | MarkSliceMipLevelInitialized (size_t slice, size_t mip_level) |
Indicates that storage for mip_level of slice has been allocated by a glTexImage2D call (or equivalent). | |
| bool | IsSliceMipLevelInitialized (size_t slice, size_t mip_level) 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. | |
| void | SetCachedFBO (HandleGLES fbo) |
| const HandleGLES & | GetCachedFBO () const |
| Retrieve the cached FBO object, or a dead handle if there is no object. | |
| void | SetCachedFBOSubresource (uint32_t mip_level, uint32_t slice) |
| Records the subresource the cached FBO is currently bound to. | |
| bool | CachedFBOMatchesSubresource (uint32_t mip_level, uint32_t slice) const |
| std::optional< HandleGLES > | GetSyncFence () const |
| Type | ComputeTypeForBinding (GLenum target) const |
Public Member Functions inherited from impeller::Texture | |
| 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 |
| 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. | |
| 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. | |
| 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. | |
Static Public Member Functions inherited from impeller::BackendCast< TextureGLES, Texture > | |
| 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 | |
Protected Member Functions inherited from impeller::Texture | |
| Texture (TextureDescriptor desc) | |
Protected Attributes inherited from impeller::Texture | |
| bool | mipmap_generated_ = false |
Definition at line 20 of file texture_gles.h.
|
strong |
| Enumerator | |
|---|---|
| kColor0 | |
| kDepth | |
| kStencil | |
Definition at line 93 of file texture_gles.h.
|
strong |
| Enumerator | |
|---|---|
| kTexture | |
| kTextureMultisampled | |
| kRenderBuffer | |
| kRenderBufferMultisampled | |
Definition at line 23 of file texture_gles.h.
| impeller::TextureGLES::TextureGLES | ( | std::shared_ptr< ReactorGLES > | reactor, |
| TextureDescriptor | desc, | ||
| bool | threadsafe = false |
||
| ) |
Definition at line 133 of file texture_gles.cc.
| bool impeller::TextureGLES::Bind | ( | ) |
Definition at line 532 of file texture_gles.cc.
References impeller::UniqueHandleGLES::Get(), GetGLHandle(), impeller::Texture::GetTextureDescriptor(), impeller::UniqueHandleGLES::IsValid(), kRenderBuffer, kRenderBufferMultisampled, kTexture, kTextureMultisampled, impeller::UniqueHandleGLES::Reset(), target, impeller::ToTextureTarget(), type, and VALIDATION_LOG.
Referenced by GenerateMipmap().
| bool impeller::TextureGLES::CachedFBOMatchesSubresource | ( | uint32_t | mip_level, |
| uint32_t | slice | ||
| ) | const |
Whether the cached FBO is currently bound to (mip_level, slice). When false, the FBO must be re-attached before use.
Definition at line 782 of file texture_gles.cc.
Referenced by impeller::EncodeCommandsInReactor().
| TextureGLES::Type impeller::TextureGLES::ComputeTypeForBinding | ( | GLenum | target | ) | const |
Definition at line 388 of file texture_gles.cc.
References kTexture, kTextureMultisampled, and target.
Referenced by SetAsFramebufferAttachment(), and impeller::testing::TEST_P().
|
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 127 of file texture_gles.cc.
References reactor, and WrapFBO().
Referenced by MakeRenderTargetFromBackingStoreImpeller(), and impeller::SurfaceGLES::WrapFBO().
| bool impeller::TextureGLES::GenerateMipmap | ( | ) |
Definition at line 597 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 773 of file texture_gles.cc.
References impeller::UniqueHandleGLES::Get().
Referenced by impeller::EncodeCommandsInReactor().
| std::optional< GLuint > impeller::TextureGLES::GetFBO | ( | ) | const |
Definition at line 755 of file texture_gles.cc.
Referenced by impeller::EncodeCommandsInReactor().
| std::optional< GLuint > impeller::TextureGLES::GetGLHandle | ( | ) | const |
Definition at line 525 of file texture_gles.cc.
References impeller::UniqueHandleGLES::Get(), and IsValid().
Referenced by Bind(), impeller::ConfigureFBO(), impeller::BlitCopyBufferToTextureCommandGLES::Encode(), GenerateMipmap(), impeller::interop::ImpellerTextureGetOpenGLHandle(), SetAsFramebufferAttachment(), and impeller::testing::TEST_P().
| std::optional< HandleGLES > impeller::TextureGLES::GetSyncFence | ( | ) | const |
Definition at line 765 of file texture_gles.cc.
References impeller::UniqueHandleGLES::Get(), and impeller::UniqueHandleGLES::IsValid().
Referenced by impeller::testing::TEST_P().
| TextureGLES::Type impeller::TextureGLES::GetType | ( | ) | const |
Definition at line 631 of file texture_gles.cc.
Referenced by impeller::BlitCopyBufferToTextureCommandGLES::Encode().
| bool impeller::TextureGLES::IsSliceInitialized | ( | size_t | slice | ) | const |
Definition at line 576 of file texture_gles.cc.
References IsSliceMipLevelInitialized().
| bool impeller::TextureGLES::IsSliceMipLevelInitialized | ( | size_t | slice, |
| size_t | mip_level | ||
| ) | const |
Definition at line 588 of file texture_gles.cc.
Referenced by impeller::BlitCopyBufferToTextureCommandGLES::Encode(), and IsSliceInitialized().
|
overridevirtual |
Implements impeller::Texture.
Definition at line 184 of file texture_gles.cc.
Referenced by GenerateMipmap(), GetGLHandle(), and SetAsFramebufferAttachment().
| bool impeller::TextureGLES::IsWrapped | ( | ) | const |
Definition at line 751 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 179 of file texture_gles.cc.
References impeller::UniqueHandleGLES::Release().
Referenced by impeller::testing::TEST_P().
| 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 566 of file texture_gles.cc.
| void impeller::TextureGLES::MarkSliceInitialized | ( | size_t | slice | ) |
Indicates that a specific texture slice has been initialized.
| [in] | slice | The slice to mark as being initialized. |
Definition at line 572 of file texture_gles.cc.
References MarkSliceMipLevelInitialized().
| void impeller::TextureGLES::MarkSliceMipLevelInitialized | ( | size_t | slice, |
| size_t | mip_level | ||
| ) |
Indicates that storage for mip_level of slice has been allocated by a glTexImage2D call (or equivalent).
GLES raises GL_INVALID_OPERATION when glTexSubImage2D targets a level that has not been previously defined, so every per-level upload must check this first and allocate on demand.
| [in] | slice | The slice (cubemap face for cubemaps, otherwise always 0). |
| [in] | mip_level | The mip level whose storage was allocated. |
Definition at line 580 of file texture_gles.cc.
Referenced by impeller::BlitCopyBufferToTextureCommandGLES::Encode(), and MarkSliceInitialized().
| bool impeller::TextureGLES::SetAsFramebufferAttachment | ( | GLenum | target, |
| AttachmentType | attachment_type, | ||
| uint32_t | mip_level = 0, |
||
| uint32_t | slice = 0 |
||
| ) |
Definition at line 688 of file texture_gles.cc.
References ComputeTypeForBinding(), GetGLHandle(), impeller::Texture::GetTextureDescriptor(), IsValid(), kRenderBuffer, kRenderBufferMultisampled, kTexture, impeller::kTextureCube, kTextureMultisampled, target, impeller::ToAttachmentType(), impeller::TextureDescriptor::type, and VALIDATION_LOG.
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 769 of file texture_gles.cc.
Referenced by impeller::EncodeCommandsInReactor().
| void impeller::TextureGLES::SetCachedFBOSubresource | ( | uint32_t | mip_level, |
| uint32_t | slice | ||
| ) |
Records the subresource the cached FBO is currently bound to.
Definition at line 777 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 759 of file texture_gles.cc.
References FML_DCHECK, and impeller::UniqueHandleGLES::IsValid().
Referenced by impeller::testing::TEST_P().
|
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 95 of file texture_gles.cc.
References reactor, and texture.
Referenced by CreatePlaceholder(), MakeRenderTargetFromBackingStoreImpeller(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), 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 107 of file texture_gles.cc.
References impeller::HandleGLES::GetType(), impeller::HandleGLES::IsDead(), impeller::kTexture, reactor, texture, and VALIDATION_LOG.
Referenced by Skwasm::DlWimpImageFromTexture::GetImpellerTexture(), impeller::interop::ImpellerTextureCreateWithOpenGLTextureHandleNew(), and impeller::testing::TEST_P().