Flutter Engine
 
Loading...
Searching...
No Matches
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
13
14namespace impeller {
15
16AllocatorGLES::AllocatorGLES(std::shared_ptr<ReactorGLES> reactor)
17 : reactor_(std::move(reactor)), is_valid_(true) {}
18
19// |Allocator|
20AllocatorGLES::~AllocatorGLES() = default;
21
22// |Allocator|
23bool AllocatorGLES::IsValid() const {
24 return is_valid_;
25}
26
27// |Allocator|
28std::shared_ptr<DeviceBuffer> AllocatorGLES::OnCreateBuffer(
29 const DeviceBufferDescriptor& desc) {
30 auto backing_store = std::make_shared<Allocation>();
31 if (!backing_store->Truncate(Bytes{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|
41std::shared_ptr<Texture> AllocatorGLES::OnCreateTexture(
42 const TextureDescriptor& desc,
43 bool threadsafe) {
44 return std::make_shared<TextureGLES>(reactor_, desc, threadsafe);
45}
46
47// |Allocator|
48ISize AllocatorGLES::GetMaxTextureSizeSupported() const {
49 return reactor_->GetProcTable().GetCapabilities()->max_texture_size;
50}
51
52} // namespace impeller
ISize64 ISize
Definition size.h:162
Definition ref_ptr.h:261