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