Flutter Engine
The 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(ReactorGLES::Ref 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(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 return std::make_shared<TextureGLES>(reactor_, desc);
44}
45
46// |Allocator|
47ISize AllocatorGLES::GetMaxTextureSizeSupported() const {
48 return reactor_->GetProcTable().GetCapabilities()->max_texture_size;
49}
50
51} // namespace impeller
std::shared_ptr< ReactorGLES > Ref
Definition ref_ptr.h:256
A lightweight object that describes the attributes of a texture that can then used an allocator to cr...