Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions plume_metal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3794,12 +3794,30 @@ namespace plume {
mtl->retain();
devices->release();

NS::OperatingSystemVersion osVersion = NS::ProcessInfo::processInfo()->operatingSystemVersion();

const std::string deviceName(mtl->name()->utf8String());
description.name = deviceName;
#if PLUME_MACOS && (!defined(MAC_OS_VERSION_27_0) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_VERSION_27_0)
description.type = mapDeviceType(mtl->location());
#else
// location is only available on macOS and deprecated from 27 onward.
// For other OS types and 27+ it's always integrated.
description.type = RenderDeviceType::INTEGRATED;
#endif
description.driverVersion = 1; // Unavailable
description.vendor = mtl->supportsFamily(MTL::GPUFamilyApple1) ? RenderDeviceVendor::APPLE : getRenderDeviceVendor(mtl->registryID());
#if PLUME_MACOS
description.dedicatedVideoMemory = mtl->recommendedMaxWorkingSetSize();
#else
// On other OS types, recommendedMaxWorkingSetSize is available starting in 16.0
if (osVersion.majorVersion >= 16) {
description.dedicatedVideoMemory = mtl->recommendedMaxWorkingSetSize();
} else {
// Otherwise, memory is always unified.
description.dedicatedVideoMemory = NS::ProcessInfo::processInfo()->physicalMemory();
}
#endif

timestampCounterSet = findTimestampCounterSet();
if (timestampCounterSet != nullptr) {
Expand All @@ -3811,8 +3829,6 @@ namespace plume {
createResolvePipelineState();
sharedBlitDescriptor = MTL::BlitPassDescriptor::alloc()->init();

NS::OperatingSystemVersion osVersion = NS::ProcessInfo::processInfo()->operatingSystemVersion();

// Fill capabilities.
// https://developer.apple.com/documentation/metal/device-inspection
// TODO: Support Raytracing.
Expand All @@ -3823,7 +3839,7 @@ namespace plume {
capabilities.resolveModes = false;
capabilities.scalarBlockLayout = true;
capabilities.presentWait = true;
capabilities.preferHDR = mtl->recommendedMaxWorkingSetSize() > (512 * 1024 * 1024);
capabilities.preferHDR = description.dedicatedVideoMemory > (512 * 1024 * 1024);
capabilities.dynamicDepthBias = true;
capabilities.uma = mtl->hasUnifiedMemory();
capabilities.gpuUploadHeap = capabilities.uma;
Expand Down
Loading