Flutter Impeller
allocator_vk.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 "flutter/fml/macros.h"
8
#include "flutter/fml/memory/ref_ptr.h"
9
#include "
impeller/core/allocator.h
"
10
#include "
impeller/renderer/backend/vulkan/context_vk.h
"
11
#include "
impeller/renderer/backend/vulkan/device_buffer_vk.h
"
12
#include "
impeller/renderer/backend/vulkan/device_holder.h
"
13
#include "
impeller/renderer/backend/vulkan/vk.h
"
14
15
#include <array>
16
#include <memory>
17
18
namespace
impeller
{
19
20
class
AllocatorVK
final :
public
Allocator
{
21
public
:
22
// |Allocator|
23
~AllocatorVK
()
override
;
24
25
private
:
26
friend
class
ContextVK
;
27
28
UniqueAllocatorVMA
allocator_;
29
UniquePoolVMA
staging_buffer_pool_;
30
std::weak_ptr<Context> context_;
31
std::weak_ptr<DeviceHolder> device_holder_;
32
ISize
max_texture_size_;
33
bool
is_valid_ =
false
;
34
bool
supports_memoryless_textures_ =
false
;
35
// TODO(jonahwilliams): figure out why CI can't create these buffer pools.
36
bool
created_buffer_pool_ =
true
;
37
uint32_t frame_count_ = 0;
38
std::thread::id raster_thread_id_;
39
40
AllocatorVK
(std::weak_ptr<Context> context,
41
uint32_t vulkan_api_version,
42
const
vk::PhysicalDevice& physical_device,
43
const
std::shared_ptr<DeviceHolder>& device_holder,
44
const
vk::Instance& instance,
45
const
CapabilitiesVK
& capabilities);
46
47
// |Allocator|
48
bool
IsValid()
const
;
49
50
// |Allocator|
51
void
DidAcquireSurfaceFrame()
override
;
52
53
// |Allocator|
54
std::shared_ptr<DeviceBuffer> OnCreateBuffer(
55
const
DeviceBufferDescriptor
& desc)
override
;
56
57
// |Allocator|
58
std::shared_ptr<Texture> OnCreateTexture(
59
const
TextureDescriptor
& desc)
override
;
60
61
// |Allocator|
62
ISize
GetMaxTextureSizeSupported()
const override
;
63
64
FML_DISALLOW_COPY_AND_ASSIGN(
AllocatorVK
);
65
};
66
67
}
// namespace impeller
device_holder.h
impeller::DeviceBufferDescriptor
Definition:
device_buffer_descriptor.h:13
impeller::UniquePoolVMA
fml::UniqueObject< PoolVMA, PoolVMATraits > UniquePoolVMA
Definition:
vma.h:62
impeller::AllocatorVK::~AllocatorVK
~AllocatorVK() override
vk.h
impeller::TSize< int64_t >
impeller::AllocatorVK
Definition:
allocator_vk.h:20
impeller::Allocator
An object that allocates device memory.
Definition:
allocator.h:25
impeller::CapabilitiesVK
The Vulkan layers and extensions wrangler.
Definition:
capabilities_vk.h:30
impeller::ContextVK
Definition:
context_vk.h:36
impeller::UniqueAllocatorVMA
fml::UniqueObject< VmaAllocator, AllocatorVMATraits > UniqueAllocatorVMA
Definition:
vma.h:30
allocator.h
device_buffer_vk.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
context_vk.h
impeller
Definition:
aiks_context.cc:10
impeller
renderer
backend
vulkan
allocator_vk.h
Generated by
1.8.17