Use MTLDevice recommendedMaxWorkingSetSize to set the heap size rather than leaving it at 0 (on macOS). recommenededMaxWorkingSetSize does not exist on iOS so for iOS continue to leave it at 0 for now.

This commit is contained in:
Dan Ginsburg 2018-01-23 15:16:07 -05:00
parent 89bd4b7413
commit 9105bf58cd

View File

@ -840,10 +840,14 @@ void MVKPhysicalDevice::initMemoryProperties() {
// - cmdbuff waitUntilCompleted (or completion handler)
// - buffer/texture getBytes:
// TODO: determine correct values - particularly heap size
_memoryProperties.memoryHeapCount = 1;
_memoryProperties.memoryHeaps[0].flags = (VK_MEMORY_HEAP_DEVICE_LOCAL_BIT);
#if MVK_MACOS
_memoryProperties.memoryHeaps[0].size = (VkDeviceSize)[_mtlDevice recommendedMaxWorkingSetSize];
#else
// TODO: determine heap size on iOS where recommenedMaxWorkingSetSize does not exist.
_memoryProperties.memoryHeaps[0].size = 0;
#endif
_memoryProperties.memoryTypes[0].heapIndex = 0;
_memoryProperties.memoryTypes[0].propertyFlags = MVK_VK_MEMORY_TYPE_METAL_PRIVATE; // Private storage