Rework buffers synchronization

This commit is contained in:
Lynix
2020-03-13 18:44:49 +01:00
parent 63547fcd4e
commit b774a879b6
19 changed files with 223 additions and 68 deletions

View File

@@ -57,6 +57,31 @@ namespace Nz
return false;
}
inline bool DeviceMemory::FlushMemory()
{
return FlushMemory(0, VK_WHOLE_SIZE);
}
inline bool DeviceMemory::FlushMemory(UInt64 offset, UInt64 size)
{
VkMappedMemoryRange memoryRange = {
VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE,
nullptr,
m_handle,
offset,
size
};
m_lastErrorCode = m_device->vkFlushMappedMemoryRanges(*m_device, 1, &memoryRange);
if (m_lastErrorCode != VK_SUCCESS)
{
NazaraError("Failed to flush memory: " + TranslateVulkanError(m_lastErrorCode));
return false;
}
return true;
}
inline void* DeviceMemory::GetMappedPointer()
{
return m_mappedPtr;