/// <summary> /// Query the DisplayKHR corresponding to an X11 RandR Output. /// </summary> /// <param name="extendedHandle"> /// The PhysicalDevice handle to extend. /// </param> public static unsafe SharpVk.Khronos.Display GetRandROutputDisplay(this SharpVk.PhysicalDevice extendedHandle, IntPtr dpy, IntPtr rrOutput) { try { SharpVk.Khronos.Display result = default(SharpVk.Khronos.Display); CommandCache commandCache = default(CommandCache); IntPtr *marshalledDpy = default(IntPtr *); SharpVk.Interop.Khronos.Display marshalledDisplay = default(SharpVk.Interop.Khronos.Display); commandCache = extendedHandle.commandCache; marshalledDpy = (IntPtr *)(Interop.HeapUtil.Allocate <IntPtr>()); *marshalledDpy = dpy; SharpVk.Interop.Multivendor.VkPhysicalDeviceGetRandROutputDisplayDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Multivendor.VkPhysicalDeviceGetRandROutputDisplayDelegate>("vkGetRandROutputDisplayEXT", "instance"); Result methodResult = commandDelegate(extendedHandle.handle, marshalledDpy, rrOutput, &marshalledDisplay); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } result = new SharpVk.Khronos.Display(marshalledDisplay); return(result); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// Query the list of displays a plane supports. /// </summary> /// <param name="extendedHandle"> /// The PhysicalDevice handle to extend. /// </param> public static unsafe SharpVk.Khronos.Display[] GetDisplayPlaneSupportedDisplays(this SharpVk.PhysicalDevice extendedHandle, uint planeIndex) { try { SharpVk.Khronos.Display[] result = default(SharpVk.Khronos.Display[]); uint marshalledDisplayCount = default(uint); CommandCache commandCache = default(CommandCache); SharpVk.Interop.Khronos.Display *marshalledDisplays = default(SharpVk.Interop.Khronos.Display *); commandCache = extendedHandle.commandCache; SharpVk.Interop.Khronos.VkPhysicalDeviceGetDisplayPlaneSupportedDisplaysDelegate commandDelegate = commandCache.Cache.vkGetDisplayPlaneSupportedDisplaysKHR; Result methodResult = commandDelegate(extendedHandle.handle, planeIndex, &marshalledDisplayCount, marshalledDisplays); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } marshalledDisplays = (SharpVk.Interop.Khronos.Display *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.Display>((uint)(marshalledDisplayCount))); commandDelegate(extendedHandle.handle, planeIndex, &marshalledDisplayCount, marshalledDisplays); if (marshalledDisplays != null) { var fieldPointer = new SharpVk.Khronos.Display[(uint)(marshalledDisplayCount)]; for (int index = 0; index < (uint)(marshalledDisplayCount); index++) { fieldPointer[index] = new SharpVk.Khronos.Display(marshalledDisplays[index]); } result = fieldPointer; } else { result = null; } return(result); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> public static unsafe void DisplayPowerControl(this SharpVk.Device extendedHandle, SharpVk.Khronos.Display display, SharpVk.Multivendor.DisplayPowerInfo displayPowerInfo) { try { CommandCache commandCache = default(CommandCache); SharpVk.Interop.Multivendor.DisplayPowerInfo *marshalledDisplayPowerInfo = default(SharpVk.Interop.Multivendor.DisplayPowerInfo *); commandCache = extendedHandle.commandCache; marshalledDisplayPowerInfo = (SharpVk.Interop.Multivendor.DisplayPowerInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Multivendor.DisplayPowerInfo>()); displayPowerInfo.MarshalTo(marshalledDisplayPowerInfo); SharpVk.Interop.Multivendor.VkDeviceDisplayPowerControlDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Multivendor.VkDeviceDisplayPowerControlDelegate>("vkDisplayPowerControlEXT", "instance"); Result methodResult = commandDelegate(extendedHandle.handle, display?.handle ?? default(SharpVk.Interop.Khronos.Display), marshalledDisplayPowerInfo); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> public static unsafe SharpVk.Fence RegisterDisplayEvent(this SharpVk.Device extendedHandle, SharpVk.Khronos.Display display, SharpVk.Multivendor.DisplayEventInfo displayEventInfo, SharpVk.AllocationCallbacks allocator) { try { SharpVk.Fence result = default(SharpVk.Fence); CommandCache commandCache = default(CommandCache); SharpVk.Interop.Multivendor.DisplayEventInfo *marshalledDisplayEventInfo = default(SharpVk.Interop.Multivendor.DisplayEventInfo *); SharpVk.Interop.AllocationCallbacks * marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *); SharpVk.Interop.Fence marshalledFence = default(SharpVk.Interop.Fence); commandCache = extendedHandle.commandCache; marshalledDisplayEventInfo = (SharpVk.Interop.Multivendor.DisplayEventInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Multivendor.DisplayEventInfo>()); displayEventInfo.MarshalTo(marshalledDisplayEventInfo); marshalledAllocator = (SharpVk.Interop.AllocationCallbacks *)(Interop.HeapUtil.Allocate <SharpVk.Interop.AllocationCallbacks>()); allocator.MarshalTo(marshalledAllocator); SharpVk.Interop.Multivendor.VkDeviceRegisterDisplayEventDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Multivendor.VkDeviceRegisterDisplayEventDelegate>("vkRegisterDisplayEventEXT", "instance"); Result methodResult = commandDelegate(extendedHandle.handle, display?.handle ?? default(SharpVk.Interop.Khronos.Display), marshalledDisplayEventInfo, marshalledAllocator, &marshalledFence); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } result = new SharpVk.Fence(extendedHandle, marshalledFence); return(result); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> /// <param name="extendedHandle"> /// The PhysicalDevice handle to extend. /// </param> public static unsafe SharpVk.Khronos.DisplayModeProperties2[] GetDisplayModeProperties2(this SharpVk.PhysicalDevice extendedHandle, SharpVk.Khronos.Display display) { try { SharpVk.Khronos.DisplayModeProperties2[] result = default(SharpVk.Khronos.DisplayModeProperties2[]); uint marshalledPropertyCount = default(uint); CommandCache commandCache = default(CommandCache); SharpVk.Interop.Khronos.DisplayModeProperties2 *marshalledProperties = default(SharpVk.Interop.Khronos.DisplayModeProperties2 *); commandCache = extendedHandle.commandCache; SharpVk.Interop.Khronos.VkPhysicalDeviceGetDisplayModeProperties2Delegate commandDelegate = commandCache.Cache.vkGetDisplayModeProperties2KHR; Result methodResult = commandDelegate(extendedHandle.handle, display?.handle ?? default(SharpVk.Interop.Khronos.Display), &marshalledPropertyCount, marshalledProperties); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } marshalledProperties = (SharpVk.Interop.Khronos.DisplayModeProperties2 *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.DisplayModeProperties2>((uint)(marshalledPropertyCount))); commandDelegate(extendedHandle.handle, display?.handle ?? default(SharpVk.Interop.Khronos.Display), &marshalledPropertyCount, marshalledProperties); if (marshalledProperties != null) { var fieldPointer = new SharpVk.Khronos.DisplayModeProperties2[(uint)(marshalledPropertyCount)]; for (int index = 0; index < (uint)(marshalledPropertyCount); index++) { fieldPointer[index] = SharpVk.Khronos.DisplayModeProperties2.MarshalFrom(&marshalledProperties[index]); } result = fieldPointer; } else { result = null; } return(result); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// Create a display mode. /// </summary> /// <param name="extendedHandle"> /// The PhysicalDevice handle to extend. /// </param> /// <param name="flags"> /// Reserved for future use, and must be zero. /// </param> /// <param name="parameters"> /// A DisplayModeParametersKHR structure describing the display /// parameters to use in creating the new mode. If the parameters are /// not compatible with the specified display, the implementation must /// return Result.ErrorINITIALIZATION_FAILED. /// </param> /// <param name="allocator"> /// An optional AllocationCallbacks instance that controls host memory /// allocation. /// </param> public static unsafe SharpVk.Khronos.DisplayMode CreateDisplayMode(this SharpVk.PhysicalDevice extendedHandle, SharpVk.Khronos.Display display, SharpVk.Khronos.DisplayModeParameters parameters, SharpVk.Khronos.DisplayModeCreateFlags?flags = default(SharpVk.Khronos.DisplayModeCreateFlags?), SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?)) { try { SharpVk.Khronos.DisplayMode result = default(SharpVk.Khronos.DisplayMode); CommandCache commandCache = default(CommandCache); SharpVk.Interop.Khronos.DisplayModeCreateInfo *marshalledCreateInfo = default(SharpVk.Interop.Khronos.DisplayModeCreateInfo *); void *nextPointer = default(void *); SharpVk.Interop.AllocationCallbacks *marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *); SharpVk.Interop.Khronos.DisplayMode marshalledMode = default(SharpVk.Interop.Khronos.DisplayMode); commandCache = extendedHandle.commandCache; marshalledCreateInfo = (SharpVk.Interop.Khronos.DisplayModeCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.DisplayModeCreateInfo>()); marshalledCreateInfo->SType = StructureType.DisplayModeCreateInfo; marshalledCreateInfo->Next = nextPointer; if (flags != null) { marshalledCreateInfo->Flags = flags.Value; } else { marshalledCreateInfo->Flags = default(SharpVk.Khronos.DisplayModeCreateFlags); } marshalledCreateInfo->Parameters = parameters; if (allocator != null) { marshalledAllocator = (SharpVk.Interop.AllocationCallbacks *)(Interop.HeapUtil.Allocate <SharpVk.Interop.AllocationCallbacks>()); allocator.Value.MarshalTo(marshalledAllocator); } else { marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *); } SharpVk.Interop.Khronos.VkPhysicalDeviceCreateDisplayModeDelegate commandDelegate = commandCache.Cache.vkCreateDisplayModeKHR; Result methodResult = commandDelegate(extendedHandle.handle, display?.handle ?? default(SharpVk.Interop.Khronos.Display), marshalledCreateInfo, marshalledAllocator, &marshalledMode); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } result = new SharpVk.Khronos.DisplayMode(extendedHandle, marshalledMode); return(result); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// Acquire access to a Display using Xlib. /// </summary> /// <param name="extendedHandle"> /// The PhysicalDevice handle to extend. /// </param> /// <param name="dpy"> /// A connection to the X11 server that currently owns the display. /// </param> /// <param name="display"> /// The display the caller wishes to control in Vulkan. /// </param> public static unsafe void AcquireXlibDisplay(this SharpVk.PhysicalDevice extendedHandle, IntPtr dpy, SharpVk.Khronos.Display display) { try { CommandCache commandCache = default(CommandCache); IntPtr * marshalledDpy = default(IntPtr *); commandCache = extendedHandle.commandCache; marshalledDpy = (IntPtr *)(Interop.HeapUtil.Allocate <IntPtr>()); *marshalledDpy = dpy; SharpVk.Interop.Multivendor.VkPhysicalDeviceAcquireXlibDisplayDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Multivendor.VkPhysicalDeviceAcquireXlibDisplayDelegate>("vkAcquireXlibDisplayEXT", "instance"); Result methodResult = commandDelegate(extendedHandle.handle, marshalledDpy, display?.handle ?? default(SharpVk.Interop.Khronos.Display)); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// Release access to an acquired Display. /// </summary> /// <param name="extendedHandle"> /// The PhysicalDevice handle to extend. /// </param> public static unsafe void ReleaseDisplay(this SharpVk.PhysicalDevice extendedHandle, SharpVk.Khronos.Display display) { try { CommandCache commandCache = default(CommandCache); commandCache = extendedHandle.commandCache; SharpVk.Interop.Multivendor.VkPhysicalDeviceReleaseDisplayDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Multivendor.VkPhysicalDeviceReleaseDisplayDelegate>("vkReleaseDisplayEXT", "instance"); Result methodResult = commandDelegate(extendedHandle.handle, display?.handle ?? default(SharpVk.Interop.Khronos.Display)); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } } finally { Interop.HeapUtil.FreeAll(); } }