From 08ecd49c66a911a057e89ed47e969fb6bce42c00 Mon Sep 17 00:00:00 2001
From: Philip Rebohle <philip.rebohle@tu-dortmund.de>
Date: Mon, 14 Feb 2022 01:00:48 +0100
Subject: [PATCH] [dxvk] Don't suballocate large staging buffer allocations

Otherwise we'll risk wasting almost half the staging buffer memory.
Creating a temporary buffer is cheap enough, so just do that.
---
 src/dxvk/dxvk_staging.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/dxvk/dxvk_staging.cpp b/src/dxvk/dxvk_staging.cpp
index 786b4adf..ecade411 100644
--- a/src/dxvk/dxvk_staging.cpp
+++ b/src/dxvk/dxvk_staging.cpp
@@ -31,7 +31,7 @@ namespace dxvk {
     VkDeviceSize alignedSize = dxvk::align(size, align);
     VkDeviceSize alignedOffset = dxvk::align(m_offset, align);
 
-    if (alignedSize >= m_size) {
+    if (2 * alignedSize > m_size) {
       return DxvkBufferSlice(m_device->createBuffer(info,
         VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT));
     }