From 3bee390d91748499881085c40b40034231f5e8a5 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Mon, 23 Sep 2024 00:22:33 +0200 Subject: [PATCH] [dxvk] Don't log memory errors prematurely Fallback allocations are a thing. --- src/dxvk/dxvk_memory.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/dxvk/dxvk_memory.cpp b/src/dxvk/dxvk_memory.cpp index 520021ea8..d01159deb 100644 --- a/src/dxvk/dxvk_memory.cpp +++ b/src/dxvk/dxvk_memory.cpp @@ -276,6 +276,12 @@ namespace dxvk { if (req.dedicated.requiresDedicatedAllocation && (info.flags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)) { allocation = allocateDedicatedMemory(req.core.memoryRequirements, info.flags & ~VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, &info.dedicated); + + if (unlikely(!allocation)) { + logMemoryError(req.core.memoryRequirements); + logMemoryStats(); + } + return DxvkMemory(std::move(allocation)); } } @@ -286,6 +292,11 @@ namespace dxvk { if (unlikely(!allocation) && (info.flags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)) { allocation = allocateMemory(req.core.memoryRequirements, info.flags & ~VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT); + + if (unlikely(!allocation)) { + logMemoryError(req.core.memoryRequirements); + logMemoryStats(); + } } return DxvkMemory(std::move(allocation)); @@ -379,9 +390,6 @@ namespace dxvk { } } - logMemoryError(requirements); - logMemoryStats(); - return nullptr; }