Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
impeller::DescriptorPoolVK Class Reference

A per-frame descriptor pool. Descriptors from this pool don't need to be freed individually. Instead, the pool must be collected after all the descriptors allocated from it are done being used. More...

#include <descriptor_pool_vk.h>

Public Member Functions

 DescriptorPoolVK (std::weak_ptr< const ContextVK > context)
 
 ~DescriptorPoolVK ()
 
fml::StatusOr< vk::DescriptorSet > AllocateDescriptorSets (const vk::DescriptorSetLayout &layout, const ContextVK &context_vk)
 

Detailed Description

A per-frame descriptor pool. Descriptors from this pool don't need to be freed individually. Instead, the pool must be collected after all the descriptors allocated from it are done being used.

The pool or it's descriptors may not be accessed from multiple threads.

Encoders create pools as necessary as they have the same threading and lifecycle restrictions.

Definition at line 27 of file descriptor_pool_vk.h.

Constructor & Destructor Documentation

◆ DescriptorPoolVK()

impeller::DescriptorPoolVK::DescriptorPoolVK ( std::weak_ptr< const ContextVK context)
explicit

Definition at line 67 of file descriptor_pool_vk.cc.

68 : context_(std::move(context)) {}

◆ ~DescriptorPoolVK()

impeller::DescriptorPoolVK::~DescriptorPoolVK ( )

Definition at line 70 of file descriptor_pool_vk.cc.

70 {
71 if (pools_.empty()) {
72 return;
73 }
74
75 auto const context = context_.lock();
76 if (!context) {
77 return;
78 }
79 auto const recycler = context->GetDescriptorPoolRecycler();
80 if (!recycler) {
81 return;
82 }
83
84 for (auto i = 0u; i < pools_.size(); i++) {
85 auto reset_pool_when_dropped =
86 BackgroundDescriptorPoolVK(std::move(pools_[i]), recycler);
87
88 UniqueResourceVKT<BackgroundDescriptorPoolVK> pool(
89 context->GetResourceManager(), std::move(reset_pool_when_dropped));
90 }
91 pools_.clear();
92}
AutoreleasePool pool

Member Function Documentation

◆ AllocateDescriptorSets()

fml::StatusOr< vk::DescriptorSet > impeller::DescriptorPoolVK::AllocateDescriptorSets ( const vk::DescriptorSetLayout &  layout,
const ContextVK context_vk 
)

Definition at line 94 of file descriptor_pool_vk.cc.

96 {
97 if (pools_.empty()) {
98 CreateNewPool(context_vk);
99 }
100
101 vk::DescriptorSetAllocateInfo set_info;
102 set_info.setDescriptorPool(pools_.back().get());
103 set_info.setPSetLayouts(&layout);
104 set_info.setDescriptorSetCount(1);
105
106 vk::DescriptorSet set;
107 auto result = context_vk.GetDevice().allocateDescriptorSets(&set_info, &set);
108 if (result == vk::Result::eErrorOutOfPoolMemory) {
109 // If the pool ran out of memory, we need to create a new pool.
110 CreateNewPool(context_vk);
111 set_info.setDescriptorPool(pools_.back().get());
112 result = context_vk.GetDevice().allocateDescriptorSets(&set_info, &set);
113 }
114
115 if (result != vk::Result::eSuccess) {
116 VALIDATION_LOG << "Could not allocate descriptor sets: "
117 << vk::to_string(result);
119 }
120 return set;
121}
GAsyncResult * result
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not set
Definition switches.h:76
#define VALIDATION_LOG
Definition validation.h:73

The documentation for this class was generated from the following files: