Closed bbrto21 closed 2 years ago
Be sure to keep in mind that:
- If your Dart entrypoint invokes
runApp()
to run a Flutter app, then your Flutter app behaves as if it were running in a window of zero size until thisFlutterEngine
is attached to aFlutterActivity
,FlutterFragment
, orFlutterView
.- To stop executing and clear resources, obtain your
FlutterEngine
from theFlutterEngineCache
and destroy theFlutterEngine
withFlutterEngine.destroy()
.- A pre-warmed
FlutterEngine
executes Dart code independent from aFlutterActivity
, which allows such aFlutterEngine
to be used to execute arbitrary Dart code at any moment.
This page might also be helpful: https://docs.flutter.dev/development/add-to-app/performance
Here is my attempt: https://github.com/flutter-tizen/engine/compare/flutter-3.0.0-tizen...swift-kim:engine:evas-vsync-waiter
I managed to remove all renderer-related checks from FlutterTizenEngine::RunEngine
. When I launched an app however, the engine tried to initialize a rendering surface during FlutterEngineRunInitialized
and failed.
[WARNING:flutter/common/graphics/persistent_cache.cc(283)] Could not acquire the persistent cache directory. Caching of GPU resources on disk is disabled.
[ERROR:flutter/shell/gpu/gpu_surface_gl.cc(42)] Could not make the context current to set up the Gr context.
[ERROR:flutter/shell/gpu/gpu_surface_gl.cc(80)] Could not make the context current to set up the Gr context.
[ERROR:flutter/shell/common/platform_view.cc(76)] Failed to create platform view rendering surface
A surface must be created (even if it has a size of zero) before the engine is run, but it's not possible for our case because the renderer type is decided right before a view is created. Will moving the renderer_type
property from FlutterDesktopWindowProperties
to FlutterDesktopEngineProperties
help this situation?
Will moving the renderer_type property from FlutterDesktopWindowProperties to FlutterDesktopEngineProperties help this situation?
I think it will help.
I guess a valid renderer must exist before running the engine... therefore, it seems necessary to create a renderer before running the engine using something like a dummy view
. so, I think it's a good alternative to solve this issue.
I tried to create a dummy view and use it to run the engine, and replace it with a view that would actually be used later. but it didn't work well. I think we need to find a new way.... :(
We couldn't find a way to implement this feature. Please reopen if there's any update.
Unfortunately, if you run the engine before you set it on the view, nothing will be shown on the device's screen.
Below is a brief scenario.
If this is possible, this means the engine can be pre-warmed. I think this can be used for improving app launch times, also this can be used for caching pre-warmed engines.