vulkan: readd local streambuffer frame index

This commit is contained in:
niki
2022-10-05 17:55:40 +02:00
parent e4543c604c
commit c89cca9e60
2 changed files with 4 additions and 2 deletions
+3 -2
View File
@@ -95,13 +95,13 @@ love::graphics::StreamBuffer::MapInfo StreamBuffer::map(size_t /*minsize*/)
MapInfo info;
info.size = bufferSize - frameGPUReadOffset;
info.data = (uint8*)allocInfo.pMappedData + (vgfx->getFrameIndex() * bufferSize) + frameGPUReadOffset;
info.data = (uint8*)allocInfo.pMappedData + (frameIndex * bufferSize) + frameGPUReadOffset;
return info;
}
size_t StreamBuffer::unmap(size_t /*usedSize*/)
{
size_t offset = (vgfx->getFrameIndex() * bufferSize) + frameGPUReadOffset;
size_t offset = (frameIndex * bufferSize) + frameGPUReadOffset;
return offset;
}
@@ -112,6 +112,7 @@ void StreamBuffer::markUsed(size_t usedSize)
void StreamBuffer::nextFrame()
{
frameIndex = (frameIndex + 1) % MAX_FRAMES_IN_FLIGHT;
frameGPUReadOffset = 0;
}
@@ -61,6 +61,7 @@ private:
VmaAllocation allocation;
VmaAllocationInfo allocInfo;
VkBuffer buffer = VK_NULL_HANDLE;
int frameIndex = 0;
};