Skip to content

Commit 08ddcf0

Browse files
committed
[Tizen] Support EmbedderExternalTextureGL for impeller
1 parent 9fb056f commit 08ddcf0

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

engine/src/flutter/shell/platform/embedder/embedder.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ typedef struct {
302302
} FlutterTransformation;
303303

304304
typedef void (*VoidCallback)(void* /* user data */);
305+
typedef bool (*BoolCallback)(void* /* user data */);
305306

306307
typedef enum {
307308
/// Specifies an OpenGL texture target type. Textures are specified using
@@ -409,6 +410,13 @@ typedef struct {
409410
uint32_t name;
410411
/// The texture format (example GL_RGBA8).
411412
uint32_t format;
413+
/// The pixel data buffer.
414+
const uint8_t* buffer;
415+
/// The size of pixel buffer.
416+
size_t buffer_size;
417+
/// Callback invoked that the gpu surface texture start binding.
418+
BoolCallback bind_callback;
419+
412420
/// User data to be returned on the invocation of the destruction callback.
413421
void* user_data;
414422
/// Callback invoked (on an engine managed thread) that asks the embedder to
@@ -502,7 +510,6 @@ typedef struct {
502510
uint32_t format;
503511
} FlutterOpenGLSurface;
504512

505-
typedef bool (*BoolCallback)(void* /* user data */);
506513
typedef FlutterTransformation (*TransformationCallback)(void* /* user data */);
507514
typedef uint32_t (*UIntCallback)(void* /* user data */);
508515
typedef bool (*SoftwareSurfacePresentCallback)(void* /* user data */,

engine/src/flutter/shell/platform/embedder/embedder_external_texture_gl.cc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,10 @@ sk_sp<DlImage> EmbedderExternalTextureGL::ResolveTextureImpeller(
140140
}
141141

142142
impeller::TextureDescriptor desc;
143+
desc.type = impeller::TextureType::kTextureExternalOES;
144+
desc.storage_mode = impeller::StorageMode::kDevicePrivate;
145+
desc.format = impeller::PixelFormat::kR8G8B8A8UNormInt;
146+
desc.mip_count = 1;
143147
desc.size = impeller::ISize(texture->width, texture->height);
144148

145149
impeller::ContextGLES& context =
@@ -148,6 +152,9 @@ sk_sp<DlImage> EmbedderExternalTextureGL::ResolveTextureImpeller(
148152
impeller::HandleType::kTexture, texture->target);
149153
std::shared_ptr<impeller::TextureGLES> image =
150154
impeller::TextureGLES::WrapTexture(context.GetReactor(), desc, handle);
155+
image->MarkContentsInitialized();
156+
image->SetCoordinateSystem(
157+
impeller::TextureCoordinateSystem::kUploadFromHost);
151158

152159
if (!image) {
153160
// In case Skia rejects the image, call the release proc so that
@@ -158,6 +165,14 @@ sk_sp<DlImage> EmbedderExternalTextureGL::ResolveTextureImpeller(
158165
FML_LOG(ERROR) << "Could not create external texture";
159166
return nullptr;
160167
}
168+
169+
if (!texture->bind_callback(texture->user_data)) {
170+
if (texture->destruction_callback) {
171+
texture->destruction_callback(texture->user_data);
172+
}
173+
return nullptr;
174+
}
175+
161176
if (texture->destruction_callback &&
162177
!context.GetReactor()->RegisterCleanupCallback(
163178
handle,

0 commit comments

Comments
 (0)