Flutter Engine
 
Loading...
Searching...
No Matches
tracked_objects_vk.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
9
10namespace impeller {
11
13 const std::weak_ptr<const ContextVK>& context,
14 const std::shared_ptr<CommandPoolVK>& pool,
15 std::shared_ptr<DescriptorPoolVK> descriptor_pool,
16 std::unique_ptr<GPUProbe> probe)
17 : desc_pool_(std::move(descriptor_pool)), probe_(std::move(probe)) {
18 if (!pool) {
19 return;
20 }
21 auto buffer = pool->CreateCommandBuffer();
22 if (!buffer) {
23 return;
24 }
25 pool_ = pool;
26 buffer_ = std::move(buffer);
27 is_valid_ = true;
28 // Starting values were selected by looking at values from
29 // AiksTest.CanRenderMultipleBackdropBlurWithSingleBackdropId.
30 tracked_objects_.reserve(5);
31 tracked_buffers_.reserve(5);
32 tracked_textures_.reserve(5);
33}
34
36 if (!buffer_) {
37 return;
38 }
39 pool_->CollectCommandBuffer(std::move(buffer_));
40}
41
43 return is_valid_;
44}
45
46void TrackedObjectsVK::Track(const std::shared_ptr<SharedObjectVK>& object) {
47 if (!object || (!tracked_objects_.empty() &&
48 object.get() == tracked_objects_.back().get())) {
49 return;
50 }
51 tracked_objects_.emplace_back(object);
52}
53
55 const std::shared_ptr<const DeviceBuffer>& buffer) {
56 if (!buffer || (!tracked_buffers_.empty() &&
57 buffer.get() == tracked_buffers_.back().get())) {
58 return;
59 }
60 tracked_buffers_.emplace_back(buffer);
61}
62
64 const std::shared_ptr<const TextureSourceVK>& texture) {
65 if (!texture || (!tracked_textures_.empty() &&
66 texture.get() == tracked_textures_.back().get())) {
67 return;
68 }
69 tracked_textures_.emplace_back(texture);
70}
71
72vk::CommandBuffer TrackedObjectsVK::GetCommandBuffer() const {
73 return *buffer_;
74}
75
79
81 return *probe_.get();
82}
83
84} // namespace impeller
A per-frame descriptor pool. Descriptors from this pool don't need to be freed individually....
void Track(const std::shared_ptr< SharedObjectVK > &object)
DescriptorPoolVK & GetDescriptorPool()
vk::CommandBuffer GetCommandBuffer() const
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)
FlTexture * texture
Definition ref_ptr.h:261