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