#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) | |
| ~TextureGLES () override | |
| bool | IsValid () const override |
| std::optional< GLuint > | GetGLHandle () const |
| bool | Bind () |
| bool | GenerateMipmap () |
| bool | SetAsFramebufferAttachment (GLenum target, AttachmentType attachment_type) |
| 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. | |
| 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 |
| 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. | |
| 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 19 of file texture_gles.h.
|
strong |
| Enumerator | |
|---|---|
| kColor0 | |
| kDepth | |
| kStencil | |
Definition at line 95 of file texture_gles.h.
|
strong |
| Enumerator | |
|---|---|
| kTexture | |
| kTextureMultisampled | |
| kRenderBuffer | |
| kRenderBufferMultisampled | |
Definition at line 22 of file texture_gles.h.
| impeller::TextureGLES::TextureGLES | ( | std::shared_ptr< ReactorGLES > | reactor, |
| TextureDescriptor | desc, | ||
| bool | threadsafe = false |
||
| ) |
Definition at line 116 of file texture_gles.cc.
|
override |
Definition at line 161 of file texture_gles.cc.
References impeller::HandleGLES::IsDead().
| bool impeller::TextureGLES::Bind | ( | ) |
Definition at line 490 of file texture_gles.cc.
References GetGLHandle(), impeller::Texture::GetTextureDescriptor(), kRenderBuffer, kRenderBufferMultisampled, kTexture, kTextureMultisampled, target, impeller::ToTextureTarget(), type, and VALIDATION_LOG.
Referenced by GenerateMipmap().
| TextureGLES::Type impeller::TextureGLES::ComputeTypeForBinding | ( | GLenum | target | ) | const |
Definition at line 346 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 110 of file texture_gles.cc.
References WrapFBO().
Referenced by MakeRenderTargetFromBackingStoreImpeller(), and impeller::SurfaceGLES::WrapFBO().
| bool impeller::TextureGLES::GenerateMipmap | ( | ) |
Definition at line 556 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 683 of file texture_gles.cc.
Referenced by impeller::EncodeCommandsInReactor().
| std::optional< GLuint > impeller::TextureGLES::GetFBO | ( | ) | const |
Definition at line 665 of file texture_gles.cc.
Referenced by impeller::EncodeCommandsInReactor().
| std::optional< GLuint > impeller::TextureGLES::GetGLHandle | ( | ) | const |
Definition at line 483 of file texture_gles.cc.
References 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 675 of file texture_gles.cc.
Referenced by impeller::testing::TEST_P().
| TextureGLES::Type impeller::TextureGLES::GetType | ( | ) | const |
Definition at line 590 of file texture_gles.cc.
Referenced by impeller::BlitCopyBufferToTextureCommandGLES::Encode().
| bool impeller::TextureGLES::IsSliceInitialized | ( | size_t | slice | ) | const |
Definition at line 535 of file texture_gles.cc.
References IsSliceMipLevelInitialized().
| bool impeller::TextureGLES::IsSliceMipLevelInitialized | ( | size_t | slice, |
| size_t | mip_level | ||
| ) | const |
Definition at line 547 of file texture_gles.cc.
Referenced by impeller::BlitCopyBufferToTextureCommandGLES::Encode(), and IsSliceInitialized().
|
overridevirtual |
Implements impeller::Texture.
Definition at line 173 of file texture_gles.cc.
Referenced by GenerateMipmap(), GetGLHandle(), and SetAsFramebufferAttachment().
| bool impeller::TextureGLES::IsWrapped | ( | ) | const |
Definition at line 661 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 168 of file texture_gles.cc.
References impeller::HandleGLES::DeadHandle().
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 525 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 531 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 539 of file texture_gles.cc.
Referenced by impeller::BlitCopyBufferToTextureCommandGLES::Encode(), and MarkSliceInitialized().
| bool impeller::TextureGLES::SetAsFramebufferAttachment | ( | GLenum | target, |
| AttachmentType | attachment_type | ||
| ) |
Definition at line 605 of file texture_gles.cc.
References ComputeTypeForBinding(), GetGLHandle(), IsValid(), kRenderBuffer, kRenderBufferMultisampled, kTexture, kTextureMultisampled, target, 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 679 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 669 of file texture_gles.cc.
References FML_DCHECK.
|
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 78 of file texture_gles.cc.
References 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 90 of file texture_gles.cc.
References impeller::HandleGLES::GetType(), impeller::HandleGLES::IsDead(), impeller::kTexture, texture, and VALIDATION_LOG.
Referenced by Skwasm::DlWimpImageFromTexture::GetImpellerTexture(), impeller::interop::ImpellerTextureCreateWithOpenGLTextureHandleNew(), and impeller::testing::TEST_P().