-
Notifications
You must be signed in to change notification settings - Fork 6k
Flutter External Texture Based On OpenGL Texture Underlying Share Context #11819
Flutter External Texture Based On OpenGL Texture Underlying Share Context #11819
Conversation
Hi @dnfield @gaaclarke We've added the unit test code in testing/scenarios_app for IOS, which is similar to the platform view example. |
We don't have as much wired up for Android on CI just yet. Before we look at this, can you work on the merge conflicts? @gw280 just landed a patch that is causing some conflicts with this one. |
# Conflicts: # shell/platform/darwin/ios/platform_view_ios.h # testing/scenario_app/ios/Scenarios/Scenarios.xcodeproj/project.pbxproj
Conflicts are resolved already. |
My change got backed out because it was failing LUCI, so I'm currently working on reworking that. When are you hoping to merge this change? |
shell/platform/android/android_external_texture_gl_share_context.cc
Outdated
Show resolved
Hide resolved
shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java
Outdated
Show resolved
Hide resolved
shell/platform/darwin/ios/ios_external_texture_gl_share_context.h
Outdated
Show resolved
Hide resolved
shell/platform/darwin/ios/ios_external_texture_gl_share_context.h
Outdated
Show resolved
Hide resolved
# Conflicts: # shell/platform/darwin/ios/platform_view_ios.h # testing/scenario_app/ios/Scenarios/Scenarios/AppDelegate.m # testing/scenario_app/lib/main.dart # testing/scenario_app/lib/src/scenario.dart
We may not merge this change until the code reviews are all resolved. |
# Conflicts: # shell/platform/darwin/ios/ios_gl_context.h # shell/platform/darwin/ios/platform_view_ios.h
@dnfield |
Thanks! It needs to have a LGTM before meeting. I can try to take a look today as well but it looks like @gaaclarke is on it. |
Conflicts: shell/platform/darwin/ios/platform_view_ios.h
@gaaclarke we have make our changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for cleaning this up. It made it easier to review.
I've reviewed all the iOS code. One problem with it is that you are leaking OpenGL into interfaces that are renderer agnostic. Remember that we also support Metal and these changes don't make sense for that renderer.
The crux of your problem is FlutterTexture::copyPixelBuffer
, right? I think there may be a way you can get the performance you want by using FlutterTexture and internally using CVOpenGLESTextureCache to get CPU/GPU images. See https://developer.apple.com/documentation/corevideo/cvopenglestexturecache?language=objc for more information.
fml::scoped_nsprotocol<FlutterTextInputPlugin*> GetTextInputPlugin() const; | ||
|
||
void SetTextInputPlugin(fml::scoped_nsprotocol<FlutterTextInputPlugin*> plugin); | ||
|
||
// |PlatformView| | ||
void SetSemanticsEnabled(bool enabled) override; | ||
|
||
EAGLSharegroup* GetGLShareGroup(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leaking OpenGL in renderer agnostic code.
@@ -39,6 +39,8 @@ class IOSSurface { | |||
virtual std::unique_ptr<Surface> CreateGPUSurface( | |||
GrContext* gr_context = nullptr) = 0; | |||
|
|||
virtual EAGLSharegroup* GetGLShareGroup() = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leaking OpenGL into renderer agnostic code.
- (void)textureFrameAvailable:(int64_t)textureId; | ||
- (void)unregisterTexture:(int64_t)textureId; | ||
- (EAGLSharegroup*)getShareGroup; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leaking OpenGL into renderer agnostic code.
// Unlike the original external texture which copies pixel buffer from an object that implements | ||
// FlutterTexture protocol, and creates a texture reference using the pixel buffer, this solution | ||
// will copy the OpenGL texture directly from the object implementing FlutterShareTexture protocol. | ||
class IOSExternalTextureShareContext : public flutter::Texture { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be named IOSExternalShareContextTexture. The type is usually placed at the end of the name.
@kaisa695275735 just checking in to see if you're still working on this PR. If so, no worries! |
???? |
@kaisa695275735 is PR still work-in-progress? Looks like we're waiting on fixes to address @gaaclarke 's comments. |
sorry for my later reply. I took a long vocation last month. demo git: git@github.com:kaisa695275735/filter_camera.git |
This is a new PR about External Texture, the old one(#11276) is closed because of my mistaken git operation.