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/graphics/FlutterDarwinContextMetal.h"
14 #import "flutter/shell/platform/darwin/ios/ios_context.h"
15 #include "third_party/skia/include/gpu/GrDirectContext.h"
16 
17 namespace flutter {
18 
19 class IOSContextMetal final : public IOSContext {
20  public:
22 
24 
26 
27  // |IOSContext|
28  sk_sp<GrDirectContext> GetMainContext() const override;
29 
30  sk_sp<GrDirectContext> GetResourceContext() const;
31 
32  private:
34  fml::scoped_nsprotocol<id<MTLCommandQueue>> main_command_queue_;
36 
37  // |IOSContext|
38  sk_sp<GrDirectContext> CreateResourceContext() override;
39 
40  // |IOSContext|
41  std::unique_ptr<GLContextResult> MakeCurrent() override;
42 
43  // |IOSContext|
44  std::unique_ptr<Texture> CreateExternalTexture(
45  int64_t texture_id,
46  fml::scoped_nsobject<NSObject<FlutterTexture>> texture) override;
47 
48  FML_DISALLOW_COPY_AND_ASSIGN(IOSContextMetal);
49 };
50 
51 } // namespace flutter
52 
53 #endif // FLUTTER_SHELL_PLATFORM_DARWIN_IOS_IOS_CONTEXT_METAL_H_
sk_sp< GrDirectContext > GetResourceContext() const
G_BEGIN_DECLS FlTexture * texture
int64_t texture_id
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_nsobject< FlutterDarwinContextMetal > GetDarwinContext() const
sk_sp< GrDirectContext > GetMainContext() const override
Accessor for the Skia context associated with IOSSurfaces and the raster thread.