/// <summary> /// Set the power state of a display. /// </summary> /// <param name="device">The display whose power state is modified.</param> /// <param name="display">A logical device associated with <paramref name="display"/>.</param> /// <param name="displayPowerInfo">Specifies the new power state of <paramref name="display"/>.</param> /// <exception cref="VulkanException">Vulkan returns an error code.</exception> public static void DisplayPowerControlExt(this Device device, DisplayKhr display, DisplayPowerInfoExt displayPowerInfo) { displayPowerInfo.Prepare(); Result result = vkDisplayPowerControlEXT(device)(device, display, &displayPowerInfo); VulkanException.ThrowForInvalidResult(result); }
/// <summary> /// Signal a fence when a display event occurs. /// </summary> /// <param name="device">A logical device associated with <paramref name="display"/>.</param> /// <param name="display">The display on which the event may occur.</param> /// <param name="displayEventInfo"> /// The structure describing the event of interest to the application. /// </param> /// <param name="allocator">Controls host memory allocation.</param> /// <returns>The resulting fence object.</returns> /// <exception cref="VulkanException">Vulkan returns an error code.</exception> public static Fence RegisterDisplayEventExt(this Device device, DisplayKhr display, DisplayEventInfoExt displayEventInfo, AllocationCallbacks? allocator = null) { displayEventInfo.Prepare(); AllocationCallbacks.Native* nativeAllocator = null; if (allocator.HasValue) { nativeAllocator = (AllocationCallbacks.Native*)Interop.Alloc<AllocationCallbacks.Native>(); allocator.Value.ToNative(nativeAllocator); } long handle; Result result = vkRegisterDisplayEventEXT(device)(device, display, &displayEventInfo, nativeAllocator, &handle); Interop.Free(nativeAllocator); VulkanException.ThrowForInvalidResult(result); return new Fence(device, ref allocator, handle); }
internal static unsafe extern Result vkCreateDisplayModeKHR(PhysicalDevice physicalDevice, DisplayKhr display, DisplayModeCreateInfoKhr *CreateInfo, AllocationCallbacks *Allocator, out IntPtr pMode);
internal static unsafe extern Result vkGetDisplayModePropertiesKHR(PhysicalDevice physicalDevice, DisplayKhr display, out UInt32 *PropertyCount, DisplayModePropertiesKhr *Properties);
private static TDelegate GetProc <TDelegate>(DisplayKhr display, string name) where TDelegate : class => display.Parent.Parent.GetProc <TDelegate>(name);
private static vkReleaseDisplayEXTDelegate vkReleaseDisplayEXT(DisplayKhr display) => GetProc <vkReleaseDisplayEXTDelegate>(display, nameof(vkReleaseDisplayEXT));
private static vkAcquireXlibDisplayEXTDelegate vkAcquireXlibDisplayEXT(DisplayKhr display) => GetProc <vkAcquireXlibDisplayEXTDelegate>(display, nameof(vkAcquireXlibDisplayEXT));
/// <summary> /// Release access to an acquired DisplayKhr. /// </summary> /// <param name="display">The display to release control of.</param> /// <exception cref="VulkanException">Vulkan returns an error code.</exception> public static void ReleaseDisplayExt(this DisplayKhr display) { Result result = vkReleaseDisplayEXT(display)(display.Parent, display); VulkanException.ThrowForInvalidResult(result); }
/// <summary> /// Acquire access to a DisplayKhr using Xlib. /// <para> /// All permissions necessary to control the display are granted to the Vulkan instance /// associated with <see cref="PhysicalDevice"/> until the display is released or the X11 /// connection specified by <paramref name="dpy"/> is terminated. /// </para> /// <para> /// Permission to access the display may be temporarily revoked during periods when the X11 /// server from which control was acquired itself looses access to <paramref name="display"/>. /// </para> /// <para> /// During such periods, operations which require access to the display must fail with an /// approriate error code. /// </para> /// <para> /// If the X11 server associated with <paramref name="dpy"/> does not own <paramref /// name="display"/>, or if permission to access it has already been acquired by another /// entity, the call must throw with the error code <see cref="Result.ErrorInitializationFailed"/>. /// </para> /// </summary> /// <param name="display"></param> /// <param name="dpy"></param> /// <exception cref="VulkanException">Vulkan returns an error code.</exception> public static void AcquireXlibDisplayExt(this DisplayKhr display, IntPtr dpy) { Result result = vkAcquireXlibDisplayEXT(display)(display.Parent, &dpy, display); VulkanException.ThrowForInvalidResult(result); }