From 146fbd492f57fccdfc0659be2a96bdb60f0102cb Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Fri, 18 Feb 2022 18:13:28 +0100 Subject: [PATCH] [dxvk] Free existing staging buffer before creating a new one --- src/dxvk/dxvk_staging.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/dxvk/dxvk_staging.cpp b/src/dxvk/dxvk_staging.cpp index ecade411..0daa725c 100644 --- a/src/dxvk/dxvk_staging.cpp +++ b/src/dxvk/dxvk_staging.cpp @@ -39,6 +39,9 @@ namespace dxvk { if (alignedOffset + alignedSize > m_size || m_buffer == nullptr) { info.size = m_size; + // Free resources first if possible, in some rare + // situations this may help avoid a memory allocation. + m_buffer = nullptr; m_buffer = m_device->createBuffer(info, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT); alignedOffset = 0;