Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
ios_context_metal_skia.mm
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#import "flutter/shell/platform/darwin/ios/ios_context_metal_skia.h"
6
7#include "flutter/common/graphics/persistent_cache.h"
8#include "flutter/fml/logging.h"
9#import "flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalSkia.h"
10#import "flutter/shell/platform/darwin/ios/ios_external_texture_metal.h"
12
14
15namespace flutter {
16
19 [[FlutterDarwinContextMetalSkia alloc] initWithDefaultMTLDevice]};
20}
21
23
27
31
33 return darwin_context_metal_.get().mainContext;
34}
35
37 return darwin_context_metal_.get().resourceContext;
38}
39
40// |IOSContext|
42 return darwin_context_metal_.get().resourceContext;
43}
44
45// |IOSContext|
46std::unique_ptr<GLContextResult> IOSContextMetalSkia::MakeCurrent() {
47 // This only makes sense for context that need to be bound to a specific thread.
48 return std::make_unique<GLContextDefaultResult>(true);
49}
50
51// |IOSContext|
53 int64_t texture_id,
54 fml::scoped_nsobject<NSObject<FlutterTexture>> texture) {
55 return std::make_unique<IOSExternalTextureMetal>(
57 [darwin_context_metal_ createExternalTextureWithIdentifier:texture_id texture:texture]});
58}
59
60} // namespace flutter
IOSContextMetalSkia(MsaaSampleCount msaa_samples)
IOSRenderingBackend GetBackend() const override
Get the rendering backend used by this context.
sk_sp< GrDirectContext > CreateResourceContext() override
Create a resource context for use on the IO task runner. This resource context is used by Skia to upl...
std::unique_ptr< GLContextResult > MakeCurrent() override
When using client rendering APIs whose contexts need to be bound to a specific thread,...
sk_sp< GrDirectContext > GetResourceContext() const
std::unique_ptr< Texture > CreateExternalTexture(int64_t texture_id, fml::scoped_nsobject< NSObject< FlutterTexture > > texture) override
Creates an external texture proxy of the appropriate client rendering API.
sk_sp< GrDirectContext > GetMainContext() const override
Accessor for the Skia context associated with IOSSurfaces and the raster thread.
fml::scoped_nsobject< FlutterDarwinContextMetalSkia > GetDarwinContext() const
Manages the lifetime of the on-screen and off-screen rendering contexts on iOS. On-screen contexts ar...
Definition ios_context.h:40
T get() const __attribute((ns_returns_not_retained))
FlTexture * texture
MsaaSampleCount
int64_t texture_id