From 0c65cdc1f5d8068df969d70145d5dc89f40eeea7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Thu, 11 Jan 2024 10:11:50 +0800 Subject: [PATCH] GPU (macOS): detect memory usage --- src/detection/gpu/gpu_apple.m | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/detection/gpu/gpu_apple.m b/src/detection/gpu/gpu_apple.m index 951d25469..0323fdaff 100644 --- a/src/detection/gpu/gpu_apple.m +++ b/src/detection/gpu/gpu_apple.m @@ -32,7 +32,18 @@ const char* ffGpuDetectMetal(FFlist* gpus) else if ([device supportsFamily:MTLGPUFamilyCommon1]) ffStrbufSetStatic(&gpu->platformApi, "Metal Common 1"); - gpu->type = device.hasUnifiedMemory ? FF_GPU_TYPE_INTEGRATED : FF_GPU_TYPE_DISCRETE; + if (gpu->type == device.hasUnifiedMemory) + { + gpu->type = FF_GPU_TYPE_INTEGRATED; + gpu->shared.total = device.recommendedMaxWorkingSetSize; + gpu->shared.used = device.currentAllocatedSize; + } + else + { + gpu->type = FF_GPU_TYPE_DISCRETE; + gpu->dedicated.total = device.recommendedMaxWorkingSetSize; + gpu->dedicated.used = device.currentAllocatedSize; + } } return NULL; }