1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-11-29 19:24:10 +01:00

[dxvk] Fixed descriptor pool leak

This commit is contained in:
Philip Rebohle 2017-12-20 00:16:59 +01:00
parent 9865474bb4
commit d2b676b551

View File

@ -5,7 +5,10 @@ namespace dxvk {
DxvkDescriptorAlloc::DxvkDescriptorAlloc(
const Rc<vk::DeviceFn>& vkd)
: m_vkd(vkd) {
// Allocate one pool right away so that there
// is always at least one pool available when
// allocating a descriptor set
m_pools.push_back(createDescriptorPool());
}
@ -18,22 +21,15 @@ namespace dxvk {
VkDescriptorSet DxvkDescriptorAlloc::alloc(VkDescriptorSetLayout layout) {
VkDescriptorSet set = VK_NULL_HANDLE;
if (m_poolId < m_pools.size())
set = this->allocFrom(m_pools.at(m_poolId), layout);
VkDescriptorSet set = allocFrom(m_pools.at(m_poolId), layout);
if (set == VK_NULL_HANDLE) {
VkDescriptorPool pool = this->createDescriptorPool();
set = this->allocFrom(pool, layout);
if (++m_poolId >= m_pools.size())
m_pools.push_back(createDescriptorPool());
if (set == VK_NULL_HANDLE)
throw DxvkError("DxvkDescriptorAlloc::alloc: Failed to allocate descriptor set");
m_pools.push_back(pool);
m_poolId += 1;
set = allocFrom(m_pools.at(m_poolId), layout);
}
return set;
}
@ -73,7 +69,7 @@ namespace dxvk {
VkDescriptorPool pool = VK_NULL_HANDLE;
if (m_vkd->vkCreateDescriptorPool(m_vkd->device(),
&info, nullptr, &pool) != VK_SUCCESS)
throw DxvkError("DxvkDescriptorAlloc::createDescriptorPool: Failed to create descriptor pool");
throw DxvkError("DxvkDescriptorAlloc: Failed to create descriptor pool");
return pool;
}