Flutter Engine
ios_context_metal.h
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 #ifndef FLUTTER_SHELL_PLATFORM_DARWIN_IOS_IOS_CONTEXT_METAL_H_
6 #define FLUTTER_SHELL_PLATFORM_DARWIN_IOS_IOS_CONTEXT_METAL_H_
7 
8 #include <Metal/Metal.h>
9 
10 #include "flutter/fml/macros.h"
11 #include "flutter/fml/platform/darwin/cf_utils.h"
12 #include "flutter/fml/platform/darwin/scoped_nsobject.h"
13 #import "flutter/shell/platform/darwin/ios/ios_context.h"
14 #include "third_party/skia/include/gpu/GrDirectContext.h"
15 
16 namespace flutter {
17 
18 class IOSContextMetal final : public IOSContext {
19  public:
21 
23 
25 
27 
29 
30  sk_sp<GrDirectContext> GetMainContext() const;
31 
32  sk_sp<GrDirectContext> GetResourceContext() const;
33 
34  private:
37  sk_sp<GrDirectContext> main_context_;
38  sk_sp<GrDirectContext> resource_context_;
40 
41  // |IOSContext|
42  sk_sp<GrDirectContext> CreateResourceContext() override;
43 
44  // |IOSContext|
45  std::unique_ptr<GLContextResult> MakeCurrent() override;
46 
47  // |IOSContext|
48  std::unique_ptr<Texture> CreateExternalTexture(
49  int64_t texture_id,
50  fml::scoped_nsobject<NSObject<FlutterTexture>> texture) override;
51 
52  FML_DISALLOW_COPY_AND_ASSIGN(IOSContextMetal);
53 };
54 
55 } // namespace flutter
56 
57 #endif // FLUTTER_SHELL_PLATFORM_DARWIN_IOS_IOS_CONTEXT_METAL_H_
sk_sp< GrDirectContext > GetResourceContext() const
Manages the lifetime of the on-screen and off-screen rendering contexts on iOS. On-screen contexts ar...
Definition: ios_context.h:33
fml::scoped_nsprotocol< id< MTLDevice > > GetDevice() const
fml::scoped_nsprotocol< id< MTLCommandQueue > > GetResourceCommandQueue() const
sk_sp< GrDirectContext > GetMainContext() const
fml::scoped_nsprotocol< id< MTLCommandQueue > > GetMainCommandQueue() const