14TEST(CommandPoolRecyclerVKTest, GetsACommandPoolPerThread) {
23 std::shared_ptr<CommandPoolVK> pool1;
24 std::shared_ptr<CommandPoolVK> pool2;
28 [&]() { pool1 = context->GetCommandPoolRecycler()->Get(); });
31 [&]() { pool2 = context->GetCommandPoolRecycler()->Get(); });
37 EXPECT_NE(pool1, pool2);
76TEST(CommandPoolRecyclerVKTest, ReclaimMakesCommandPoolAvailable) {
81 auto const recycler = context->GetCommandPoolRecycler();
82 auto const pool = recycler->Get();
92 auto rattle = DeathRattle([&waiter]() { waiter.Signal(); });
100 std::thread thread([&]() {
101 auto const pool = context->GetCommandPoolRecycler()->Get();
102 EXPECT_NE(
pool.get(),
nullptr);
109 EXPECT_EQ(std::count(called->begin(), called->end(),
"vkCreateCommandPool"),
115TEST(CommandPoolRecyclerVKTest, CommandBuffersAreRecycled) {
120 auto const recycler = context->GetCommandPoolRecycler();
121 auto pool = recycler->Get();
124 pool->CollectCommandBuffer(std::move(
buffer));
131 for (
auto i = 0u; i < 2u; i++) {
133 auto rattle = DeathRattle([&waiter]() { waiter.Signal(); });
144 auto const recycler = context->GetCommandPoolRecycler();
145 auto pool = recycler->Get();
148 pool->CollectCommandBuffer(std::move(
buffer));
156 EXPECT_EQ(std::count(called->begin(), called->end(),
"vkCreateCommandPool"),
159 std::count(called->begin(), called->end(),
"vkAllocateCommandBuffers"),
std::shared_ptr< ContextVK > Build()
Create a Vulkan context with Vulkan functions mocked. The caller is given a chance to tinker on the s...
static const uint8_t buffer[]