Manages the lifetime of the on-screen and off-screen rendering contexts on iOS. On-screen contexts are used by Flutter for rendering into the surface. The lifecycle of this context may be tied to the lifecycle of the surface. On the other hand, the lifecycle of the off-screen context it tied to that of the platform view. This one object used to manage both context because GPU handles may need to be shared between the two context. To achieve this, context may need references to one another at creation time. This one object manages the creation, use and collection of both contexts in a client rendering API agnostic manner. More...
#include <ios_context.h>
Public Member Functions | |
virtual | ~IOSContext () |
Collects the context object. This must happen on the thread on which this object was created. More... | |
virtual IOSRenderingBackend | GetBackend () const |
Get the rendering backend used by this context. More... | |
virtual sk_sp< GrDirectContext > | CreateResourceContext ()=0 |
Create a resource context for use on the IO task runner. This resource context is used by Skia to upload texture to asynchronously and collect resources that are no longer needed on the render task runner. More... | |
virtual std::unique_ptr< GLContextResult > | MakeCurrent ()=0 |
When using client rendering APIs whose contexts need to be bound to a specific thread, the engine will call this method to give the on-screen context a chance to bind to the current thread. More... | |
virtual std::unique_ptr< Texture > | CreateExternalTexture (int64_t texture_id, fml::scoped_nsobject< NSObject< FlutterTexture >> texture)=0 |
Creates an external texture proxy of the appropriate client rendering API. More... | |
virtual sk_sp< GrDirectContext > | GetMainContext () const =0 |
Accessor for the Skia context associated with IOSSurfaces and the raster thread. More... | |
virtual std::shared_ptr< impeller::Context > | GetImpellerContext () const |
Static Public Member Functions | |
static std::unique_ptr< IOSContext > | Create (IOSRenderingAPI api, IOSRenderingBackend backend, const std::shared_ptr< const fml::SyncSwitch > &is_gpu_disabled_sync_switch) |
Create an iOS context object capable of creating the on-screen and off-screen GPU context for use by Skia. More... | |
Protected Member Functions | |
IOSContext () | |
Manages the lifetime of the on-screen and off-screen rendering contexts on iOS. On-screen contexts are used by Flutter for rendering into the surface. The lifecycle of this context may be tied to the lifecycle of the surface. On the other hand, the lifecycle of the off-screen context it tied to that of the platform view. This one object used to manage both context because GPU handles may need to be shared between the two context. To achieve this, context may need references to one another at creation time. This one object manages the creation, use and collection of both contexts in a client rendering API agnostic manner.
Definition at line 39 of file ios_context.h.
|
virtualdefault |
Collects the context object. This must happen on the thread on which this object was created.
|
explicitprotecteddefault |
|
static |
Create an iOS context object capable of creating the on-screen and off-screen GPU context for use by Skia.
In case the engine does not support the specified client rendering API, this a nullptr
may be returned.
[in] | api | A client rendering API supported by the engine/platform. |
[in] | backend | A client rendering backend supported by the engine/platform. |
nullptr
on failure. Definition at line 21 of file ios_context.mm.
References flutter::kImpeller, flutter::kMetal, flutter::kSkia, and flutter::kSoftware.
|
pure virtual |
Creates an external texture proxy of the appropriate client rendering API.
[in] | texture_id | The texture identifier |
[in] | texture | The texture |
Implemented in flutter::IOSContextSoftware.
|
pure virtual |
Create a resource context for use on the IO task runner. This resource context is used by Skia to upload texture to asynchronously and collect resources that are no longer needed on the render task runner.
nullptr
on failure. Implemented in flutter::IOSContextSoftware.
|
virtual |
Get the rendering backend used by this context.
Reimplemented in flutter::IOSContextMetalSkia, and flutter::IOSContextMetalImpeller.
Definition at line 52 of file ios_context.mm.
References flutter::kSkia.
|
virtual |
Definition at line 56 of file ios_context.mm.
|
pure virtual |
Accessor for the Skia context associated with IOSSurfaces and the raster thread.
There can be any number of resource contexts but this is the one context that will be used by surfaces to draw to the screen from the raster thread.
nullptr
on failure. Implemented in flutter::IOSContextMetalSkia, flutter::IOSContextMetalImpeller, and flutter::IOSContextSoftware.
|
pure virtual |
When using client rendering APIs whose contexts need to be bound to a specific thread, the engine will call this method to give the on-screen context a chance to bind to the current thread.
true
.false
.ResoruceMakeCurrent
method instead.Implemented in flutter::IOSContextSoftware.