Skip to content
Closed
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
14 changes: 14 additions & 0 deletions plume_metal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3796,10 +3796,20 @@ namespace plume {

const std::string deviceName(mtl->name()->utf8String());
description.name = deviceName;
#if TARGET_OS_IPHONE
// MTLDevice location and recommendedMaxWorkingSetSize are macOS-only selectors;
// iOS devices are always integrated and share system memory.
description.type = RenderDeviceType::INTEGRATED;
#else
description.type = mapDeviceType(mtl->location());
#endif
description.driverVersion = 1; // Unavailable
description.vendor = mtl->supportsFamily(MTL::GPUFamilyApple1) ? RenderDeviceVendor::APPLE : getRenderDeviceVendor(mtl->registryID());
#if TARGET_OS_IPHONE
description.dedicatedVideoMemory = NS::ProcessInfo::processInfo()->physicalMemory();
#else
description.dedicatedVideoMemory = mtl->recommendedMaxWorkingSetSize();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does exist on iOS 16+ by the way, if we could use this on those versions instead.

#endif

timestampCounterSet = findTimestampCounterSet();
if (timestampCounterSet != nullptr) {
Expand All @@ -3823,7 +3833,11 @@ namespace plume {
capabilities.resolveModes = false;
capabilities.scalarBlockLayout = true;
capabilities.presentWait = true;
#if TARGET_OS_IPHONE
capabilities.preferHDR = NS::ProcessInfo::processInfo()->physicalMemory() > (512 * 1024 * 1024);
#else
capabilities.preferHDR = mtl->recommendedMaxWorkingSetSize() > (512 * 1024 * 1024);
#endif
Comment on lines +3836 to +3840

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might as well update this to just check description.dedicatedVideoMemory since it's the same values.

capabilities.dynamicDepthBias = true;
capabilities.uma = mtl->hasUnifiedMemory();
capabilities.gpuUploadHeap = capabilities.uma;
Expand Down