Vulkan/StagingBuffer: Don't try to invalidate unmapped buffer

Fixes crash on Mali.
This commit is contained in:
Connor McLaughlin 2020-07-12 00:40:04 +10:00
parent fb6538da35
commit 282f166e7a
1 changed files with 2 additions and 2 deletions

View File

@ -84,7 +84,7 @@ void StagingBuffer::Unmap()
void StagingBuffer::FlushCPUCache(VkDeviceSize offset, VkDeviceSize size) void StagingBuffer::FlushCPUCache(VkDeviceSize offset, VkDeviceSize size)
{ {
Assert(offset >= m_map_offset); Assert(offset >= m_map_offset);
if (m_coherent) if (m_coherent || !IsMapped())
return; return;
VkMappedMemoryRange range = {VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE, nullptr, m_memory, offset - m_map_offset, size}; VkMappedMemoryRange range = {VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE, nullptr, m_memory, offset - m_map_offset, size};
@ -129,7 +129,7 @@ void StagingBuffer::FlushGPUCache(VkCommandBuffer command_buffer, VkAccessFlagBi
void StagingBuffer::InvalidateCPUCache(VkDeviceSize offset, VkDeviceSize size) void StagingBuffer::InvalidateCPUCache(VkDeviceSize offset, VkDeviceSize size)
{ {
Assert(offset >= m_map_offset); Assert(offset >= m_map_offset);
if (m_coherent) if (m_coherent || !IsMapped())
return; return;
VkMappedMemoryRange range = {VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE, nullptr, m_memory, offset - m_map_offset, size}; VkMappedMemoryRange range = {VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE, nullptr, m_memory, offset - m_map_offset, size};