Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | List of all members
flutter::IOSContextMetalSkia Class Referencefinal

#include <ios_context_metal_skia.h>

Inheritance diagram for flutter::IOSContextMetalSkia:
flutter::IOSContext

Public Member Functions

 IOSContextMetalSkia (MsaaSampleCount msaa_samples)
 
 ~IOSContextMetalSkia ()
 
fml::scoped_nsobject< FlutterDarwinContextMetalSkiaGetDarwinContext () const
 
IOSRenderingBackend GetBackend () const override
 Get the rendering backend used by this context.
 
sk_sp< GrDirectContextGetMainContext () const override
 Accessor for the Skia context associated with IOSSurfaces and the raster thread.
 
sk_sp< GrDirectContextGetResourceContext () const
 
- Public Member Functions inherited from flutter::IOSContext
virtual ~IOSContext ()
 Collects the context object. This must happen on the thread on which this object was created.
 
virtual std::shared_ptr< impeller::ContextGetImpellerContext () const
 
MsaaSampleCount GetMsaaSampleCount () const
 

Private Member Functions

sk_sp< GrDirectContextCreateResourceContext () override
 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.
 
std::unique_ptr< GLContextResultMakeCurrent () override
 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.
 
std::unique_ptr< TextureCreateExternalTexture (int64_t texture_id, fml::scoped_nsobject< NSObject< FlutterTexture > > texture) override
 Creates an external texture proxy of the appropriate client rendering API.
 

Additional Inherited Members

- Static Public Member Functions inherited from flutter::IOSContext
static std::unique_ptr< IOSContextCreate (IOSRenderingAPI api, IOSRenderingBackend backend, MsaaSampleCount msaa_samples, 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.
 
- Protected Member Functions inherited from flutter::IOSContext
 IOSContext (MsaaSampleCount msaa_samples)
 

Detailed Description

Definition at line 19 of file ios_context_metal_skia.h.

Constructor & Destructor Documentation

◆ IOSContextMetalSkia()

flutter::IOSContextMetalSkia::IOSContextMetalSkia ( MsaaSampleCount  msaa_samples)
explicit

Definition at line 17 of file ios_context_metal_skia.mm.

17 : IOSContext(msaa_samples) {
19 [[FlutterDarwinContextMetalSkia alloc] initWithDefaultMTLDevice]};
20}
IOSContext(MsaaSampleCount msaa_samples)

◆ ~IOSContextMetalSkia()

flutter::IOSContextMetalSkia::~IOSContextMetalSkia ( )
default

Member Function Documentation

◆ CreateExternalTexture()

std::unique_ptr< Texture > flutter::IOSContextMetalSkia::CreateExternalTexture ( int64_t  texture_id,
fml::scoped_nsobject< NSObject< FlutterTexture > >  texture 
)
overrideprivatevirtual

Creates an external texture proxy of the appropriate client rendering API.

Parameters
[in]texture_idThe texture identifier
[in]textureThe texture
Returns
The texture proxy if the rendering backend supports embedder provided external textures.

Implements flutter::IOSContext.

Definition at line 52 of file ios_context_metal_skia.mm.

54 {
55 return std::make_unique<IOSExternalTextureMetal>(
57 [darwin_context_metal_ createExternalTextureWithIdentifier:texture_id texture:texture]});
58}
FlTexture * texture
int64_t texture_id

◆ CreateResourceContext()

sk_sp< GrDirectContext > flutter::IOSContextMetalSkia::CreateResourceContext ( )
overrideprivatevirtual

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.

Attention
Client rendering APIs for which a GrDirectContext cannot be realized (software rendering), this method will always return null.
Returns
A non-null Skia context on success. nullptr on failure.

Implements flutter::IOSContext.

Definition at line 41 of file ios_context_metal_skia.mm.

41 {
42 return darwin_context_metal_.get().resourceContext;
43}
T get() const __attribute((ns_returns_not_retained))

◆ GetBackend()

IOSRenderingBackend flutter::IOSContextMetalSkia::GetBackend ( ) const
overridevirtual

Get the rendering backend used by this context.

Returns
The rendering backend.

Reimplemented from flutter::IOSContext.

Definition at line 28 of file ios_context_metal_skia.mm.

◆ GetDarwinContext()

fml::scoped_nsobject< FlutterDarwinContextMetalSkia > flutter::IOSContextMetalSkia::GetDarwinContext ( ) const

Definition at line 24 of file ios_context_metal_skia.mm.

24 {
25 return darwin_context_metal_;
26}

◆ GetMainContext()

sk_sp< GrDirectContext > flutter::IOSContextMetalSkia::GetMainContext ( ) const
overridevirtual

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.

Returns
nullptr on failure.
Attention
The software context doesn't have a Skia context, so this value will be nullptr.
See also
For contexts which are used for offscreen work like loading textures see IOSContext::CreateResourceContext.

Implements flutter::IOSContext.

Definition at line 32 of file ios_context_metal_skia.mm.

32 {
33 return darwin_context_metal_.get().mainContext;
34}

◆ GetResourceContext()

sk_sp< GrDirectContext > flutter::IOSContextMetalSkia::GetResourceContext ( ) const

Definition at line 36 of file ios_context_metal_skia.mm.

36 {
37 return darwin_context_metal_.get().resourceContext;
38}

◆ MakeCurrent()

std::unique_ptr< GLContextResult > flutter::IOSContextMetalSkia::MakeCurrent ( )
overrideprivatevirtual

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.

Attention
Client rendering APIs that have no-concept of thread local bindings (anything that is not OpenGL) will always return true.
Client rendering APIs for which a GrDirectContext cannot be created (software rendering) will always return false.
This binds the on-screen context to the current thread. To bind the off-screen context to the thread, use the ResoruceMakeCurrent method instead.
Only one context may be bound to a thread at any given time. Making a binding on a thread, clears the old binding.
Returns
A GLContextResult that represents the result of the method. The GetResult() returns a bool that indicates If the on-screen context could be bound to the current thread.

Implements flutter::IOSContext.

Definition at line 46 of file ios_context_metal_skia.mm.

46 {
47 // This only makes sense for context that need to be bound to a specific thread.
48 return std::make_unique<GLContextDefaultResult>(true);
49}

The documentation for this class was generated from the following files: