From 6da1ba7cff2fd3ea5d9bdd2de628a74e3bdcbe2d Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Fri, 23 Aug 2024 01:12:12 +0200 Subject: [PATCH] [dxgi] Avoid reporting large VRAM amounts as a power of two --- src/dxgi/dxgi_adapter.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/dxgi/dxgi_adapter.cpp b/src/dxgi/dxgi_adapter.cpp index 4da586af5..02e53696d 100644 --- a/src/dxgi/dxgi_adapter.cpp +++ b/src/dxgi/dxgi_adapter.cpp @@ -358,6 +358,16 @@ namespace dxvk { deviceMemory = 512ull << 20; } + // Make sure to never return exact powers of two outside the 32-bit range + // because some games don't understand the concept of actually having VRAM + constexpr VkDeviceSize adjustment = 32ull << 20; + + if (deviceMemory && !(deviceMemory & 0xffffffffull)) + deviceMemory -= adjustment; + + if (sharedMemory && !(sharedMemory & 0xffffffffull)) + sharedMemory -= adjustment; + // Some games are silly and need their memory limited if (options->maxDeviceMemory > 0 && options->maxDeviceMemory < deviceMemory)