| Flutter Impeller |

tracked_objects_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 #ifndef FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_TRACKED_OBJECTS_VK_H_
6 #define FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_TRACKED_OBJECTS_VK_H_
7
8 #include <memory>
9
10 #include "impeller/renderer/backend/vulkan/context_vk.h"
11 #include "impeller/renderer/backend/vulkan/descriptor_pool_vk.h"
12 #include "impeller/renderer/backend/vulkan/gpu_tracer_vk.h"
13 #include "impeller/renderer/backend/vulkan/texture_source_vk.h"
14
15 namespace impeller {
16
17 /// @brief A per-frame object used to track resource lifetimes and allocate
18 /// command buffers and descriptor sets.
19 class TrackedObjectsVK {
20 public:
21 explicit TrackedObjectsVK(const std::weak_ptr<const ContextVK>& context,
22 const std::shared_ptr<CommandPoolVK>& pool,
23 std::shared_ptr<DescriptorPoolVK> descriptor_pool,
24 std::unique_ptr<GPUProbe> probe);
25
26 ~TrackedObjectsVK();
27
28 bool IsValid() const;
29
30 void Track(const std::shared_ptr<SharedObjectVK>& object);
31
32 void Track(const std::shared_ptr<const DeviceBuffer>& buffer);
33
34 void Track(const std::shared_ptr<const TextureSourceVK>& texture);
35
36 vk::CommandBuffer GetCommandBuffer() const;
37
38 DescriptorPoolVK& GetDescriptorPool();
39
40 GPUProbe& GetGPUProbe() const;
41
42 private:
43 std::shared_ptr<DescriptorPoolVK> desc_pool_;
44 // `shared_ptr` since command buffers have a link to the command pool.
45 std::shared_ptr<CommandPoolVK> pool_;
46 vk::UniqueCommandBuffer buffer_;
47 std::vector<std::shared_ptr<SharedObjectVK>> tracked_objects_;
48 std::vector<std::shared_ptr<const DeviceBuffer>> tracked_buffers_;
49 std::vector<std::shared_ptr<const TextureSourceVK>> tracked_textures_;
50 std::unique_ptr<GPUProbe> probe_;
51 bool is_valid_ = false;
52
53 TrackedObjectsVK(const TrackedObjectsVK&) = delete;
54
55 TrackedObjectsVK& operator=(const TrackedObjectsVK&) = delete;
56 };
57
58 } // namespace impeller
59
60 #endif // FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_TRACKED_OBJECTS_VK_H_
impeller::DescriptorPoolVK
A per-frame descriptor pool. Descriptors from this pool don't need to be freed individually....
Definition: descriptor_pool_vk.h:27
impeller::GPUProbe
Definition: gpu_tracer_vk.h:101
impeller::TrackedObjectsVK
A per-frame object used to track resource lifetimes and allocate command buffers and descriptor sets.
Definition: tracked_objects_vk.h:19
impeller::TrackedObjectsVK::Track
void Track(const std::shared_ptr< SharedObjectVK > &object)
Definition: tracked_objects_vk.cc:46
impeller::TrackedObjectsVK::GetGPUProbe
GPUProbe & GetGPUProbe() const
Definition: tracked_objects_vk.cc:80
impeller::TrackedObjectsVK::GetDescriptorPool
DescriptorPoolVK & GetDescriptorPool()
Definition: tracked_objects_vk.cc:76
impeller::TrackedObjectsVK::~TrackedObjectsVK
~TrackedObjectsVK()
Definition: tracked_objects_vk.cc:35
impeller::TrackedObjectsVK::IsValid
bool IsValid() const
Definition: tracked_objects_vk.cc:42
impeller::TrackedObjectsVK::GetCommandBuffer
vk::CommandBuffer GetCommandBuffer() const
Definition: tracked_objects_vk.cc:72
impeller::TrackedObjectsVK::TrackedObjectsVK
TrackedObjectsVK(const std::weak_ptr< const ContextVK > &context, const std::shared_ptr< CommandPoolVK > &pool, std::shared_ptr< DescriptorPoolVK > descriptor_pool, std::unique_ptr< GPUProbe > probe)
Definition: tracked_objects_vk.cc:12
context_vk.h
descriptor_pool_vk.h
gpu_tracer_vk.h
impeller
Definition: allocation.cc:12
texture_source_vk.h