Merge pull request #27 from danginsburg/memory_heap_size

Use MTLDevice recommendedMaxWorkingSetSize to set the heap size rathe…
This commit is contained in:
Bill Hollings 2018-01-23 18:51:25 -05:00 committed by GitHub
commit 6753d90ac4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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