Flutter Engine
ios_surface_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_SURFACE_METAL_H_
6 #define FLUTTER_SHELL_PLATFORM_DARWIN_IOS_IOS_SURFACE_METAL_H_
7 
8 #include "flutter/fml/macros.h"
9 #include "flutter/shell/gpu/gpu_surface_metal_delegate.h"
10 #import "flutter/shell/platform/darwin/ios/ios_surface.h"
11 #include "third_party/skia/include/gpu/mtl/GrMtlTypes.h"
12 
13 @class CAMetalLayer;
14 
15 namespace flutter {
16 
17 class SK_API_AVAILABLE_CA_METAL_LAYER IOSSurfaceMetal final : public IOSSurface,
19  public:
20  IOSSurfaceMetal(fml::scoped_nsobject<CAMetalLayer> layer, std::shared_ptr<IOSContext> context);
21 
22  // |IOSSurface|
23  ~IOSSurfaceMetal();
24 
25  private:
27  id<MTLDevice> device_;
28  id<MTLCommandQueue> command_queue_;
29  bool is_valid_ = false;
30 
31  // |IOSSurface|
32  bool IsValid() const override;
33 
34  // |IOSSurface|
35  void UpdateStorageSizeIfNecessary() override;
36 
37  // |IOSSurface|
38  std::unique_ptr<Surface> CreateGPUSurface(GrDirectContext* gr_context) override;
39 
40  // |GPUSurfaceMetalDelegate|
41  GPUCAMetalLayerHandle GetCAMetalLayer(const SkISize& frame_info) const override;
42 
43  // |GPUSurfaceMetalDelegate|
44  bool PresentDrawable(GrMTLHandle drawable) const override;
45 
46  // |GPUSurfaceMetalDelegate|
47  GPUMTLTextureInfo GetMTLTexture(const SkISize& frame_info) const override;
48 
49  // |GPUSurfaceMetalDelegate|
50  bool PresentTexture(GPUMTLTextureInfo texture) const override;
51 
52  // |GPUSurfaceMetalDelegate|
53  bool AllowsDrawingWhenGpuDisabled() const override;
54 
56 };
57 
58 } // namespace flutter
59 
60 #endif // FLUTTER_SHELL_PLATFORM_DARWIN_IOS_IOS_SURFACE_METAL_H_
G_BEGIN_DECLS FlTexture * texture
Interface implemented by all platform surfaces that can present a metal backing store to the "screen"...
static bool IsValid(double value)
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition: macros.h:27