De-race condition descriptor and memory releasing

This commit is contained in:
baldurk
2015-10-06 23:54:13 +02:00
parent a75ada47ae
commit bfe7a41696
2 changed files with 6 additions and 8 deletions
@@ -315,16 +315,13 @@ VkResult WrappedVulkan::vkFreeDescriptorSets(
for(uint32_t i=0; i < count; i++)
unwrapped[i] = Unwrap(pDescriptorSets[i]);
for(uint32_t i=0; i < count; i++)
GetResourceManager()->ReleaseWrappedResource(pDescriptorSets[i]);
VkResult ret = ObjDisp(device)->FreeDescriptorSets(Unwrap(device), Unwrap(descriptorPool), count, unwrapped);
SAFE_DELETE_ARRAY(unwrapped);
if(ret == VK_SUCCESS)
{
for(uint32_t i=0; i < count; i++)
GetResourceManager()->ReleaseWrappedResource(pDescriptorSets[i]);
}
return ret;
}
@@ -122,11 +122,12 @@ VkResult WrappedVulkan::vkFreeMemory(
// we just need to clean up after ourselves on replay
WrappedVkNonDispRes *wrapped = (WrappedVkNonDispRes *)GetWrapped(mem);
m_MemoryInfo.erase(wrapped->id);
VkResult res = ObjDisp(device)->FreeMemory(Unwrap(device), wrapped->real.As<VkDeviceMemory>());
VkDeviceMemory unwrappedMem = wrapped->real.As<VkDeviceMemory>();
GetResourceManager()->ReleaseWrappedResource(mem);
return res;
return ObjDisp(device)->FreeMemory(Unwrap(device), unwrappedMem);
}
VkResult WrappedVulkan::vkMapMemory(