From 3c611503d67630b67801a33b00b87863172a310d Mon Sep 17 00:00:00 2001
From: Philip Rebohle <philip.rebohle@tu-dortmund.de>
Date: Mon, 7 May 2018 19:04:25 +0200
Subject: [PATCH] [dxgi] Fix reported VRAM size for 32-bit builds

---
 src/dxgi/dxgi_adapter.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/dxgi/dxgi_adapter.cpp b/src/dxgi/dxgi_adapter.cpp
index a562133f..8bf91fc3 100644
--- a/src/dxgi/dxgi_adapter.cpp
+++ b/src/dxgi/dxgi_adapter.cpp
@@ -155,6 +155,14 @@ namespace dxvk {
         sharedMemory += heap.size;
     }
     
+    #ifndef _WIN64
+    // The value returned by DXGI is a 32-bit value
+    // on 32-bit platforms, so we need to clamp it
+    VkDeviceSize maxMemory = 0xF0000000;
+    deviceMemory = std::min(deviceMemory, maxMemory);
+    sharedMemory = std::min(sharedMemory, maxMemory);
+    #endif
+    
     pDesc->VendorId               = deviceProp.vendorID;
     pDesc->DeviceId               = deviceProp.deviceID;
     pDesc->SubSysId               = 0;