Flutter Impeller
allocator_mtl.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_IMPELLER_RENDERER_BACKEND_METAL_ALLOCATOR_MTL_H_
6 #define FLUTTER_IMPELLER_RENDERER_BACKEND_METAL_ALLOCATOR_MTL_H_
7 
8 #include <Metal/Metal.h>
9 
10 #include "flutter/fml/macros.h"
12 
13 namespace impeller {
14 
15 class AllocatorMTL final : public Allocator {
16  public:
17  AllocatorMTL();
18 
19  // |Allocator|
20  ~AllocatorMTL() override;
21 
22  private:
23  friend class ContextMTL;
24 
25  id<MTLDevice> device_;
26  std::string allocator_label_;
27  bool supports_memoryless_targets_ = false;
28  bool supports_uma_ = false;
29  bool is_valid_ = false;
30  ISize max_texture_supported_;
31 
32  AllocatorMTL(id<MTLDevice> device, std::string label);
33 
34  // |Allocator|
35  bool IsValid() const;
36 
37  // |Allocator|
38  std::shared_ptr<DeviceBuffer> OnCreateBuffer(
39  const DeviceBufferDescriptor& desc) override;
40 
41  // |Allocator|
42  std::shared_ptr<Texture> OnCreateTexture(
43  const TextureDescriptor& desc) override;
44 
45  // |Allocator|
46  uint16_t MinimumBytesPerRow(PixelFormat format) const override;
47 
48  // |Allocator|
49  ISize GetMaxTextureSizeSupported() const override;
50 
51  AllocatorMTL(const AllocatorMTL&) = delete;
52 
53  AllocatorMTL& operator=(const AllocatorMTL&) = delete;
54 };
55 
56 } // namespace impeller
57 
58 #endif // FLUTTER_IMPELLER_RENDERER_BACKEND_METAL_ALLOCATOR_MTL_H_
impeller::AllocatorMTL
Definition: allocator_mtl.h:15
impeller::DeviceBufferDescriptor
Definition: device_buffer_descriptor.h:14
impeller::AllocatorMTL::AllocatorMTL
AllocatorMTL()
impeller::PixelFormat
PixelFormat
The Pixel formats supported by Impeller. The naming convention denotes the usage of the component,...
Definition: formats.h:100
impeller::TSize< int64_t >
impeller::Allocator
An object that allocates device memory.
Definition: allocator.h:22
impeller::AllocatorMTL::~AllocatorMTL
~AllocatorMTL() override
allocator.h
impeller::TextureDescriptor
A lightweight object that describes the attributes of a texture that can then used an allocator to cr...
Definition: texture_descriptor.h:37
impeller::ContextMTL
Definition: context_mtl.h:35
impeller
Definition: aiks_blur_unittests.cc:20