/// <summary> /// Enumerates the physical devices accessible to a Vulkan instance. /// </summary> public unsafe SharpVk.PhysicalDevice[] EnumeratePhysicalDevices() { try { SharpVk.PhysicalDevice[] result = default(SharpVk.PhysicalDevice[]); uint marshalledPhysicalDeviceCount = default(uint); SharpVk.Interop.PhysicalDevice *marshalledPhysicalDevices = default(SharpVk.Interop.PhysicalDevice *); SharpVk.Interop.VkInstanceEnumeratePhysicalDevicesDelegate commandDelegate = commandCache.Cache.vkEnumeratePhysicalDevices; Result methodResult = commandDelegate(this.handle, &marshalledPhysicalDeviceCount, marshalledPhysicalDevices); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } marshalledPhysicalDevices = (SharpVk.Interop.PhysicalDevice *)(Interop.HeapUtil.Allocate <SharpVk.Interop.PhysicalDevice>((uint)(marshalledPhysicalDeviceCount))); commandDelegate(this.handle, &marshalledPhysicalDeviceCount, marshalledPhysicalDevices); if (marshalledPhysicalDevices != null) { var fieldPointer = new SharpVk.PhysicalDevice[(uint)(marshalledPhysicalDeviceCount)]; for (int index = 0; index < (uint)(marshalledPhysicalDeviceCount); index++) { fieldPointer[index] = new SharpVk.PhysicalDevice(this, marshalledPhysicalDevices[index]); } result = fieldPointer; } else { result = null; } return(result); } finally { Interop.HeapUtil.FreeAll(); } }
public static extern SharpVk.Result vkEnumeratePhysicalDevices(SharpVk.Interop.Instance instance, uint *physicalDeviceCount, SharpVk.Interop.PhysicalDevice *physicalDevices);