private PhysicalDevice SelectPhysicalDevice(out QueueFamilyIndices indices) { uint count = 0; var res = VkApi.EnumeratePhysicalDevices(this.Instance, &count, null); if (res != Result.Success) { throw new VMASharp.VulkanResultException("Unable to enumerate physical devices", res); } if (count == 0) { throw new Exception("No physical devices found!"); } PhysicalDevice *deviceList = stackalloc PhysicalDevice[(int)count]; res = VkApi.EnumeratePhysicalDevices(this.Instance, &count, deviceList); if (res != Result.Success) { throw new VMASharp.VulkanResultException("Unable to enumerate physical devices", res); } for (uint i = 0; i < count; ++i) { var device = deviceList[i]; if (IsDeviceSuitable(device, out indices)) { return(device); } } throw new Exception("No suitable device found!"); }