implement new index cache

This commit is contained in:
Samuliak 2025-01-18 09:40:31 +01:00
parent 800aae4fdb
commit 24ff85b11f
No known key found for this signature in database
5 changed files with 88 additions and 65 deletions

View file

@ -73,7 +73,7 @@ void MetalMemoryManager::UploadToBufferCache(const void* data, size_t offset, si
if (m_bufferCacheMode == BufferCacheMode::DevicePrivate)
{
auto allocation = m_tempBufferAllocator.GetBufferAllocation(size);
auto allocation = m_tempBufferAllocator.GetAllocation(size);
auto buffer = m_tempBufferAllocator.GetBufferOutsideOfCommandBuffer(allocation.bufferIndex);
memcpy((uint8*)buffer->contents() + allocation.offset, data, size);
@ -82,8 +82,8 @@ void MetalMemoryManager::UploadToBufferCache(const void* data, size_t offset, si
m_mtlr->CopyBufferToBuffer(buffer, allocation.offset, m_bufferCache, offset, size, ALL_MTL_RENDER_STAGES, ALL_MTL_RENDER_STAGES);
// Make sure the buffer has the right command buffer
m_tempBufferAllocator.GetBuffer(allocation.bufferIndex); // TODO: make a helper function for this
// Mark buffer as used
m_tempBufferAllocator.MarkBufferAsUsed(allocation.bufferIndex);
// We can now safely unlock the buffer
m_tempBufferAllocator.UnlockBuffer(allocation.bufferIndex);