Flutter Impeller
allocator_gles.cc
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 
6 
7 #include <memory>
8 
10 #include "impeller/base/config.h"
13 
14 namespace impeller {
15 
16 AllocatorGLES::AllocatorGLES(ReactorGLES::Ref reactor)
17  : reactor_(std::move(reactor)), is_valid_(true) {}
18 
19 // |Allocator|
21 
22 // |Allocator|
23 bool AllocatorGLES::IsValid() const {
24  return is_valid_;
25 }
26 
27 // |Allocator|
28 std::shared_ptr<DeviceBuffer> AllocatorGLES::OnCreateBuffer(
29  const DeviceBufferDescriptor& desc) {
30  auto backing_store = std::make_shared<Allocation>();
31  if (!backing_store->Truncate(desc.size)) {
32  return nullptr;
33  }
34  return std::make_shared<DeviceBufferGLES>(desc, //
35  reactor_, //
36  std::move(backing_store) //
37  );
38 }
39 
40 // |Allocator|
41 std::shared_ptr<Texture> AllocatorGLES::OnCreateTexture(
42  const TextureDescriptor& desc) {
43  return std::make_shared<TextureGLES>(reactor_, desc);
44 }
45 
46 // |Allocator|
47 ISize AllocatorGLES::GetMaxTextureSizeSupported() const {
48  return reactor_->GetProcTable().GetCapabilities()->max_texture_size;
49 }
50 
51 } // namespace impeller
allocation.h
impeller::ReactorGLES::Ref
std::shared_ptr< ReactorGLES > Ref
Definition: reactor_gles.h:87
texture_gles.h
device_buffer_gles.h
impeller::ISize
TSize< int64_t > ISize
Definition: size.h:138
allocator_gles.h
std
Definition: comparable.h:95
impeller::AllocatorGLES::~AllocatorGLES
~AllocatorGLES() override
config.h
impeller
Definition: aiks_blur_unittests.cc:20