diff --git a/src/dxgi/dxgi_adapter.cpp b/src/dxgi/dxgi_adapter.cpp index 4766017e..cd5f3370 100644 --- a/src/dxgi/dxgi_adapter.cpp +++ b/src/dxgi/dxgi_adapter.cpp @@ -302,13 +302,13 @@ namespace dxvk { && options->maxSharedMemory < sharedMemory) sharedMemory = options->maxSharedMemory; - #ifndef _WIN64 - // The value returned by DXGI is a 32-bit value - // on 32-bit platforms, so we need to clamp it - VkDeviceSize maxMemory = 0xC0000000; - deviceMemory = std::min(deviceMemory, maxMemory); - sharedMemory = std::min(sharedMemory, maxMemory); - #endif + if (env::is32BitHostPlatform()) { + // The value returned by DXGI is a 32-bit value + // on 32-bit platforms, so we need to clamp it + VkDeviceSize maxMemory = 0xC0000000; + deviceMemory = std::min(deviceMemory, maxMemory); + sharedMemory = std::min(sharedMemory, maxMemory); + } pDesc->VendorId = deviceProp.vendorID; pDesc->DeviceId = deviceProp.deviceID; diff --git a/src/dxvk/dxvk_memory.cpp b/src/dxvk/dxvk_memory.cpp index 3f252527..9a0656a8 100644 --- a/src/dxvk/dxvk_memory.cpp +++ b/src/dxvk/dxvk_memory.cpp @@ -432,10 +432,10 @@ namespace dxvk { // Try to waste a bit less system memory in 32-bit // applications due to address space constraints - #ifndef _WIN64 - if (type.propertyFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) - chunkSize = 32 << 20; - #endif + if (env::is32BitHostPlatform()) { + if (type.propertyFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) + chunkSize = 32 << 20; + } // Reduce the chunk size on small heaps so // we can at least fit in 15 allocations diff --git a/src/util/util_env.h b/src/util/util_env.h index e4a1020d..cb4aa2a0 100644 --- a/src/util/util_env.h +++ b/src/util/util_env.h @@ -4,6 +4,13 @@ namespace dxvk::env { + /** + * \brief Checks whether the host platform is 32-bit + */ + constexpr bool is32BitHostPlatform() { + return sizeof(void*) == 4; + } + /** * \brief Gets environment variable *