|
|
@ -18,7 +18,6 @@ namespace Vulkan {
|
|
|
|
// Prefer small grow rates to avoid saturating the descriptor pool with barely used pipelines
|
|
|
|
// Prefer small grow rates to avoid saturating the descriptor pool with barely used pipelines
|
|
|
|
constexpr size_t SETS_GROW_RATE = 16;
|
|
|
|
constexpr size_t SETS_GROW_RATE = 16;
|
|
|
|
constexpr s32 SCORE_THRESHOLD = 3;
|
|
|
|
constexpr s32 SCORE_THRESHOLD = 3;
|
|
|
|
constexpr u32 SETS_PER_POOL = 64;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct DescriptorBank {
|
|
|
|
struct DescriptorBank {
|
|
|
|
DescriptorBankInfo info;
|
|
|
|
DescriptorBankInfo info;
|
|
|
@ -58,11 +57,12 @@ static DescriptorBankInfo MakeBankInfo(std::span<const Shader::Info> infos) {
|
|
|
|
static void AllocatePool(const Device& device, DescriptorBank& bank) {
|
|
|
|
static void AllocatePool(const Device& device, DescriptorBank& bank) {
|
|
|
|
std::array<VkDescriptorPoolSize, 6> pool_sizes;
|
|
|
|
std::array<VkDescriptorPoolSize, 6> pool_sizes;
|
|
|
|
size_t pool_cursor{};
|
|
|
|
size_t pool_cursor{};
|
|
|
|
|
|
|
|
const u32 sets_per_pool = device.GetSetsPerPool();
|
|
|
|
const auto add = [&](VkDescriptorType type, u32 count) {
|
|
|
|
const auto add = [&](VkDescriptorType type, u32 count) {
|
|
|
|
if (count > 0) {
|
|
|
|
if (count > 0) {
|
|
|
|
pool_sizes[pool_cursor++] = {
|
|
|
|
pool_sizes[pool_cursor++] = {
|
|
|
|
.type = type,
|
|
|
|
.type = type,
|
|
|
|
.descriptorCount = count * SETS_PER_POOL,
|
|
|
|
.descriptorCount = count * sets_per_pool,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -77,7 +77,7 @@ static void AllocatePool(const Device& device, DescriptorBank& bank) {
|
|
|
|
.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO,
|
|
|
|
.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO,
|
|
|
|
.pNext = nullptr,
|
|
|
|
.pNext = nullptr,
|
|
|
|
.flags = VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT,
|
|
|
|
.flags = VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT,
|
|
|
|
.maxSets = SETS_PER_POOL,
|
|
|
|
.maxSets = sets_per_pool,
|
|
|
|
.poolSizeCount = static_cast<u32>(pool_cursor),
|
|
|
|
.poolSizeCount = static_cast<u32>(pool_cursor),
|
|
|
|
.pPoolSizes = std::data(pool_sizes),
|
|
|
|
.pPoolSizes = std::data(pool_sizes),
|
|
|
|
}));
|
|
|
|
}));
|
|
|
|