private bool isDeviceSuitable(VkPhysicalDevice physicalDevice)
        {
            QueueFamilyIndices indices = findQueueFamilies(physicalDevice);

            bool extensionsSupported = checkDeviceExtensionsSupport(physicalDevice);

            bool swapChainAdequate = false;

            if (extensionsSupported)
            {
                SwapChainSupportDetails swapChainSupport = querySwapChainSupport(physicalDevice);
                swapChainAdequate = swapChainSupport.formats.Any() && swapChainSupport.presentModes.Any();
            }

            return(indices.isComplete() && extensionsSupported && swapChainAdequate);
        }
        private QueueFamilyIndices findQueueFamilies(VkPhysicalDevice device)
        {
            QueueFamilyIndices indices = new QueueFamilyIndices();

            int queueFamilyCount = 0;

            Vulkan.vkGetPhysicalDeviceQueueFamilyProperties(device, ref queueFamilyCount, null);
            VkQueueFamilyProperties[] queueFamilies = new VkQueueFamilyProperties[queueFamilyCount];
            Vulkan.vkGetPhysicalDeviceQueueFamilyProperties(device, ref queueFamilyCount, queueFamilies);

            int i = 0;

            foreach (var queueFamily in queueFamilies)
            {
                if (queueFamily.queueCount > 0 && (queueFamily.queueFlags & VkQueueFlagBits.VK_QUEUE_GRAPHICS_BIT) > 0)
                {
                    indices.graphicsFamily = i;
                }

                bool presentSupport = false;
                Vulkan.vkGetPhysicalDeviceSurfaceSupportKHR(device, i, surface, out presentSupport);

                if (queueFamily.queueCount > 0 && presentSupport)
                {
                    indices.presentFamily = i;
                }

                if (indices.isComplete())
                {
                    break;
                }

                i++;
            }

            return(indices);
        }