Store map offset in GPUBuffer so we only flush the mapped range

This commit is contained in:
baldurk
2018-10-04 12:54:51 +01:00
parent d31457b4ae
commit b87792f721
2 changed files with 4 additions and 1 deletions
+3 -1
View File
@@ -214,6 +214,8 @@ void *GPUBuffer::Map(uint32_t *bindoffset, VkDeviceSize usedsize)
if(bindoffset)
*bindoffset = (uint32_t)offset;
mapoffset = offset;
void *ptr = NULL;
VkResult vkr = m_pDriver->vkMapMemory(device, mem, offset, size, 0, (void **)&ptr);
RDCASSERTEQUAL(vkr, VK_SUCCESS);
@@ -247,7 +249,7 @@ void GPUBuffer::Unmap()
if(!(createFlags & eGPUBufferReadback) && !(createFlags & eGPUBufferGPULocal))
{
VkMappedMemoryRange range = {
VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE, NULL, mem, 0, VK_WHOLE_SIZE,
VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE, NULL, mem, mapoffset, VK_WHOLE_SIZE,
};
VkResult vkr = m_pDriver->vkFlushMappedMemoryRanges(device, 1, &range);
+1
View File
@@ -167,6 +167,7 @@ struct GPUBuffer
// for handling ring allocations
VkDeviceSize totalsize = 0;
VkDeviceSize curoffset = 0;
VkDeviceSize mapoffset = 0;
uint32_t ringCount = 0;