/// <summary> /// Signal a fence when a device event occurs. /// </summary> /// <param name="device">A logical device on which the event may occur.</param> /// <param name="deviceEventInfo">A 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 RegisterDeviceEventExt(this Device device, DeviceEventInfoExt deviceEventInfo, AllocationCallbacks? allocator = null) { deviceEventInfo.Prepare(); AllocationCallbacks.Native* nativeAllocator = null; if (allocator.HasValue) { nativeAllocator = (AllocationCallbacks.Native*)Interop.Alloc<AllocationCallbacks.Native>(); allocator.Value.ToNative(nativeAllocator); } long handle; Result result = vkRegisterDeviceEventEXT(device)(device, &deviceEventInfo, nativeAllocator, &handle); Interop.Free(nativeAllocator); VulkanException.ThrowForInvalidResult(result); return new Fence(device, ref allocator, handle); }
/// <summary> /// Create a <see cref="SurfaceKhr"/> object for a VI layer. /// <para> /// During the lifetime of a surface created using a particular `NativeWindowHandle`, any /// attempts to create another surface for the same `Layer` and any attempts to connect to /// the same layer through other platform mechanisms will have undefined results. /// </para> /// <para> /// The <see cref="SurfaceCapabilitiesKhr.CurrentExtent"/> of a VI surface is always /// undefined. Applications are expected to choose an appropriate size for the swapchain's /// <see cref="SwapchainCreateInfoKhr.ImageExtent"/> (e.g., by matching the the result of a /// call to `GetDisplayResolution`). /// </para> /// </summary> /// <param name="instance">The <see cref="Instance"/> to associate with the surface.</param> /// <param name="createInfo"> /// The structure containing the parameters affecting the creation of the surface object. /// </param> /// <param name="allocator"> /// The allocator used for host memory allocated for the surface object. /// </param> /// <returns>The resulting surface object handle.</returns> /// <exception cref="VulkanException">Vulkan returns an error code.</exception> public static SurfaceKhr CreateVISurfaceNN(this Instance instance, VISurfaceCreateInfoNN createInfo, AllocationCallbacks?allocator = null) { createInfo.Prepare(); AllocationCallbacks.Native *nativeAllocator = null; if (allocator.HasValue) { nativeAllocator = (AllocationCallbacks.Native *)Interop.Alloc <AllocationCallbacks.Native>(); allocator.Value.ToNative(nativeAllocator); } long handle; Result result = vkCreateViSurfaceNN(instance)(instance, &createInfo, nativeAllocator, &handle); Interop.Free(nativeAllocator); VulkanException.ThrowForInvalidResult(result); return(new SurfaceKhr(instance, ref allocator, handle)); }