mirror of
https://github.com/love2d/love.git
synced 2026-08-19 20:19:42 +02:00
vulkan: readd local streambuffer frame index
This commit is contained in:
@@ -95,13 +95,13 @@ love::graphics::StreamBuffer::MapInfo StreamBuffer::map(size_t /*minsize*/)
|
|||||||
|
|
||||||
MapInfo info;
|
MapInfo info;
|
||||||
info.size = bufferSize - frameGPUReadOffset;
|
info.size = bufferSize - frameGPUReadOffset;
|
||||||
info.data = (uint8*)allocInfo.pMappedData + (vgfx->getFrameIndex() * bufferSize) + frameGPUReadOffset;
|
info.data = (uint8*)allocInfo.pMappedData + (frameIndex * bufferSize) + frameGPUReadOffset;
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t StreamBuffer::unmap(size_t /*usedSize*/)
|
size_t StreamBuffer::unmap(size_t /*usedSize*/)
|
||||||
{
|
{
|
||||||
size_t offset = (vgfx->getFrameIndex() * bufferSize) + frameGPUReadOffset;
|
size_t offset = (frameIndex * bufferSize) + frameGPUReadOffset;
|
||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,6 +112,7 @@ void StreamBuffer::markUsed(size_t usedSize)
|
|||||||
|
|
||||||
void StreamBuffer::nextFrame()
|
void StreamBuffer::nextFrame()
|
||||||
{
|
{
|
||||||
|
frameIndex = (frameIndex + 1) % MAX_FRAMES_IN_FLIGHT;
|
||||||
frameGPUReadOffset = 0;
|
frameGPUReadOffset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ private:
|
|||||||
VmaAllocation allocation;
|
VmaAllocation allocation;
|
||||||
VmaAllocationInfo allocInfo;
|
VmaAllocationInfo allocInfo;
|
||||||
VkBuffer buffer = VK_NULL_HANDLE;
|
VkBuffer buffer = VK_NULL_HANDLE;
|
||||||
|
int frameIndex = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user