private bool IsPhysicalDeviceSuitable(VkPhysicalDevice physicalDevice) { QueueFamilyIndices indices = this.FindQueueFamilies(physicalDevice); bool extensionsSupported = this.CheckPhysicalDeviceExtensionSupport(physicalDevice); // acquire Raytracing features VkPhysicalDeviceRayTracingFeaturesKHR rayTracingFeatures = new VkPhysicalDeviceRayTracingFeaturesKHR() { sType = VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_FEATURES_KHR, pNext = null, }; VkPhysicalDeviceFeatures2 deviceFeatures2 = new VkPhysicalDeviceFeatures2() { sType = VkStructureType.VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, pNext = &rayTracingFeatures, }; VulkanNative.vkGetPhysicalDeviceFeatures2(physicalDevice, &deviceFeatures2); extensionsSupported = extensionsSupported && rayTracingFeatures.rayTracing; bool swapChainAdequate = false; if (extensionsSupported) { SwapChainSupportDetails swapChainSupport = this.QuerySwapChainSupport(physicalDevice); swapChainAdequate = (swapChainSupport.formats.Length != 0 && swapChainSupport.presentModes.Length != 0); } return(indices.IsComplete() && extensionsSupported && swapChainAdequate); }
private void FindQueueFamilies(PhysicalDevice device, out QueueFamilyIndices indices) { indices = new QueueFamilyIndices(); var families = QuerryQueueFamilyProperties(device); for (int i = 0; i < families.Length; ++i) { ref QueueFamilyProperties queueFamily = ref families[i]; const QueueFlags GraphicsQueueBits = QueueFlags.QueueGraphicsBit | QueueFlags.QueueTransferBit; if ((queueFamily.QueueFlags & GraphicsQueueBits) == GraphicsQueueBits) { indices.GraphicsFamily = (uint)i; } var res = VkSurface.GetPhysicalDeviceSurfaceSupport(device, (uint)i, this.WindowSurface, out var presentSupport); if (res == Result.Success && presentSupport) { indices.PresentFamily = (uint)i; } if (indices.IsComplete()) { break; } }
private bool IsPhysicalDeviceSuitable(VkPhysicalDevice physicalDevice) { QueueFamilyIndices indices = this.FindQueueFamilies(physicalDevice); bool extensionsSupported = this.CheckPhysicalDeviceExtensionSupport(physicalDevice); bool swapChainAdequate = false; if (extensionsSupported) { SwapChainSupportDetails swapChainSupport = this.QuerySwapChainSupport(physicalDevice); swapChainAdequate = (swapChainSupport.formats.Length != 0 && swapChainSupport.presentModes.Length != 0); } return(indices.IsComplete() && extensionsSupported && swapChainAdequate); }
private QueueFamilyIndices FindQueueFamilies(VkPhysicalDevice physicalDevice) { QueueFamilyIndices indices = default; uint queueFamilyCount = 0; VulkanNative.vkGetPhysicalDeviceQueueFamilyProperties(physicalDevice, &queueFamilyCount, null); VkQueueFamilyProperties *queueFamilies = stackalloc VkQueueFamilyProperties[(int)queueFamilyCount]; VulkanNative.vkGetPhysicalDeviceQueueFamilyProperties(physicalDevice, &queueFamilyCount, queueFamilies); for (uint i = 0; i < queueFamilyCount; i++) { var queueFamily = queueFamilies[i]; if ((queueFamily.queueFlags & VkQueueFlags.VK_QUEUE_GRAPHICS_BIT) != 0) { indices.graphicsFamily = i; } VkBool32 presentSupport = false; Helpers.CheckErrors(VulkanNative.vkGetPhysicalDeviceSurfaceSupportKHR(physicalDevice, i, this.surface, &presentSupport)); if (presentSupport) { indices.presentFamily = i; } if (indices.IsComplete()) { break; } } return(indices); }
private bool IsDeviceSuitable(VkPhysicalDevice physicalDevice) { QueueFamilyIndices indices = this.FindQueueFamilies(physicalDevice); return(indices.IsComplete()); }
private bool IsDeviceSuitable(PhysicalDevice device, out QueueFamilyIndices indices) { FindQueueFamilies(device, out indices); return(indices.IsComplete() && HasAllRequiredExtensions(device) && IsSwapchainSupportAdequate(device)); }