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); }
internal static bool GetPresentationSupport(PhysicalDevice physicalDevice, int queueFamilyIndex) { // Get whether a queue family supports presentation to the platform switch (Environment.OSVersion.Platform) { case PlatformID.Win32NT: return(physicalDevice.GetWin32PresentationSupportKhr(queueFamilyIndex)); //case PlatformID.Unix: //return physicalDevice.GetXlibPresentationSupportKhr(queueFamilyIndex); default: throw new NotImplementedException(); } }
/// <summary> /// Get the presentation support for a queue family on the platform /// </summary> /// <param name="device"></param> /// <param name="queueFamilyIndex"></param> /// <returns></returns> private static bool GetPresentationSupport(PhysicalDevice device, int queueFamilyIndex) { switch (Platform.Type) { case Platform.PlatformType.Win32: return(device.GetWin32PresentationSupportKhr(queueFamilyIndex)); case Platform.PlatformType.Android: case Platform.PlatformType.MacOS: return(true); default: throw new PlatformNotSupportedException( "Getting presentation support is not implemented for this platform" ); } }