5#include "flutter/testing/testing.h"
15TEST(DescriptorPoolRecyclerVKTest, GetDescriptorPoolRecyclerCreatesNewPools) {
18 auto const pool1 = context->GetDescriptorPoolRecycler()->Get();
19 auto const pool2 = context->GetDescriptorPoolRecycler()->Get();
22 EXPECT_NE(pool1.get(), pool2.get());
27TEST(DescriptorPoolRecyclerVKTest, ReclaimMakesDescriptorPoolAvailable) {
33 pool.AllocateDescriptorSets({}, *context);
42 for (
auto i = 0u;
i < 2;
i++) {
50 context->GetResourceManager(), std::move(rattle));
55 auto const pool = context->GetDescriptorPoolRecycler()->Get();
60 std::count(called->begin(), called->end(),
"vkCreateDescriptorPool"), 1u);
65TEST(DescriptorPoolRecyclerVKTest, ReclaimDropsDescriptorPoolIfSizeIsExceeded) {
70 std::vector<std::unique_ptr<DescriptorPoolVK>> pools;
71 for (
auto i = 0u;
i < 33;
i++) {
72 auto pool = std::make_unique<DescriptorPoolVK>(context);
73 pool->AllocateDescriptorSets({}, *context);
74 pools.push_back(std::move(
pool));
79 for (
auto i = 0u;
i < 2;
i++) {
84 context->GetResourceManager(), std::move(rattle));
91 std::count(called->begin(), called->end(),
"vkCreateDescriptorPool"),
93 EXPECT_EQ(
std::count(called->begin(), called->end(),
"vkResetDescriptorPool"),
99 std::vector<std::unique_ptr<DescriptorPoolVK>> pools;
100 for (
auto i = 0u;
i < 33;
i++) {
101 auto pool = std::make_unique<DescriptorPoolVK>(context);
102 pool->AllocateDescriptorSets({}, *context);
103 pools.push_back(std::move(
pool));
107 for (
auto i = 0u;
i < 2;
i++) {
112 context->GetResourceManager(), std::move(rattle));
120 std::count(called->begin(), called->end(),
"vkCreateDescriptorPool"),
static SkString resource(SkPDFResourceType type, int index)
Wraps a closure that is invoked in the destructor unless released by the caller.
A per-frame descriptor pool. Descriptors from this pool don't need to be freed individually....
A unique handle to a resource which will be reclaimed by the specified resource manager.
std::shared_ptr< ContextVK > Build()
Create a Vulkan context with Vulkan functions mocked. The caller is given a chance to tinker on the s...
std::shared_ptr< std::vector< std::string > > GetMockVulkanFunctions(VkDevice device)
TEST(AiksCanvasTest, EmptyCullRect)