Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Flutter External Texture Based On OpenGL Texture Underlying Share Context #11819

Closed

Conversation

kaisa695275735
Copy link
Contributor

This is a new PR about External Texture, the old one(#11276) is closed because of my mistaken git operation.

@kaisa695275735
Copy link
Contributor Author

Hi @dnfield @gaaclarke We've added the unit test code in testing/scenarios_app for IOS, which is similar to the platform view example.
For Android ,we've finished the demo code to be tested, but did not find any good way for testing benchmark

@dnfield
Copy link
Contributor

dnfield commented Sep 12, 2019

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
@kaisa695275735
Copy link
Contributor Author

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 are resolved already.

@gw280
Copy link
Contributor

gw280 commented Sep 13, 2019

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 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?

# 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
@kaisa695275735
Copy link
Contributor Author

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 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?

We may not merge this change until the code reviews are all resolved.

@kangwang1988
Copy link
Contributor

@dnfield
@kaisa695275735 is my colleague focusing on video related works.
Should we wait for more members to review it or it's about ready to be merged?

@dnfield
Copy link
Contributor

dnfield commented Sep 18, 2019

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.

@kaisa695275735
Copy link
Contributor Author

@gaaclarke we have make our changes.
please take a look! Thank you very much!

Copy link
Member

@gaaclarke gaaclarke left a 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();
Copy link
Member

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;
Copy link
Member

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;
Copy link
Member

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 {
Copy link
Member

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.

@gaaclarke
Copy link
Member

I drew up the iOS portion of the PR:
share-context

@cbracken
Copy link
Member

cbracken commented Oct 7, 2019

@kaisa695275735 just checking in to see if you're still working on this PR. If so, no worries!

@zhangruiyu
Copy link

????

@cbracken
Copy link
Member

@kaisa695275735 is PR still work-in-progress? Looks like we're waiting on fixes to address @gaaclarke 's comments.

@kaisa695275735
Copy link
Contributor Author

kaisa695275735 commented Oct 23, 2019

@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.
we are trying to use CVOpenGLESTextureCache to implement a filter camera demo, and we find this scheme does have the same CPU level with our share texture scheme.
So all the code for iOS is not needed.
We are trying to use SurfaceTexture scheme for Android, if they have the same CPU level,
this PR may be closed.

demo git: git@github.com:kaisa695275735/filter_camera.git

@gaaclarke gaaclarke closed this Oct 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants