Create an implicit vkUnmapMemory() in vkFreeMemory() (Refs #179)

* It's legal to free memory while still mapped and this should be
  handled, so here we clean up any mapped state that's present when
  destroying a memory resource record.
This commit is contained in:
baldurk
2016-02-23 00:49:33 +01:00
parent da94c7a8c6
commit 64ef0d93a8
@@ -288,6 +288,18 @@ void WrappedVulkan::vkFreeMemory(
VkDeviceMemory unwrappedMem = wrapped->real.As<VkDeviceMemory>();
// there is an implicit unmap on free, so make sure to tidy up
if(wrapped->record->memMapState && wrapped->record->memMapState->refData)
Serialiser::FreeAlignedBuffer(wrapped->record->memMapState->refData);
{
SCOPED_LOCK(m_CoherentMapsLock);
auto it = std::find(m_CoherentMaps.begin(), m_CoherentMaps.end(), wrapped->record);
if(it != m_CoherentMaps.end())
m_CoherentMaps.erase(it);
}
GetResourceManager()->ReleaseWrappedResource(memory);
ObjDisp(device)->FreeMemory(Unwrap(device), unwrappedMem, pAllocator);