diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2022-12-01 15:04:51 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2022-12-02 15:53:38 +0100 |
commit | 62d76743b30dd541aa3d9a980b0c988a8e213c8b (patch) | |
tree | b5241eb561dc6714dd83d04029b940bc09861f4f /src/gui/rhi | |
parent | 45e33954ef0dea9944911bcbbd0ead0f999da664 (diff) |
rhi: vulkan: Flush before unmap
To prevent validation errors with VUID-VkMappedMemoryRange-memory-00684
although I cannot actually trigger this on Windows. Based on the spec
however the right thing seems to be to flush before unmap.
Pick-to: 6.4 6.2
Fixes: QTBUG-109123
Change-Id: I34fedea22a6e6e2a14f9b95fea49af05985ec4cb
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Diffstat (limited to 'src/gui/rhi')
-rw-r--r-- | src/gui/rhi/qrhivulkan.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/gui/rhi/qrhivulkan.cpp b/src/gui/rhi/qrhivulkan.cpp index 41834a1c43..da6d0fd0ae 100644 --- a/src/gui/rhi/qrhivulkan.cpp +++ b/src/gui/rhi/qrhivulkan.cpp @@ -3087,8 +3087,8 @@ void QRhiVulkan::enqueueResourceUpdates(QVkCommandBuffer *cbD, QRhiResourceUpdat continue; } memcpy(static_cast<uchar *>(p) + u.offset, u.data.constData(), u.data.size()); - vmaUnmapMemory(toVmaAllocator(allocator), a); vmaFlushAllocation(toVmaAllocator(allocator), a, u.offset, u.data.size()); + vmaUnmapMemory(toVmaAllocator(allocator), a); trackedBufferBarrier(cbD, bufD, 0, VK_ACCESS_TRANSFER_WRITE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT); @@ -3237,8 +3237,8 @@ void QRhiVulkan::enqueueResourceUpdates(QVkCommandBuffer *cbD, QRhiResourceUpdat } } } - vmaUnmapMemory(toVmaAllocator(allocator), a); vmaFlushAllocation(toVmaAllocator(allocator), a, 0, stagingSize); + vmaUnmapMemory(toVmaAllocator(allocator), a); trackedImageBarrier(cbD, utexD, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_ACCESS_TRANSFER_WRITE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT); @@ -3541,9 +3541,9 @@ void QRhiVulkan::executeBufferHostWritesForSlot(QVkBuffer *bufD, int slot) if (u.offset + u.data.size() > changeEnd) changeEnd = u.offset + u.data.size(); } - vmaUnmapMemory(toVmaAllocator(allocator), a); if (changeBegin < UINT32_MAX && changeBegin < changeEnd) vmaFlushAllocation(toVmaAllocator(allocator), a, changeBegin, changeEnd - changeBegin); + vmaUnmapMemory(toVmaAllocator(allocator), a); bufD->pendingDynamicUpdates[slot].clear(); } @@ -5699,8 +5699,8 @@ void QVkBuffer::endFullDynamicBufferUpdateForCurrentFrame() QRHI_RES_RHI(QRhiVulkan); const int slot = rhiD->currentFrameSlot; VmaAllocation a = toVmaAllocation(allocations[slot]); - vmaUnmapMemory(toVmaAllocator(rhiD->allocator), a); vmaFlushAllocation(toVmaAllocator(rhiD->allocator), a, 0, m_size); + vmaUnmapMemory(toVmaAllocator(rhiD->allocator), a); } QVkRenderBuffer::QVkRenderBuffer(QRhiImplementation *rhi, Type type, const QSize &pixelSize, |