13TEST(DescriptorPoolRecyclerVKTest, GetDescriptorPoolRecyclerCreatesNewPools) {
16 vk::UniqueDescriptorPool pool1 = context->GetDescriptorPoolRecycler()->Get();
17 vk::UniqueDescriptorPool pool2 = context->GetDescriptorPoolRecycler()->Get();
20 EXPECT_NE(pool1.get(), pool2.get());
25TEST(DescriptorPoolRecyclerVKTest, ReclaimMakesDescriptorPoolAvailable) {
34 std::shared_ptr<DescriptorPoolVK> pool =
35 context->GetDescriptorPoolRecycler()->GetDescriptorPool();
38 std::shared_ptr<std::vector<std::string>> called =
41 std::count(called->begin(), called->end(),
"vkCreateDescriptorPool"), 1u);
46TEST(DescriptorPoolRecyclerVKTest, ReclaimDropsDescriptorPoolIfSizeIsExceeded) {
51 std::vector<std::unique_ptr<DescriptorPoolVK>> pools;
52 for (
size_t i = 0u;
i < 33;
i++) {
53 std::unique_ptr<DescriptorPoolVK> pool =
54 std::make_unique<DescriptorPoolVK>(context);
55 pool->AllocateDescriptorSets({}, 0, *context);
56 pools.push_back(std::move(pool));
60 std::shared_ptr<std::vector<std::string>> called =
63 std::count(called->begin(), called->end(),
"vkCreateDescriptorPool"),
69 std::vector<std::shared_ptr<DescriptorPoolVK>> pools;
70 for (
size_t i = 0u;
i < 33;
i++) {
71 std::shared_ptr<DescriptorPoolVK> pool =
72 context->GetDescriptorPoolRecycler()->GetDescriptorPool();
73 pool->AllocateDescriptorSets({}, 0, *context);
74 pools.push_back(std::move(pool));
78 std::shared_ptr<std::vector<std::string>> called_twice =
82 std::count(called->begin(), called->end(),
"vkCreateDescriptorPool"),
88TEST(DescriptorPoolRecyclerVKTest, MultipleCommandBuffersShareDescriptorPool) {
91 std::shared_ptr<CommandBuffer> cmd_buffer_1 = context->CreateCommandBuffer();
92 std::shared_ptr<CommandBuffer> cmd_buffer_2 = context->CreateCommandBuffer();
100 context->DisposeThreadLocalCachedResources();
102 std::shared_ptr<CommandBuffer> cmd_buffer_3 = context->CreateCommandBuffer();
110TEST(DescriptorPoolRecyclerVKTest, DescriptorsAreRecycled) {
119 std::shared_ptr<DescriptorPoolVK> pool =
120 context->GetDescriptorPoolRecycler()->GetDescriptorPool();
121 pool->AllocateDescriptorSets({}, 0, *context);
123 std::shared_ptr<std::vector<std::string>> called =
126 std::count(called->begin(), called->end(),
"vkAllocateDescriptorSets"),
130 pool->AllocateDescriptorSets({}, 0, *context);
132 std::count(called->begin(), called->end(),
"vkAllocateDescriptorSets"),
std::shared_ptr< ContextVK > Build()
Create a Vulkan context with Vulkan functions mocked. The caller is given a chance to tinker on the s...