Skip to content

Run Windows games on Apple Silicon — free, open source, with an open compatibility database that tells you what actually works.

device-memory-cap: log through the static reportMessage, the free function has no object for MVKLogWarn

Gauthier Piarrette152c349cc379
diff --git a/spike/patches/moltenvk-device-memory-cap.patch b/spike/patches/moltenvk-device-memory-cap.patch
index 0e97c0e..3ec554e 100644
--- a/spike/patches/moltenvk-device-memory-cap.patch
+++ b/spike/patches/moltenvk-device-memory-cap.patch
@@ -1,8 +1,8 @@
diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm b/MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm
-index dab10d9..17201f4 100644
+index dab10d9..8404068 100644
--- a/MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm
+++ b/MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm
-@@ -3431,9 +3431,31 @@ static uint32_t mvkGetEntryProperty(io_registry_entry_t entry, CFStringRef prope
+@@ -3431,9 +3431,32 @@ static uint32_t mvkGetEntryProperty(io_registry_entry_t entry, CFStringRef prope
#endif
}
@@ -20,8 +20,9 @@ index dab10d9..17201f4 100644
+ if (pct < 1 || pct > 100) { return (uint64_t)0; }
+ uint64_t sysMem = mvkGetSystemMemorySize();
+ uint64_t capped = sysMem / 100 * (uint64_t)pct;
-+ MVKLogWarn("HIGHBALL device-memory-cap: device memory reported as %llu MB, %ld%% of the Mac's %llu MB.",
-+ (unsigned long long)(capped / MEBI), pct, (unsigned long long)(sysMem / MEBI));
++ MVKBaseObject::reportMessage(nullptr, MVK_CONFIG_LOG_LEVEL_WARNING,
++ "HIGHBALL device-memory-cap: device memory reported as %llu MB, %ld%% of the Mac's %llu MB.",
++ (unsigned long long)(capped / MEBI), pct, (unsigned long long)(sysMem / MEBI));
+ return capped;
+ }();
+ return cap;
@@ -35,7 +36,7 @@ index dab10d9..17201f4 100644
} else {
// There's actually no way to query the total physical VRAM on the device in Metal.
// Just default to using the recommended max working set size (i.e. the budget).
-@@ -3443,11 +3465,15 @@ static uint32_t mvkGetEntryProperty(io_registry_entry_t entry, CFStringRef prope
+@@ -3443,11 +3466,15 @@ static uint32_t mvkGetEntryProperty(io_registry_entry_t entry, CFStringRef prope
// If possible, retrieve from the MTLDevice, otherwise from available memory size, or a fixed conservative estimate.
uint64_t MVKPhysicalDevice::getRecommendedMaxWorkingSetSize() {