fix: index buffer crashes

This commit is contained in:
Samuliak 2025-01-18 17:22:28 +01:00
parent 97b806f16f
commit d086eb3db5
No known key found for this signature in database
2 changed files with 2 additions and 8 deletions

View file

@ -222,9 +222,9 @@ void MetalSynchronizedHeapAllocator::CleanupBuffer(MTL::CommandBuffer* latestFin
return;
// release allocations
for(auto& addr : it->second)
for (auto& addr : it->second)
m_chunkedHeap.free(addr);
it = m_releaseQueue.erase(it);
m_releaseQueue.erase(it);
}
void MetalSynchronizedHeapAllocator::GetStats(uint32& numBuffers, size_t& totalBufferSize, size_t& freeBufferSize) const

View file

@ -1816,7 +1816,6 @@ void MetalRenderer::CommitCommandBuffer()
void MetalRenderer::ProcessFinishedCommandBuffers()
{
// Check for finished command buffers
bool atLeastOneCompleted = false;
for (auto it = m_executingCommandBuffers.begin(); it != m_executingCommandBuffers.end();)
{
auto commandBuffer = *it;
@ -1825,17 +1824,12 @@ void MetalRenderer::ProcessFinishedCommandBuffers()
m_memoryManager->CleanupBuffers(commandBuffer);
commandBuffer->release();
it = m_executingCommandBuffers.erase(it);
atLeastOneCompleted = true;
}
else
{
++it;
}
}
// Invalidate indices if at least one command buffer has completed
if (atLeastOneCompleted)
LatteIndices_invalidateAll();
}
bool MetalRenderer::AcquireDrawable(bool mainWindow)