From 8f298e401016bd0457ba14094f4859680df84c47 Mon Sep 17 00:00:00 2001 From: Xiaowei Guan Date: Tue, 13 Jan 2026 01:34:17 +0800 Subject: [PATCH 1/3] [Tizen] Re-implemented render external texture gl for impeller to avoid change FlutterOpenGLTexture and use deprecated api --- .../shell/platform/embedder/embedder.h | 9 +- .../embedder/embedder_external_texture_gl.cc | 119 ++++++------------ .../embedder/embedder_external_texture_gl.h | 13 +- 3 files changed, 43 insertions(+), 98 deletions(-) diff --git a/engine/src/flutter/shell/platform/embedder/embedder.h b/engine/src/flutter/shell/platform/embedder/embedder.h index 6f5b50ec17fbd..9249f082d30af 100644 --- a/engine/src/flutter/shell/platform/embedder/embedder.h +++ b/engine/src/flutter/shell/platform/embedder/embedder.h @@ -405,7 +405,6 @@ typedef struct { } FlutterTransformation; typedef void (*VoidCallback)(void* /* user data */); -typedef bool (*BoolCallback)(void* /* user data */); typedef enum { /// Specifies an OpenGL texture target type. Textures are specified using @@ -513,13 +512,6 @@ typedef struct { uint32_t name; /// The texture format (example GL_RGBA8). uint32_t format; - /// The pixel data buffer. - const uint8_t* buffer; - /// The size of pixel buffer. - size_t buffer_size; - /// Callback invoked that the gpu surface texture start binding. - BoolCallback bind_callback; - /// User data to be returned on the invocation of the destruction callback. void* user_data; /// Callback invoked (on an engine managed thread) that asks the embedder to @@ -613,6 +605,7 @@ typedef struct { uint32_t format; } FlutterOpenGLSurface; +typedef bool (*BoolCallback)(void* /* user data */); typedef FlutterTransformation (*TransformationCallback)(void* /* user data */); typedef uint32_t (*UIntCallback)(void* /* user data */); typedef bool (*SoftwareSurfacePresentCallback)(void* /* user data */, diff --git a/engine/src/flutter/shell/platform/embedder/embedder_external_texture_gl.cc b/engine/src/flutter/shell/platform/embedder/embedder_external_texture_gl.cc index e8d2ad8bd12a3..813bf83ea22d8 100644 --- a/engine/src/flutter/shell/platform/embedder/embedder_external_texture_gl.cc +++ b/engine/src/flutter/shell/platform/embedder/embedder_external_texture_gl.cc @@ -140,93 +140,50 @@ sk_sp EmbedderExternalTextureGL::ResolveTextureImpeller( return nullptr; } - if (texture->bind_callback != nullptr) { - return ResolveTextureImpellerSurface(aiks_context, std::move(texture)); - } else { - return ResolveTextureImpellerPixelbuffer(aiks_context, std::move(texture)); - } -} + std::shared_ptr image; -sk_sp EmbedderExternalTextureGL::ResolveTextureImpellerPixelbuffer( - impeller::AiksContext* aiks_context, - std::unique_ptr texture) { - impeller::TextureDescriptor desc; - desc.size = impeller::ISize(texture->width, texture->height); - desc.type = impeller::TextureType::kTexture2D; - desc.storage_mode = impeller::StorageMode::kDevicePrivate; - desc.format = impeller::PixelFormat::kR8G8B8A8UNormInt; - impeller::ContextGLES& context = - impeller::ContextGLES::Cast(*aiks_context->GetContext()); - std::shared_ptr image = - std::make_shared(context.GetReactor(), desc); - - image->MarkContentsInitialized(); - if (!image->SetContents(texture->buffer, texture->buffer_size)) { - if (texture->destruction_callback) { - texture->destruction_callback(texture->user_data); + auto it = impeller_gl_textures_.find(texture->name); + if (it != impeller_gl_textures_.end()) { + image = it->second; + } else { + impeller::TextureDescriptor desc; + desc.size = impeller::ISize(texture->width, texture->height); + desc.storage_mode = impeller::StorageMode::kDevicePrivate; + desc.format = impeller::PixelFormat::kR8G8B8A8UNormInt; + if (texture->target == GL_TEXTURE_EXTERNAL_OES) { + desc.type = impeller::TextureType::kTextureExternalOES; + } else { + desc.type = impeller::TextureType::kTexture2D; } - return nullptr; - } - - if (!image) { - // In case Skia rejects the image, call the release proc so that - // embedders can perform collection of intermediates. - if (texture->destruction_callback) { - texture->destruction_callback(texture->user_data); + impeller::ContextGLES& context = + impeller::ContextGLES::Cast(*aiks_context->GetContext()); + impeller::HandleGLES handle = context.GetReactor()->CreateHandle( + impeller::HandleType::kTexture, texture->name); + + image = + impeller::TextureGLES::WrapTexture(context.GetReactor(), desc, handle); + if (!image) { + // In case Skia rejects the image, call the release proc so that + // embedders can perform collection of intermediates. + if (texture->destruction_callback) { + texture->destruction_callback(texture->user_data); + } + FML_LOG(ERROR) << "Could not create external texture"; + return nullptr; } - FML_LOG(ERROR) << "Could not create external texture"; - return nullptr; - } - if (texture->destruction_callback) { - texture->destruction_callback(texture->user_data); - } + image->SetCoordinateSystem( + impeller::TextureCoordinateSystem::kUploadFromHost); - return impeller::DlImageImpeller::Make(image); -} - -sk_sp EmbedderExternalTextureGL::ResolveTextureImpellerSurface( - impeller::AiksContext* aiks_context, - std::unique_ptr texture) { - impeller::TextureDescriptor desc; - desc.size = impeller::ISize(texture->width, texture->height); - desc.storage_mode = impeller::StorageMode::kDevicePrivate; - desc.format = impeller::PixelFormat::kR8G8B8A8UNormInt; - desc.type = impeller::TextureType::kTextureExternalOES; - impeller::ContextGLES& context = - impeller::ContextGLES::Cast(*aiks_context->GetContext()); - std::shared_ptr image = - std::make_shared(context.GetReactor(), desc); - image->MarkContentsInitialized(); - image->SetCoordinateSystem( - impeller::TextureCoordinateSystem::kUploadFromHost); - if (!image->Bind()) { - if (texture->destruction_callback) { - texture->destruction_callback(texture->user_data); - } - FML_LOG(ERROR) << "Could not bind texture"; - return nullptr; - } - - if (!image) { - // In case Skia rejects the image, call the release proc so that - // embedders can perform collection of intermediates. - if (texture->destruction_callback) { - texture->destruction_callback(texture->user_data); - } - FML_LOG(ERROR) << "Could not create external texture"; - return nullptr; - } - - if (!texture->bind_callback(texture->user_data)) { - if (texture->destruction_callback) { - texture->destruction_callback(texture->user_data); + if (texture->destruction_callback && + !context.GetReactor()->RegisterCleanupCallback( + handle, + [callback = texture->destruction_callback, + user_data = texture->user_data]() { callback(user_data); })) { + FML_LOG(ERROR) << "Could not register destruction callback"; + return nullptr; } - return nullptr; - } - - if (texture->destruction_callback) { - texture->destruction_callback(texture->user_data); + impeller_gl_textures_[texture->name] = image; } return impeller::DlImageImpeller::Make(image); diff --git a/engine/src/flutter/shell/platform/embedder/embedder_external_texture_gl.h b/engine/src/flutter/shell/platform/embedder/embedder_external_texture_gl.h index 6ecb6843208d1..b44760abfc655 100644 --- a/engine/src/flutter/shell/platform/embedder/embedder_external_texture_gl.h +++ b/engine/src/flutter/shell/platform/embedder/embedder_external_texture_gl.h @@ -5,9 +5,11 @@ #ifndef FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_EXTERNAL_TEXTURE_GL_H_ #define FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_EXTERNAL_TEXTURE_GL_H_ +#include #include "flutter/common/graphics/texture.h" #include "flutter/fml/macros.h" #include "flutter/shell/platform/embedder/embedder.h" +#include "impeller/renderer/backend/gles/texture_gles.h" #include "third_party/skia/include/core/SkSize.h" namespace flutter { @@ -25,7 +27,8 @@ class EmbedderExternalTextureGL : public flutter::Texture { private: const ExternalTextureCallback& external_texture_callback_; sk_sp last_image_; - + std::unordered_map> + impeller_gl_textures_; sk_sp ResolveTexture(int64_t texture_id, GrDirectContext* context, impeller::AiksContext* aiks_context, @@ -39,14 +42,6 @@ class EmbedderExternalTextureGL : public flutter::Texture { impeller::AiksContext* aiks_context, const SkISize& size); - sk_sp ResolveTextureImpellerPixelbuffer( - impeller::AiksContext* aiks_context, - std::unique_ptr texture); - - sk_sp ResolveTextureImpellerSurface( - impeller::AiksContext* aiks_context, - std::unique_ptr texture); - // |flutter::Texture| void Paint(PaintContext& context, const DlRect& bounds, From c596644efe952bfd032a8f100ae412a8ac561344 Mon Sep 17 00:00:00 2001 From: Xiaowei Guan Date: Thu, 29 Jan 2026 03:42:27 +0800 Subject: [PATCH 2/3] Replace map with LRU cache --- .../embedder/embedder_external_texture_gl.cc | 210 ++++++++++++++---- .../embedder/embedder_external_texture_gl.h | 50 ++++- 2 files changed, 217 insertions(+), 43 deletions(-) diff --git a/engine/src/flutter/shell/platform/embedder/embedder_external_texture_gl.cc b/engine/src/flutter/shell/platform/embedder/embedder_external_texture_gl.cc index 813bf83ea22d8..c07d8244d8643 100644 --- a/engine/src/flutter/shell/platform/embedder/embedder_external_texture_gl.cc +++ b/engine/src/flutter/shell/platform/embedder/embedder_external_texture_gl.cc @@ -27,6 +27,97 @@ namespace flutter { +std::optional TextureLRU::FindTexture( + std::optional key) { + if (!key.has_value()) { + return std::nullopt; + } + auto key_value = key.value(); + for (size_t i = 0u; i < kTextureMaxSize; i++) { + if (textures_[i].key == key_value) { + auto result = textures_[i].value; + UpdateTexture(result, key_value, textures_[i].width, textures_[i].height); + return std::make_optional(textures_[i]); + } + } + return std::nullopt; +} + +void TextureLRU::UpdateTexture( + const std::shared_ptr& texture, + GLuint key, + size_t width, + size_t height) { + if (textures_[0].key == key) { + textures_[0].value = texture; + textures_[0].width = width; + textures_[0].height = height; + return; + } + size_t i = 1u; + for (; i < kTextureMaxSize; i++) { + if (textures_[i].key == key) { + break; + } + } + for (auto j = i; j > 0; j--) { + textures_[j] = textures_[j - 1]; + } + textures_[0] = + Data{.key = key, .value = texture, .width = width, .height = height}; +} + +GLuint TextureLRU::AddTexture( + const std::shared_ptr& texture, + GLuint key, + size_t width, + size_t height) { + GLuint lru_key = textures_[kTextureMaxSize - 1].key; + bool updated_image = false; + for (size_t i = 0u; i < kTextureMaxSize; i++) { + if (textures_[i].key == lru_key) { + updated_image = true; + textures_[i] = + Data{.key = key, .value = texture, .width = width, .height = height}; + break; + } + } + if (!updated_image) { + textures_[0] = + Data{.key = key, .value = texture, .width = width, .height = height}; + } + UpdateTexture(texture, key, width, height); + return lru_key; +} + +void TextureLRU::Clear() { + for (size_t i = 0u; i < kTextureMaxSize; i++) { + textures_[i] = Data{.key = 0u, .value = nullptr}; + } +} + +void TextureLRU::RemoveTexture(GLuint key) { + size_t i = 0u; + for (; i < kTextureMaxSize; i++) { + if (textures_[i].key == key) { + break; + } + } + + // If key not found, return + if (i == kTextureMaxSize) { + return; + } + + // Shift all entries after the found entry down by one position + for (; i < kTextureMaxSize - 1; i++) { + textures_[i] = textures_[i + 1]; + } + + // Clear the last entry + textures_[kTextureMaxSize - 1] = Data{.key = 0u, .value = nullptr}; +} + EmbedderExternalTextureGL::EmbedderExternalTextureGL( int64_t texture_identifier, const ExternalTextureCallback& callback) @@ -129,6 +220,50 @@ sk_sp EmbedderExternalTextureGL::ResolveTextureSkia( return DlImage::Make(std::move(image)); } +std::shared_ptr +EmbedderExternalTextureGL::CreateTextureGLES( + impeller::AiksContext* aiks_context, + FlutterOpenGLTexture* texture) { + impeller::TextureDescriptor desc; + desc.size = impeller::ISize(texture->width, texture->height); + desc.storage_mode = impeller::StorageMode::kDevicePrivate; + desc.format = impeller::PixelFormat::kR8G8B8A8UNormInt; + if (texture->target == GL_TEXTURE_EXTERNAL_OES) { + desc.type = impeller::TextureType::kTextureExternalOES; + } else { + desc.type = impeller::TextureType::kTexture2D; + } + impeller::ContextGLES& context = + impeller::ContextGLES::Cast(*aiks_context->GetContext()); + impeller::HandleGLES handle = context.GetReactor()->CreateHandle( + impeller::HandleType::kTexture, texture->name); + + auto gles_texture = + impeller::TextureGLES::WrapTexture(context.GetReactor(), desc, handle); + if (!gles_texture) { + // In case Skia rejects the image, call the release proc so that + // embedders can perform collection of intermediates. + if (texture->destruction_callback) { + texture->destruction_callback(texture->user_data); + } + FML_LOG(ERROR) << "Could not create external texture"; + return nullptr; + } + + gles_texture->SetCoordinateSystem( + impeller::TextureCoordinateSystem::kUploadFromHost); + + if (texture->destruction_callback && + !context.GetReactor()->RegisterCleanupCallback( + handle, + [callback = texture->destruction_callback, + user_data = texture->user_data]() { callback(user_data); })) { + FML_LOG(ERROR) << "Could not register destruction callback"; + return nullptr; + } + return gles_texture; +} + sk_sp EmbedderExternalTextureGL::ResolveTextureImpeller( int64_t texture_id, impeller::AiksContext* aiks_context, @@ -140,53 +275,44 @@ sk_sp EmbedderExternalTextureGL::ResolveTextureImpeller( return nullptr; } - std::shared_ptr image; + std::optional texture_data = + texture_lru_.FindTexture(texture->name); - auto it = impeller_gl_textures_.find(texture->name); - if (it != impeller_gl_textures_.end()) { - image = it->second; - } else { - impeller::TextureDescriptor desc; - desc.size = impeller::ISize(texture->width, texture->height); - desc.storage_mode = impeller::StorageMode::kDevicePrivate; - desc.format = impeller::PixelFormat::kR8G8B8A8UNormInt; - if (texture->target == GL_TEXTURE_EXTERNAL_OES) { - desc.type = impeller::TextureType::kTextureExternalOES; + bool size_change = false; + + if (texture_data.has_value() && + (texture_data.value().width != texture->width || + texture_data.value().height != texture->height)) { + size_change = true; + } + + if (texture_data.has_value() && !size_change) { + return impeller::DlImageImpeller::Make(texture_data.value().value); + } else if (texture_data.has_value() && size_change) { + std::shared_ptr old_gles_texture = + texture_data.value().value; + old_gles_texture->Leak(); + std::shared_ptr new_gles_texture = + CreateTextureGLES(aiks_context, texture.get()); + if (new_gles_texture) { + texture_lru_.UpdateTexture(new_gles_texture, texture->name, texture->width, + texture->height); + return impeller::DlImageImpeller::Make(new_gles_texture); } else { - desc.type = impeller::TextureType::kTexture2D; - } - impeller::ContextGLES& context = - impeller::ContextGLES::Cast(*aiks_context->GetContext()); - impeller::HandleGLES handle = context.GetReactor()->CreateHandle( - impeller::HandleType::kTexture, texture->name); - - image = - impeller::TextureGLES::WrapTexture(context.GetReactor(), desc, handle); - if (!image) { - // In case Skia rejects the image, call the release proc so that - // embedders can perform collection of intermediates. - if (texture->destruction_callback) { - texture->destruction_callback(texture->user_data); - } - FML_LOG(ERROR) << "Could not create external texture"; + texture_lru_.RemoveTexture(texture->name); return nullptr; } - - image->SetCoordinateSystem( - impeller::TextureCoordinateSystem::kUploadFromHost); - - if (texture->destruction_callback && - !context.GetReactor()->RegisterCleanupCallback( - handle, - [callback = texture->destruction_callback, - user_data = texture->user_data]() { callback(user_data); })) { - FML_LOG(ERROR) << "Could not register destruction callback"; + } else { + std::shared_ptr new_gles_texture = + CreateTextureGLES(aiks_context, texture.get()); + if (new_gles_texture) { + texture_lru_.AddTexture(new_gles_texture, texture->name, texture->width, + texture->height); + return impeller::DlImageImpeller::Make(new_gles_texture); + } else { return nullptr; } - impeller_gl_textures_[texture->name] = image; } - - return impeller::DlImageImpeller::Make(image); } // |flutter::Texture| @@ -201,6 +327,8 @@ void EmbedderExternalTextureGL::MarkNewFrameAvailable() { } // |flutter::Texture| -void EmbedderExternalTextureGL::OnTextureUnregistered() {} +void EmbedderExternalTextureGL::OnTextureUnregistered() { + texture_lru_.Clear(); +} } // namespace flutter diff --git a/engine/src/flutter/shell/platform/embedder/embedder_external_texture_gl.h b/engine/src/flutter/shell/platform/embedder/embedder_external_texture_gl.h index b44760abfc655..5adf2018bcc96 100644 --- a/engine/src/flutter/shell/platform/embedder/embedder_external_texture_gl.h +++ b/engine/src/flutter/shell/platform/embedder/embedder_external_texture_gl.h @@ -5,6 +5,8 @@ #ifndef FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_EXTERNAL_TEXTURE_GL_H_ #define FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_EXTERNAL_TEXTURE_GL_H_ +#include +#include #include #include "flutter/common/graphics/texture.h" #include "flutter/fml/macros.h" @@ -13,6 +15,47 @@ #include "third_party/skia/include/core/SkSize.h" namespace flutter { +static constexpr size_t kTextureMaxSize = 6u; + +class TextureLRU { + public: + struct Data { + GLuint key = 0u; + std::shared_ptr value; + size_t width = 0; + size_t height = 0; + }; + + TextureLRU() = default; + + ~TextureLRU() = default; + + /// @brief Retrieve the Texture associated with the given [key], or nullptr. + std::optional FindTexture(std::optional key); + + /// @brief Add a new texture to the cache with a key, returning the key of the + /// LRU entry that was removed. + /// + /// The value may be `0`, in which case nothing was removed. + GLuint AddTexture(const std::shared_ptr& texture, + GLuint key, + size_t width, + size_t height); + + /// @brief Remove all entires from the image cache. + void Clear(); + + /// @brief Remove a texture from the cache by key. + void RemoveTexture(GLuint key); + /// @brief Marks [key] as the most recently used. + void UpdateTexture(const std::shared_ptr& texture, + GLuint key, + size_t width, + size_t height); + + private: + std::array textures_; +}; class EmbedderExternalTextureGL : public flutter::Texture { public: @@ -27,8 +70,7 @@ class EmbedderExternalTextureGL : public flutter::Texture { private: const ExternalTextureCallback& external_texture_callback_; sk_sp last_image_; - std::unordered_map> - impeller_gl_textures_; + TextureLRU texture_lru_ = TextureLRU(); sk_sp ResolveTexture(int64_t texture_id, GrDirectContext* context, impeller::AiksContext* aiks_context, @@ -42,6 +84,10 @@ class EmbedderExternalTextureGL : public flutter::Texture { impeller::AiksContext* aiks_context, const SkISize& size); + std::shared_ptr CreateTextureGLES( + impeller::AiksContext* aiks_context, + FlutterOpenGLTexture* texture); + // |flutter::Texture| void Paint(PaintContext& context, const DlRect& bounds, From 449ff0b73243290acf2148597f0b08754759b962 Mon Sep 17 00:00:00 2001 From: Xiaowei Guan Date: Thu, 29 Jan 2026 22:56:45 +0800 Subject: [PATCH 3/3] Update Add and Update method --- .../embedder/embedder_external_texture_gl.cc | 52 ++++++++----------- .../embedder/embedder_external_texture_gl.h | 11 ++-- 2 files changed, 25 insertions(+), 38 deletions(-) diff --git a/engine/src/flutter/shell/platform/embedder/embedder_external_texture_gl.cc b/engine/src/flutter/shell/platform/embedder/embedder_external_texture_gl.cc index c07d8244d8643..1a9383a6922ff 100644 --- a/engine/src/flutter/shell/platform/embedder/embedder_external_texture_gl.cc +++ b/engine/src/flutter/shell/platform/embedder/embedder_external_texture_gl.cc @@ -36,57 +36,47 @@ std::optional TextureLRU::FindTexture( for (size_t i = 0u; i < kTextureMaxSize; i++) { if (textures_[i].key == key_value) { auto result = textures_[i].value; - UpdateTexture(result, key_value, textures_[i].width, textures_[i].height); + UpdateTexture(Data{.key = key_value, + .value = result, + .width = textures_[i].width, + .height = textures_[i].height}); return std::make_optional(textures_[i]); } } return std::nullopt; } -void TextureLRU::UpdateTexture( - const std::shared_ptr& texture, - GLuint key, - size_t width, - size_t height) { - if (textures_[0].key == key) { - textures_[0].value = texture; - textures_[0].width = width; - textures_[0].height = height; +void TextureLRU::UpdateTexture(Data data) { + if (textures_[0].key == data.key) { + textures_[0] = data; return; } size_t i = 1u; for (; i < kTextureMaxSize; i++) { - if (textures_[i].key == key) { + if (textures_[i].key == data.key) { break; } } for (auto j = i; j > 0; j--) { textures_[j] = textures_[j - 1]; } - textures_[0] = - Data{.key = key, .value = texture, .width = width, .height = height}; + textures_[0] = data; } -GLuint TextureLRU::AddTexture( - const std::shared_ptr& texture, - GLuint key, - size_t width, - size_t height) { +GLuint TextureLRU::AddTexture(Data data) { GLuint lru_key = textures_[kTextureMaxSize - 1].key; bool updated_image = false; for (size_t i = 0u; i < kTextureMaxSize; i++) { if (textures_[i].key == lru_key) { updated_image = true; - textures_[i] = - Data{.key = key, .value = texture, .width = width, .height = height}; + textures_[i] = data; break; } } if (!updated_image) { - textures_[0] = - Data{.key = key, .value = texture, .width = width, .height = height}; + textures_[0] = data; } - UpdateTexture(texture, key, width, height); + UpdateTexture(data); return lru_key; } @@ -104,17 +94,14 @@ void TextureLRU::RemoveTexture(GLuint key) { } } - // If key not found, return if (i == kTextureMaxSize) { return; } - // Shift all entries after the found entry down by one position for (; i < kTextureMaxSize - 1; i++) { textures_[i] = textures_[i + 1]; } - // Clear the last entry textures_[kTextureMaxSize - 1] = Data{.key = 0u, .value = nullptr}; } @@ -295,8 +282,11 @@ sk_sp EmbedderExternalTextureGL::ResolveTextureImpeller( std::shared_ptr new_gles_texture = CreateTextureGLES(aiks_context, texture.get()); if (new_gles_texture) { - texture_lru_.UpdateTexture(new_gles_texture, texture->name, texture->width, - texture->height); + texture_lru_.UpdateTexture(TextureLRU::Data{.key = texture->name, + .value = new_gles_texture, + .width = texture->width, + .height = texture->height}); + return impeller::DlImageImpeller::Make(new_gles_texture); } else { texture_lru_.RemoveTexture(texture->name); @@ -306,8 +296,10 @@ sk_sp EmbedderExternalTextureGL::ResolveTextureImpeller( std::shared_ptr new_gles_texture = CreateTextureGLES(aiks_context, texture.get()); if (new_gles_texture) { - texture_lru_.AddTexture(new_gles_texture, texture->name, texture->width, - texture->height); + texture_lru_.AddTexture(TextureLRU::Data{.key = texture->name, + .value = new_gles_texture, + .width = texture->width, + .height = texture->height}); return impeller::DlImageImpeller::Make(new_gles_texture); } else { return nullptr; diff --git a/engine/src/flutter/shell/platform/embedder/embedder_external_texture_gl.h b/engine/src/flutter/shell/platform/embedder/embedder_external_texture_gl.h index 5adf2018bcc96..1826cdd720e0c 100644 --- a/engine/src/flutter/shell/platform/embedder/embedder_external_texture_gl.h +++ b/engine/src/flutter/shell/platform/embedder/embedder_external_texture_gl.h @@ -37,21 +37,16 @@ class TextureLRU { /// LRU entry that was removed. /// /// The value may be `0`, in which case nothing was removed. - GLuint AddTexture(const std::shared_ptr& texture, - GLuint key, - size_t width, - size_t height); + GLuint AddTexture(Data data); /// @brief Remove all entires from the image cache. void Clear(); /// @brief Remove a texture from the cache by key. void RemoveTexture(GLuint key); + /// @brief Marks [key] as the most recently used. - void UpdateTexture(const std::shared_ptr& texture, - GLuint key, - size_t width, - size_t height); + void UpdateTexture(Data data); private: std::array textures_;