[ModelSurfs] Skip releasing if buffer is empty

This commit is contained in:
momo5502 2017-01-18 14:55:18 +01:00
parent 4a4e938b00
commit 3cadc64d13
12 changed files with 755 additions and 752 deletions

View File

@ -189,23 +189,26 @@ namespace Components
{
hasCustomSurface = true;
auto buffer = ModelSurfs::BufferMap.find(surface->triIndices);
if (buffer != ModelSurfs::BufferMap.end())
if (!ModelSurfs::BufferMap.empty())
{
buffer->second->Release();
ModelSurfs::BufferMap.erase(buffer);
}
auto buffer = ModelSurfs::BufferMap.find(surface->triIndices);
if (buffer != ModelSurfs::BufferMap.end())
{
buffer->second->Release();
ModelSurfs::BufferMap.erase(buffer);
}
buffer = ModelSurfs::BufferMap.find(surface->verts0);
if (buffer != ModelSurfs::BufferMap.end())
{
buffer->second->Release();
ModelSurfs::BufferMap.erase(buffer);
buffer = ModelSurfs::BufferMap.find(surface->verts0);
if (buffer != ModelSurfs::BufferMap.end())
{
buffer->second->Release();
ModelSurfs::BufferMap.erase(buffer);
}
}
}
}
if (hasCustomSurface)
if (hasCustomSurface && !ModelSurfs::AllocMap.empty())
{
auto allocData = ModelSurfs::AllocMap.find(header.surfaces->name);
if (allocData != ModelSurfs::AllocMap.end())