Flush memory if coherency flag is no set (Refs #273)
This commit is contained in:
parent
e0caca9488
commit
0e13f583c7
1 changed files with 9 additions and 0 deletions
|
|
@ -368,6 +368,15 @@ namespace vks
|
|||
void *mapped;
|
||||
VK_CHECK_RESULT(vkMapMemory(logicalDevice, *memory, 0, size, 0, &mapped));
|
||||
memcpy(mapped, data, size);
|
||||
// If host coherency hasn't been requested, do a manual flush to make writes visible
|
||||
if ((memoryPropertyFlags & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT) == 0)
|
||||
{
|
||||
VkMappedMemoryRange mappedRange = vks::initializers::mappedMemoryRange();
|
||||
mappedRange.memory = *memory;
|
||||
mappedRange.offset = 0;
|
||||
mappedRange.size = size;
|
||||
vkFlushMappedMemoryRanges(logicalDevice, 1, &mappedRange);
|
||||
}
|
||||
vkUnmapMemory(logicalDevice, *memory);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue