This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
Texture support for glfw. #9822
Closed
Closed
Changes from 30 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
5302cf8
Merge pull request #1 from flutter/master
cloudwebrtc 2953e13
Merge remote-tracking branch 'upstream/master'
cloudwebrtc 42b7502
Merge remote-tracking branch 'upstream/master'
cloudwebrtc ee2a336
Merge remote-tracking branch 'upstream/master'
cloudwebrtc bfd31aa
Merge remote-tracking branch 'upstream/master'
cloudwebrtc 08e9d07
Add Texture support for GLFW.
cloudwebrtc 0af9192
Fixed EventChannel for embedder.
cloudwebrtc bfb06c2
Fixed compiler error for stub_flutter_api.cc.
cloudwebrtc d6529fb
Update texture registrar for glfw.
cloudwebrtc 689f6e6
clang format.
cloudwebrtc e93c57c
Update.
cloudwebrtc eaec810
Update.
cloudwebrtc 63ad181
Add comments and code modify.
cloudwebrtc f07279e
Update DEPS
cloudwebrtc d1266a8
Update external_texture_gl.h
cloudwebrtc 7391e42
Fix compilation errors for linux and clang/gn format.
cloudwebrtc 4c5f065
Fix license check error.
cloudwebrtc 93fc359
Fixed the order of glad.h contains a run error.
cloudwebrtc 184a13a
Update.
cloudwebrtc 1c70e99
Merge remote-tracking branch 'upstream/master' into texture_glfw
cloudwebrtc 63e1469
Fixed engine type definition error.
cloudwebrtc 0669a9c
Merge remote-tracking branch 'upstream/master' into texture_glfw
cloudwebrtc 2ccfeef
Use the new `glad' dependency.
cloudwebrtc dd1bffb
Update.
cloudwebrtc c400937
fix typo.
cloudwebrtc 6456082
clang-format.
cloudwebrtc a46b562
update.
cloudwebrtc 3ecb5fd
Add comment.
cloudwebrtc e1b7a8b
Add unit tests for texture.
cloudwebrtc 4903666
update.
cloudwebrtc eed131a
update.
cloudwebrtc aba2fa2
update unit test.
cloudwebrtc d8efcdb
Fixed typo.
cloudwebrtc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
shell/platform/common/cpp/client_wrapper/include/flutter/texture_registrar.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| // Copyright 2013 The Flutter Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| #ifndef FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_TEXTURE_REGISTRAR_H_ | ||
| #define FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_TEXTURE_REGISTRAR_H_ | ||
|
|
||
| #include <flutter_texture_registrar.h> | ||
|
|
||
| #include <stdint.h> | ||
| #include <memory> | ||
|
|
||
| namespace flutter { | ||
|
|
||
| // An external texture interface declaration. | ||
| class Texture { | ||
| public: | ||
| virtual ~Texture() {} | ||
| // This is in response to the texture copy request interface, providing the | ||
| // |height| and |width| parameters of bounds. | ||
| // In some cases, we need to scale the texture to the bounds size to reduce | ||
cloudwebrtc marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| // memory usage. | ||
| virtual const PixelBuffer* CopyPixelBuffer(size_t width, size_t height) = 0; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the ownership model of the return value here? If it's a copy presumably something needs to release it, but in that case I would expect a
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This still needs to be addressed. |
||
| }; | ||
|
|
||
| class TextureRegistrar { | ||
| public: | ||
| virtual ~TextureRegistrar() {} | ||
|
|
||
| /** | ||
| * Registers a |texture| object and return textureId. | ||
cloudwebrtc marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| */ | ||
| virtual int64_t RegisterTexture(Texture* texture) = 0; | ||
|
|
||
| /** | ||
| * Mark a texture buffer is ready. | ||
cloudwebrtc marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| */ | ||
| virtual void MarkTextureFrameAvailable(int64_t texture_id) = 0; | ||
|
|
||
| /** | ||
| * Unregisters an existing Texture object. | ||
| */ | ||
| virtual void UnregisterTexture(int64_t texture_id) = 0; | ||
| }; | ||
|
|
||
| } // namespace flutter | ||
|
|
||
| #endif // FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_TEXTURE_REGISTRAR_H_ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
shell/platform/common/cpp/public/flutter_texture_registrar.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| // Copyright 2013 The Flutter Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| #ifndef FLUTTER_SHELL_PLATFORM_COMMON_CPP_PUBLIC_FLUTTER_TEXTURE_REGISTRAR_H_ | ||
| #define FLUTTER_SHELL_PLATFORM_COMMON_CPP_PUBLIC_FLUTTER_TEXTURE_REGISTRAR_H_ | ||
|
|
||
| #include <stddef.h> | ||
| #include <stdint.h> | ||
|
|
||
| #include "flutter_export.h" | ||
|
|
||
| #if defined(__cplusplus) | ||
| extern "C" { | ||
| #endif | ||
|
|
||
| // Opaque reference to a texture registrar. | ||
| typedef struct FlutterDesktopTextureRegistrar* | ||
| FlutterDesktopTextureRegistrarRef; | ||
|
|
||
| // Constructs a pixel buffer object for the plugin side, providing | ||
| // height/width and buffer pointers. | ||
| typedef struct { | ||
| // Bitmap buffer pointer, currently only supports RGBA. | ||
| const uint8_t* buffer; | ||
| // Width of the pixel buffer. | ||
| size_t width; | ||
| // Height of the pixel buffer. | ||
| size_t height; | ||
| } PixelBuffer; | ||
|
|
||
| // The pixel buffer copy callback definition is provided to | ||
| // the Flutter engine to copy the texture. | ||
| typedef const PixelBuffer* (*FlutterTexutreCallback)(size_t width, | ||
cloudwebrtc marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| size_t height, | ||
| void* user_data); | ||
|
|
||
| // Registers a new texture with the Flutter engine and returns the texture ID, | ||
| // The engine will use the |texture_callback| | ||
| // function to copy the pixel buffer from the plugin caller. | ||
| FLUTTER_EXPORT int64_t FlutterDesktopRegisterExternalTexture( | ||
| FlutterDesktopTextureRegistrarRef texture_registrar, | ||
| FlutterTexutreCallback texture_callback, | ||
| void* user_data); | ||
|
|
||
| // Unregisters an existing texture from the Flutter engine for a |texture_id|. | ||
| FLUTTER_EXPORT bool FlutterDesktopUnregisterExternalTexture( | ||
cloudwebrtc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| FlutterDesktopTextureRegistrarRef texture_registrar, | ||
| int64_t texture_id); | ||
|
|
||
| // Marks that a new texture frame is available for a given |texture_id|. | ||
| FLUTTER_EXPORT bool FlutterDesktopMarkExternalTextureFrameAvailable( | ||
cloudwebrtc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| FlutterDesktopTextureRegistrarRef texture_registrar, | ||
| int64_t texture_id); | ||
|
|
||
| #if defined(__cplusplus) | ||
| } // extern "C" | ||
| #endif | ||
|
|
||
| #endif // FLUTTER_SHELL_PLATFORM_COMMON_CPP_PUBLIC_FLUTTER_TEXTURE_REGISTRAR_H_ | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.