1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-01 16:24:12 +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( DxvkDescriptorAlloc::DxvkDescriptorAlloc(
const Rc<vk::DeviceFn>& vkd) const Rc<vk::DeviceFn>& vkd)
: m_vkd(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 DxvkDescriptorAlloc::alloc(VkDescriptorSetLayout layout) {
VkDescriptorSet set = VK_NULL_HANDLE; VkDescriptorSet set = allocFrom(m_pools.at(m_poolId), layout);
if (m_poolId < m_pools.size())
set = this->allocFrom(m_pools.at(m_poolId), layout);
if (set == VK_NULL_HANDLE) { if (set == VK_NULL_HANDLE) {
VkDescriptorPool pool = this->createDescriptorPool(); if (++m_poolId >= m_pools.size())
set = this->allocFrom(pool, layout); m_pools.push_back(createDescriptorPool());
if (set == VK_NULL_HANDLE) set = allocFrom(m_pools.at(m_poolId), layout);
throw DxvkError("DxvkDescriptorAlloc::alloc: Failed to allocate descriptor set");
m_pools.push_back(pool);
m_poolId += 1;
} }
return set; return set;
} }
@ -73,7 +69,7 @@ namespace dxvk {
VkDescriptorPool pool = VK_NULL_HANDLE; VkDescriptorPool pool = VK_NULL_HANDLE;
if (m_vkd->vkCreateDescriptorPool(m_vkd->device(), if (m_vkd->vkCreateDescriptorPool(m_vkd->device(),
&info, nullptr, &pool) != VK_SUCCESS) &info, nullptr, &pool) != VK_SUCCESS)
throw DxvkError("DxvkDescriptorAlloc::createDescriptorPool: Failed to create descriptor pool"); throw DxvkError("DxvkDescriptorAlloc: Failed to create descriptor pool");
return pool; return pool;
} }