private int?GetPresentQueueFamilyIndex(SurfaceKhr surface) { for (int i = 0; i < queueFamilies.Length; i++) { //Verify that this queue-family supports presenting to the platform compositor switch (surfaceType) { //On windows test if this queue supports presentation to the win32 compositor case SurfaceType.HkrWin32: if (!physicalDevice.GetWin32PresentationSupportKhr(i)) { continue; } break; //On MacOS it is enough to know that the MVK extension is supported, if so we //can also present to the compositor } //Verify that the given surface is compatible with this queue-family if (physicalDevice.GetSurfaceSupportKhr(i, surface)) { return(i); } } return(null); }
/// <summary> /// Check if a queue family supports presenting /// </summary> /// <param name="index"></param> /// <param name="device"></param> /// <param name="surface"></param> /// <returns></returns> public static bool SupportsPresenting(int index, PhysicalDevice device, SurfaceKhr surface) { return(device.GetSurfaceSupportKhr(index, surface) && GetPresentationSupport(device, index)); }