VulkanRenderer: Fix descriptor pool release
This commit is contained in:
parent
a7235ab02d
commit
49a2cda0a1
|
|
@ -53,7 +53,7 @@ namespace Nz
|
|||
using BindingStorage = std::aligned_storage_t<sizeof(VulkanShaderBinding), alignof(VulkanShaderBinding)>;
|
||||
|
||||
Bitset<UInt64> freeBindings;
|
||||
Vk::DescriptorPool descriptorPool;
|
||||
std::unique_ptr<Vk::DescriptorPool> descriptorPool;
|
||||
std::unique_ptr<BindingStorage[]> storage;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -145,9 +145,8 @@ namespace Nz
|
|||
|
||||
inline DescriptorSet& DescriptorSet::operator=(DescriptorSet&& descriptorSet) noexcept
|
||||
{
|
||||
m_pool = descriptorSet.m_pool;
|
||||
|
||||
std::swap(m_handle, descriptorSet.m_handle);
|
||||
std::swap(m_pool, descriptorSet.m_pool);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,8 +83,10 @@ namespace Nz
|
|||
}
|
||||
|
||||
DescriptorPool pool;
|
||||
if (!pool.descriptorPool.Create(*m_device, MaxSet, UInt32(poolSizes.size()), poolSizes.data(), VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT))
|
||||
throw std::runtime_error("failed to allocate new descriptor pool: " + TranslateVulkanError(pool.descriptorPool.GetLastErrorCode()));
|
||||
pool.descriptorPool = std::make_unique<Vk::DescriptorPool>();
|
||||
|
||||
if (!pool.descriptorPool->Create(*m_device, MaxSet, UInt32(poolSizes.size()), poolSizes.data(), VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT))
|
||||
throw std::runtime_error("failed to allocate new descriptor pool: " + TranslateVulkanError(pool.descriptorPool->GetLastErrorCode()));
|
||||
|
||||
pool.freeBindings.Resize(MaxSet, true);
|
||||
pool.storage = std::make_unique<DescriptorPool::BindingStorage[]>(MaxSet);
|
||||
|
|
@ -100,10 +102,10 @@ namespace Nz
|
|||
if (freeBindingId == pool.freeBindings.npos)
|
||||
return {}; //< No free binding in this pool
|
||||
|
||||
Vk::DescriptorSet descriptorSet = pool.descriptorPool.AllocateDescriptorSet(m_descriptorSetLayout);
|
||||
Vk::DescriptorSet descriptorSet = pool.descriptorPool->AllocateDescriptorSet(m_descriptorSetLayout);
|
||||
if (!descriptorSet)
|
||||
{
|
||||
NazaraWarning("Failed to allocate descriptor set: " + TranslateVulkanError(pool.descriptorPool.GetLastErrorCode()));
|
||||
NazaraWarning("Failed to allocate descriptor set: " + TranslateVulkanError(pool.descriptorPool->GetLastErrorCode()));
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue