/// <summary> /// /// </summary> public static unsafe uint AcquireNextImage2(this SharpVk.Device extendedHandle, SharpVk.Khronos.Experimental.AcquireNextImageInfo acquireInfo) { try { uint result = default(uint); CommandCache commandCache = default(CommandCache); SharpVk.Interop.Khronos.Experimental.AcquireNextImageInfo *marshalledAcquireInfo = default(SharpVk.Interop.Khronos.Experimental.AcquireNextImageInfo *); uint marshalledImageIndex = default(uint); commandCache = extendedHandle.commandCache; marshalledAcquireInfo = (SharpVk.Interop.Khronos.Experimental.AcquireNextImageInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.Experimental.AcquireNextImageInfo>()); acquireInfo.MarshalTo(marshalledAcquireInfo); SharpVk.Interop.Khronos.Experimental.VkDeviceAcquireNextImage2Delegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Khronos.Experimental.VkDeviceAcquireNextImage2Delegate>("vkAcquireNextImage2KHX", "instance"); Result methodResult = commandDelegate(extendedHandle.handle, marshalledAcquireInfo, &marshalledImageIndex); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } result = marshalledImageIndex; return(result); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> /// <param name="extendedHandle"> /// The Device handle to extend. /// </param> public static unsafe SharpVk.RenderPass CreateRenderPass2(this SharpVk.Device extendedHandle, SharpVk.Khronos.RenderPassCreateInfo2 createInfo, SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?)) { try { SharpVk.RenderPass result = default(SharpVk.RenderPass); CommandCache commandCache = default(CommandCache); SharpVk.Interop.Khronos.RenderPassCreateInfo2 *marshalledCreateInfo = default(SharpVk.Interop.Khronos.RenderPassCreateInfo2 *); SharpVk.Interop.AllocationCallbacks * marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *); SharpVk.Interop.RenderPass marshalledRenderPass = default(SharpVk.Interop.RenderPass); commandCache = extendedHandle.commandCache; marshalledCreateInfo = (SharpVk.Interop.Khronos.RenderPassCreateInfo2 *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.RenderPassCreateInfo2>()); createInfo.MarshalTo(marshalledCreateInfo); 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.VkDeviceCreateRenderPass2Delegate commandDelegate = commandCache.Cache.vkCreateRenderPass2KHR; Result methodResult = commandDelegate(extendedHandle.handle, marshalledCreateInfo, marshalledAllocator, &marshalledRenderPass); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } result = new SharpVk.RenderPass(extendedHandle, marshalledRenderPass); return(result); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> public unsafe byte[] GetData() { try { byte[] result = default(byte[]); HostSize dataSize = default(HostSize); byte * marshalledData = default(byte *); SharpVk.Interop.Multivendor.VkValidationCacheEXTGetDataDelegate commandDelegate = commandCache.Cache.vkGetValidationCacheDataEXT; Result methodResult = commandDelegate(this.parent.handle, this.handle, &dataSize, marshalledData); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } marshalledData = (byte *)(Interop.HeapUtil.Allocate <byte>((uint)(dataSize))); commandDelegate(this.parent.handle, this.handle, &dataSize, marshalledData); if (marshalledData != null) { var fieldPointer = new byte[(uint)(dataSize)]; for (int index = 0; index < (uint)(dataSize); index++) { fieldPointer[index] = marshalledData[index]; } result = fieldPointer; } else { result = null; } return(result); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> public static unsafe SharpVk.Khronos.ImageFormatProperties2 GetImageFormatProperties2(this SharpVk.PhysicalDevice extendedHandle, SharpVk.Khronos.PhysicalDeviceImageFormatInfo2 imageFormatInfo) { try { SharpVk.Khronos.ImageFormatProperties2 result = default(SharpVk.Khronos.ImageFormatProperties2); CommandCache commandCache = default(CommandCache); SharpVk.Interop.Khronos.PhysicalDeviceImageFormatInfo2 *marshalledImageFormatInfo = default(SharpVk.Interop.Khronos.PhysicalDeviceImageFormatInfo2 *); SharpVk.Interop.Khronos.ImageFormatProperties2 marshalledImageFormatProperties = default(SharpVk.Interop.Khronos.ImageFormatProperties2); commandCache = extendedHandle.commandCache; marshalledImageFormatInfo = (SharpVk.Interop.Khronos.PhysicalDeviceImageFormatInfo2 *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.PhysicalDeviceImageFormatInfo2>()); imageFormatInfo.MarshalTo(marshalledImageFormatInfo); SharpVk.Interop.Khronos.VkPhysicalDeviceGetImageFormatProperties2Delegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Khronos.VkPhysicalDeviceGetImageFormatProperties2Delegate>("vkGetPhysicalDeviceImageFormatProperties2KHR", "instance"); Result methodResult = commandDelegate(extendedHandle.handle, marshalledImageFormatInfo, &marshalledImageFormatProperties); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } result = SharpVk.Khronos.ImageFormatProperties2.MarshalFrom(&marshalledImageFormatProperties); return(result); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// Obtain the array of presentable images associated with a swapchain. /// </summary> public unsafe SharpVk.Image[] GetImages() { try { SharpVk.Image[] result = default(SharpVk.Image[]); uint swapchainImageCount = default(uint); SharpVk.Interop.Image *marshalledSwapchainImages = default(SharpVk.Interop.Image *); SharpVk.Interop.Khronos.VkSwapchainKHRGetImagesDelegate commandDelegate = commandCache.Cache.vkGetSwapchainImagesKHR; Result methodResult = commandDelegate(this.parent.handle, this.handle, &swapchainImageCount, marshalledSwapchainImages); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } marshalledSwapchainImages = (SharpVk.Interop.Image *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Image>((uint)(swapchainImageCount))); commandDelegate(this.parent.handle, this.handle, &swapchainImageCount, marshalledSwapchainImages); if (marshalledSwapchainImages != null) { var fieldPointer = new SharpVk.Image[(uint)(swapchainImageCount)]; for (int index = 0; index < (uint)(swapchainImageCount); index++) { fieldPointer[index] = new SharpVk.Image(this.parent, marshalledSwapchainImages[index]); } result = fieldPointer; } else { result = null; } return(result); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> /// <param name="extendedHandle"> /// The Device handle to extend. /// </param> /// <param name="pipelineBindPoint"> /// The PipelineBindPoint that this layout targets. /// </param> /// <param name="flags"> /// A bitmask providing usage hints of this layout. See /// IndirectCommandsLayoutUsageFlagBitsNVX below for a description of /// the supported bits. /// </param> /// <param name="allocator"> /// An optional AllocationCallbacks instance that controls host memory /// allocation. /// </param> public static unsafe SharpVk.NVidia.Experimental.IndirectCommandsLayout CreateIndirectCommandsLayout(this SharpVk.Device extendedHandle, SharpVk.PipelineBindPoint pipelineBindPoint, SharpVk.NVidia.Experimental.IndirectCommandsLayoutUsageFlags flags, ArrayProxy <SharpVk.NVidia.Experimental.IndirectCommandsLayoutToken>?tokens, SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?)) { try { SharpVk.NVidia.Experimental.IndirectCommandsLayout result = default(SharpVk.NVidia.Experimental.IndirectCommandsLayout); CommandCache commandCache = default(CommandCache); SharpVk.Interop.NVidia.Experimental.IndirectCommandsLayoutCreateInfo *marshalledCreateInfo = default(SharpVk.Interop.NVidia.Experimental.IndirectCommandsLayoutCreateInfo *); SharpVk.Interop.AllocationCallbacks *marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *); SharpVk.Interop.NVidia.Experimental.IndirectCommandsLayout marshalledIndirectCommandsLayout = default(SharpVk.Interop.NVidia.Experimental.IndirectCommandsLayout); commandCache = extendedHandle.commandCache; marshalledCreateInfo = (SharpVk.Interop.NVidia.Experimental.IndirectCommandsLayoutCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.NVidia.Experimental.IndirectCommandsLayoutCreateInfo>()); marshalledCreateInfo->SType = StructureType.IndirectCommandsLayoutCreateInfoNvx; marshalledCreateInfo->Next = null; marshalledCreateInfo->PipelineBindPoint = pipelineBindPoint; marshalledCreateInfo->Flags = flags; marshalledCreateInfo->TokenCount = (uint)(Interop.HeapUtil.GetLength(tokens)); if (tokens.IsNull()) { marshalledCreateInfo->Tokens = null; } else { if (tokens.Value.Contents == ProxyContents.Single) { marshalledCreateInfo->Tokens = (SharpVk.NVidia.Experimental.IndirectCommandsLayoutToken *)(Interop.HeapUtil.Allocate <SharpVk.NVidia.Experimental.IndirectCommandsLayoutToken>()); *(SharpVk.NVidia.Experimental.IndirectCommandsLayoutToken *)(marshalledCreateInfo->Tokens) = tokens.Value.GetSingleValue(); } else { var fieldPointer = (SharpVk.NVidia.Experimental.IndirectCommandsLayoutToken *)(Interop.HeapUtil.AllocateAndClear <SharpVk.NVidia.Experimental.IndirectCommandsLayoutToken>(Interop.HeapUtil.GetLength(tokens.Value)).ToPointer()); for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(tokens.Value)); index++) { fieldPointer[index] = tokens.Value[index]; } marshalledCreateInfo->Tokens = fieldPointer; } } 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.NVidia.Experimental.VkDeviceCreateIndirectCommandsLayoutDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.NVidia.Experimental.VkDeviceCreateIndirectCommandsLayoutDelegate>("vkCreateIndirectCommandsLayoutNVX", "instance"); Result methodResult = commandDelegate(extendedHandle.handle, marshalledCreateInfo, marshalledAllocator, &marshalledIndirectCommandsLayout); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } result = new SharpVk.NVidia.Experimental.IndirectCommandsLayout(extendedHandle, marshalledIndirectCommandsLayout); return(result); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> public static unsafe int GetFenceFileDescriptor(this SharpVk.Device extendedHandle, SharpVk.Khronos.FenceGetFileDescriptorInfo getFileDescriptorInfo) { try { int result = default(int); CommandCache commandCache = default(CommandCache); SharpVk.Interop.Khronos.FenceGetFileDescriptorInfo *marshalledGetFileDescriptorInfo = default(SharpVk.Interop.Khronos.FenceGetFileDescriptorInfo *); int marshalledFileDescriptor = default(int); commandCache = extendedHandle.commandCache; marshalledGetFileDescriptorInfo = (SharpVk.Interop.Khronos.FenceGetFileDescriptorInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.FenceGetFileDescriptorInfo>()); getFileDescriptorInfo.MarshalTo(marshalledGetFileDescriptorInfo); SharpVk.Interop.Khronos.VkDeviceGetFenceFileDescriptorDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Khronos.VkDeviceGetFenceFileDescriptorDelegate>("vkGetFenceFdKHR", "instance"); Result methodResult = commandDelegate(extendedHandle.handle, marshalledGetFileDescriptorInfo, &marshalledFileDescriptor); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } result = marshalledFileDescriptor; return(result); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> /// <param name="extendedHandle"> /// The PhysicalDevice handle to extend. /// </param> public static unsafe SharpVk.Khronos.DisplayPlaneCapabilities2 GetDisplayPlaneCapabilities2(this SharpVk.PhysicalDevice extendedHandle, SharpVk.Khronos.DisplayPlaneInfo2 displayPlaneInfo) { try { SharpVk.Khronos.DisplayPlaneCapabilities2 result = default(SharpVk.Khronos.DisplayPlaneCapabilities2); CommandCache commandCache = default(CommandCache); SharpVk.Interop.Khronos.DisplayPlaneInfo2 * marshalledDisplayPlaneInfo = default(SharpVk.Interop.Khronos.DisplayPlaneInfo2 *); SharpVk.Interop.Khronos.DisplayPlaneCapabilities2 marshalledCapabilities = default(SharpVk.Interop.Khronos.DisplayPlaneCapabilities2); commandCache = extendedHandle.commandCache; marshalledDisplayPlaneInfo = (SharpVk.Interop.Khronos.DisplayPlaneInfo2 *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.DisplayPlaneInfo2>()); displayPlaneInfo.MarshalTo(marshalledDisplayPlaneInfo); SharpVk.Interop.Khronos.VkPhysicalDeviceGetDisplayPlaneCapabilities2Delegate commandDelegate = commandCache.Cache.vkGetDisplayPlaneCapabilities2KHR; Result methodResult = commandDelegate(extendedHandle.handle, marshalledDisplayPlaneInfo, &marshalledCapabilities); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } result = SharpVk.Khronos.DisplayPlaneCapabilities2.MarshalFrom(&marshalledCapabilities); return(result); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> public static unsafe void BindImageMemory2(this SharpVk.Device extendedHandle, SharpVk.Khronos.Experimental.BindImageMemoryInfo[] bindInfos) { try { CommandCache commandCache = default(CommandCache); SharpVk.Interop.Khronos.Experimental.BindImageMemoryInfo *marshalledBindInfos = default(SharpVk.Interop.Khronos.Experimental.BindImageMemoryInfo *); commandCache = extendedHandle.commandCache; if (bindInfos != null) { var fieldPointer = (SharpVk.Interop.Khronos.Experimental.BindImageMemoryInfo *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.Khronos.Experimental.BindImageMemoryInfo>(bindInfos.Length).ToPointer()); for (int index = 0; index < (uint)(bindInfos.Length); index++) { bindInfos[index].MarshalTo(&fieldPointer[index]); } marshalledBindInfos = fieldPointer; } else { marshalledBindInfos = null; } SharpVk.Interop.Khronos.Experimental.VkDeviceBindImageMemory2Delegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Khronos.Experimental.VkDeviceBindImageMemory2Delegate>("vkBindImageMemory2KHX", "instance"); Result methodResult = commandDelegate(extendedHandle.handle, (uint)(bindInfos?.Length ?? 0), marshalledBindInfos); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> public unsafe byte[] GetHandle(HostSize dataSize) { try { byte[] result = default(byte[]); HostSize marshalledDataSize = default(HostSize); byte * marshalledData = default(byte *); marshalledDataSize = dataSize; marshalledData = (byte *)(Interop.HeapUtil.Allocate <byte>(marshalledDataSize)); SharpVk.Interop.NVidia.VkAccelerationStructureNVGetHandleDelegate commandDelegate = commandCache.Cache.vkGetAccelerationStructureHandleNV; Result methodResult = commandDelegate(this.parent.handle, this.handle, marshalledDataSize, marshalledData); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } if (marshalledData != null) { var fieldPointer = new byte[(uint)(marshalledDataSize)]; for (int index = 0; index < (uint)(marshalledDataSize); index++) { fieldPointer[index] = marshalledData[index]; } result = fieldPointer; } else { result = null; } return(result); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// Acquire the performance query capability /// </summary> /// <param name="extendedHandle"> /// The Device handle to extend. /// </param> /// <param name="type"> /// One of the VkPerformanceConfigurationTypeINTEL type of performance /// configuration that will be acquired. /// </param> public static unsafe SharpVk.Intel.PerformanceConfiguration AcquirePerformanceConfiguration(this SharpVk.Device extendedHandle, SharpVk.Intel.PerformanceConfigurationType type) { try { SharpVk.Intel.PerformanceConfiguration result = default(SharpVk.Intel.PerformanceConfiguration); CommandCache commandCache = default(CommandCache); SharpVk.Interop.Intel.PerformanceConfigurationAcquireInfo *marshalledAcquireInfo = default(SharpVk.Interop.Intel.PerformanceConfigurationAcquireInfo *); void *nextPointer = default(void *); SharpVk.Interop.Intel.PerformanceConfiguration marshalledConfiguration = default(SharpVk.Interop.Intel.PerformanceConfiguration); commandCache = extendedHandle.commandCache; marshalledAcquireInfo = (SharpVk.Interop.Intel.PerformanceConfigurationAcquireInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Intel.PerformanceConfigurationAcquireInfo>()); marshalledAcquireInfo->SType = StructureType.PerformanceConfigurationAcquireInfo; marshalledAcquireInfo->Next = nextPointer; marshalledAcquireInfo->Type = type; SharpVk.Interop.Intel.VkDeviceAcquirePerformanceConfigurationDelegate commandDelegate = commandCache.Cache.vkAcquirePerformanceConfigurationINTEL; Result methodResult = commandDelegate(extendedHandle.handle, marshalledAcquireInfo, &marshalledConfiguration); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } result = new SharpVk.Intel.PerformanceConfiguration(extendedHandle, marshalledConfiguration); return(result); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// Query device group present capabilities for a surface /// </summary> /// <param name="extendedHandle"> /// The Device handle to extend. /// </param> /// <param name="surfaceInfo"> /// An instance of the VkPhysicalDeviceSurfaceInfo2KHR structure, /// describing the surface and other fixed parameters that would be /// consumed by vkCreateSwapchainKHR. /// </param> public static unsafe SharpVk.Khronos.DeviceGroupPresentModeFlags GetGroupSurfacePresentModes2(this SharpVk.Device extendedHandle, SharpVk.Khronos.PhysicalDeviceSurfaceInfo2 surfaceInfo) { try { SharpVk.Khronos.DeviceGroupPresentModeFlags result = default(SharpVk.Khronos.DeviceGroupPresentModeFlags); CommandCache commandCache = default(CommandCache); SharpVk.Interop.Khronos.PhysicalDeviceSurfaceInfo2 *marshalledSurfaceInfo = default(SharpVk.Interop.Khronos.PhysicalDeviceSurfaceInfo2 *); SharpVk.Khronos.DeviceGroupPresentModeFlags marshalledModes = default(SharpVk.Khronos.DeviceGroupPresentModeFlags); commandCache = extendedHandle.commandCache; marshalledSurfaceInfo = (SharpVk.Interop.Khronos.PhysicalDeviceSurfaceInfo2 *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.PhysicalDeviceSurfaceInfo2>()); surfaceInfo.MarshalTo(marshalledSurfaceInfo); SharpVk.Interop.Multivendor.VkDeviceGetGroupSurfacePresentModes2Delegate commandDelegate = commandCache.Cache.vkGetDeviceGroupSurfacePresentModes2EXT; Result methodResult = commandDelegate(extendedHandle.handle, marshalledSurfaceInfo, &marshalledModes); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } result = marshalledModes; return(result); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// Signal a fence when a device event occurs. /// </summary> /// <param name="extendedHandle"> /// The Device handle to extend. /// </param> /// <param name="deviceEventInfo"> /// </param> /// <param name="allocator"> /// An optional AllocationCallbacks instance that controls host memory /// allocation. /// </param> public static unsafe SharpVk.Fence RegisterEvent(this SharpVk.Device extendedHandle, SharpVk.Multivendor.DeviceEventInfo deviceEventInfo, SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?)) { try { SharpVk.Fence result = default(SharpVk.Fence); CommandCache commandCache = default(CommandCache); SharpVk.Interop.Multivendor.DeviceEventInfo *marshalledDeviceEventInfo = default(SharpVk.Interop.Multivendor.DeviceEventInfo *); SharpVk.Interop.AllocationCallbacks * marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *); SharpVk.Interop.Fence marshalledFence = default(SharpVk.Interop.Fence); commandCache = extendedHandle.commandCache; marshalledDeviceEventInfo = (SharpVk.Interop.Multivendor.DeviceEventInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Multivendor.DeviceEventInfo>()); deviceEventInfo.MarshalTo(marshalledDeviceEventInfo); 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.Multivendor.VkDeviceRegisterEventDelegate commandDelegate = commandCache.Cache.vkRegisterDeviceEventEXT; Result methodResult = commandDelegate(extendedHandle.handle, marshalledDeviceEventInfo, marshalledAllocator, &marshalledFence); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } result = new SharpVk.Fence(extendedHandle, marshalledFence); return(result); } 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 Device handle to extend. /// </param> /// <param name="buffer"> /// </param> public static unsafe SharpVk.Android.AndroidHardwareBufferProperties GetAndroidHardwareBufferProperties(this SharpVk.Device extendedHandle, IntPtr buffer) { try { SharpVk.Android.AndroidHardwareBufferProperties result = default(SharpVk.Android.AndroidHardwareBufferProperties); CommandCache commandCache = default(CommandCache); IntPtr * marshalledBuffer = default(IntPtr *); SharpVk.Interop.Android.AndroidHardwareBufferProperties marshalledProperties = default(SharpVk.Interop.Android.AndroidHardwareBufferProperties); commandCache = extendedHandle.commandCache; marshalledBuffer = (IntPtr *)(Interop.HeapUtil.Allocate <IntPtr>()); *marshalledBuffer = buffer; SharpVk.Interop.Android.VkDeviceGetAndroidHardwareBufferPropertiesDelegate commandDelegate = commandCache.Cache.vkGetAndroidHardwareBufferPropertiesANDROID; Result methodResult = commandDelegate(extendedHandle.handle, marshalledBuffer, &marshalledProperties); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } result = SharpVk.Android.AndroidHardwareBufferProperties.MarshalFrom(&marshalledProperties); return(result); } finally { Interop.HeapUtil.FreeAll(); } }
/// <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> /// /// </summary> public unsafe void UnregisterObjects(ArrayProxy <SharpVk.NVidia.Experimental.ObjectEntryType>?objectEntryTypes, ArrayProxy <uint>?objectIndices) { try { SharpVk.NVidia.Experimental.ObjectEntryType *marshalledObjectEntryTypes = default(SharpVk.NVidia.Experimental.ObjectEntryType *); uint *marshalledObjectIndices = default(uint *); if (objectEntryTypes.IsNull()) { marshalledObjectEntryTypes = null; } else { if (objectEntryTypes.Value.Contents == ProxyContents.Single) { marshalledObjectEntryTypes = (SharpVk.NVidia.Experimental.ObjectEntryType *)(Interop.HeapUtil.Allocate <SharpVk.NVidia.Experimental.ObjectEntryType>()); *(SharpVk.NVidia.Experimental.ObjectEntryType *)(marshalledObjectEntryTypes) = objectEntryTypes.Value.GetSingleValue(); } else { var fieldPointer = (SharpVk.NVidia.Experimental.ObjectEntryType *)(Interop.HeapUtil.AllocateAndClear <SharpVk.NVidia.Experimental.ObjectEntryType>(Interop.HeapUtil.GetLength(objectEntryTypes.Value)).ToPointer()); for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(objectEntryTypes.Value)); index++) { fieldPointer[index] = objectEntryTypes.Value[index]; } marshalledObjectEntryTypes = fieldPointer; } } if (objectIndices.IsNull()) { marshalledObjectIndices = null; } else { if (objectIndices.Value.Contents == ProxyContents.Single) { marshalledObjectIndices = (uint *)(Interop.HeapUtil.Allocate <uint>()); *(uint *)(marshalledObjectIndices) = objectIndices.Value.GetSingleValue(); } else { var fieldPointer = (uint *)(Interop.HeapUtil.AllocateAndClear <uint>(Interop.HeapUtil.GetLength(objectIndices.Value)).ToPointer()); for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(objectIndices.Value)); index++) { fieldPointer[index] = objectIndices.Value[index]; } marshalledObjectIndices = fieldPointer; } } SharpVk.Interop.NVidia.Experimental.VkObjectTableNVXUnregisterObjectsDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.NVidia.Experimental.VkObjectTableNVXUnregisterObjectsDelegate>("vkUnregisterObjectsNVX", "device"); Result methodResult = commandDelegate(this.parent.handle, this.handle, (uint)(Interop.HeapUtil.GetLength(objectEntryTypes)), marshalledObjectEntryTypes, marshalledObjectIndices); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> public static unsafe IntPtr GetSemaphoreWin32Handle(this SharpVk.Device extendedHandle, SharpVk.Khronos.SemaphoreGetWin32HandleInfo getWin32HandleInfo) { try { IntPtr result = default(IntPtr); CommandCache commandCache = default(CommandCache); SharpVk.Interop.Khronos.SemaphoreGetWin32HandleInfo *marshalledGetWin32HandleInfo = default(SharpVk.Interop.Khronos.SemaphoreGetWin32HandleInfo *); IntPtr marshalledHandle = default(IntPtr); commandCache = extendedHandle.commandCache; marshalledGetWin32HandleInfo = (SharpVk.Interop.Khronos.SemaphoreGetWin32HandleInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.SemaphoreGetWin32HandleInfo>()); getWin32HandleInfo.MarshalTo(marshalledGetWin32HandleInfo); SharpVk.Interop.Khronos.VkDeviceGetSemaphoreWin32HandleDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Khronos.VkDeviceGetSemaphoreWin32HandleDelegate>("vkGetSemaphoreWin32HandleKHR", "instance"); Result methodResult = commandDelegate(extendedHandle.handle, marshalledGetWin32HandleInfo, &marshalledHandle); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } result = marshalledHandle; return(result); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> public unsafe void RegisterObjects(SharpVk.NVidia.Experimental.ObjectTableEntry[] objectTableEntries, uint[] objectIndices) { try { SharpVk.NVidia.Experimental.ObjectTableEntry **marshalledObjectTableEntries = default(SharpVk.NVidia.Experimental.ObjectTableEntry * *); SharpVk.NVidia.Experimental.ObjectTableEntry * semiMarshalledObjectTableEntries = default(SharpVk.NVidia.Experimental.ObjectTableEntry *); uint *marshalledObjectIndices = default(uint *); if (objectTableEntries != null) { var fieldPointer = (SharpVk.NVidia.Experimental.ObjectTableEntry *)(Interop.HeapUtil.AllocateAndClear <SharpVk.NVidia.Experimental.ObjectTableEntry>(objectTableEntries.Length).ToPointer()); for (int index = 0; index < (uint)(objectTableEntries.Length); index++) { fieldPointer[index] = objectTableEntries[index]; } semiMarshalledObjectTableEntries = fieldPointer; } else { semiMarshalledObjectTableEntries = null; } if (objectTableEntries != null) { var fieldPointer = (SharpVk.NVidia.Experimental.ObjectTableEntry * *)(Interop.HeapUtil.AllocateAndClear <IntPtr>(objectTableEntries.Length).ToPointer()); for (int index = 0; index < (uint)(objectTableEntries.Length); index++) { fieldPointer[index] = &semiMarshalledObjectTableEntries[index]; } marshalledObjectTableEntries = fieldPointer; } else { marshalledObjectTableEntries = null; } if (objectIndices != null) { var fieldPointer = (uint *)(Interop.HeapUtil.AllocateAndClear <uint>(objectIndices.Length).ToPointer()); for (int index = 0; index < (uint)(objectIndices.Length); index++) { fieldPointer[index] = objectIndices[index]; } marshalledObjectIndices = fieldPointer; } else { marshalledObjectIndices = null; } SharpVk.Interop.NVidia.Experimental.VkObjectTableNVXRegisterObjectsDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.NVidia.Experimental.VkObjectTableNVXRegisterObjectsDelegate>("vkRegisterObjectsNVX", "instance"); Result methodResult = commandDelegate(this.parent.handle, this.handle, (uint)(objectTableEntries?.Length ?? 0), marshalledObjectTableEntries, marshalledObjectIndices); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> /// <param name="extendedHandle"> /// The Instance handle to extend. /// </param> public static unsafe SharpVk.Multivendor.DebugUtilsMessenger CreateDebugUtilsMessenger(this SharpVk.Instance extendedHandle, SharpVk.Multivendor.DebugUtilsMessageSeverityFlags messageSeverity, SharpVk.Multivendor.DebugUtilsMessageTypeFlags messageType, SharpVk.Multivendor.DebugUtilsMessengerCallbackDelegate userCallback, SharpVk.Multivendor.DebugUtilsMessengerCreateFlags?flags = default(SharpVk.Multivendor.DebugUtilsMessengerCreateFlags?), IntPtr?userData = default(IntPtr?), SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?)) { try { SharpVk.Multivendor.DebugUtilsMessenger result = default(SharpVk.Multivendor.DebugUtilsMessenger); CommandCache commandCache = default(CommandCache); SharpVk.Interop.Multivendor.DebugUtilsMessengerCreateInfo *marshalledCreateInfo = default(SharpVk.Interop.Multivendor.DebugUtilsMessengerCreateInfo *); void *nextPointer = default(void *); SharpVk.Interop.AllocationCallbacks * marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *); SharpVk.Interop.Multivendor.DebugUtilsMessenger marshalledMessenger = default(SharpVk.Interop.Multivendor.DebugUtilsMessenger); commandCache = extendedHandle.commandCache; marshalledCreateInfo = (SharpVk.Interop.Multivendor.DebugUtilsMessengerCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Multivendor.DebugUtilsMessengerCreateInfo>()); marshalledCreateInfo->SType = StructureType.DebugUtilsMessengerCreateInfo; marshalledCreateInfo->Next = nextPointer; if (flags != null) { marshalledCreateInfo->Flags = flags.Value; } else { marshalledCreateInfo->Flags = default(SharpVk.Multivendor.DebugUtilsMessengerCreateFlags); } marshalledCreateInfo->MessageSeverity = messageSeverity; marshalledCreateInfo->MessageType = messageType; marshalledCreateInfo->UserCallback = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(userCallback); if (userData != null) { marshalledCreateInfo->UserData = userData.Value.ToPointer(); } else { marshalledCreateInfo->UserData = default(void *); } 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.Multivendor.VkInstanceCreateDebugUtilsMessengerDelegate commandDelegate = commandCache.Cache.vkCreateDebugUtilsMessengerEXT; Result methodResult = commandDelegate(extendedHandle.handle, marshalledCreateInfo, marshalledAllocator, &marshalledMessenger); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } result = new SharpVk.Multivendor.DebugUtilsMessenger(extendedHandle, marshalledMessenger); return(result); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// Create a Surface object for a GLFW3 window. /// </summary> /// <param name="instance"></param> /// <param name="window"></param> /// <returns></returns> public unsafe static Surface CreateGlfw3Surface(this Instance instance, Window window) { Result result = Glfw3.CreateWindowSurface(instance.RawHandle, window.handle, null, out ulong surfaceHandle); if (SharpVkException.IsError(result)) { throw SharpVkException.Create(result); } return(Surface.CreateFromHandle(instance, surfaceHandle)); }
/// <summary> /// /// </summary> public static unsafe SharpVk.Multivendor.DebugReportCallback CreateDebugReportCallback(this SharpVk.Instance extendedHandle, SharpVk.Multivendor.DebugReportCallbackDelegate callback, SharpVk.Multivendor.DebugReportFlags?flags = default(SharpVk.Multivendor.DebugReportFlags?), IntPtr?userData = default(IntPtr?), SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?)) { try { SharpVk.Multivendor.DebugReportCallback result = default(SharpVk.Multivendor.DebugReportCallback); CommandCache commandCache = default(CommandCache); SharpVk.Interop.Multivendor.DebugReportCallbackCreateInfo *marshalledCreateInfo = default(SharpVk.Interop.Multivendor.DebugReportCallbackCreateInfo *); SharpVk.Interop.AllocationCallbacks * marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *); SharpVk.Interop.Multivendor.DebugReportCallback marshalledCallback = default(SharpVk.Interop.Multivendor.DebugReportCallback); commandCache = extendedHandle.commandCache; marshalledCreateInfo = (SharpVk.Interop.Multivendor.DebugReportCallbackCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Multivendor.DebugReportCallbackCreateInfo>()); marshalledCreateInfo->SType = StructureType.DebugReportCallbackCreateInfoExt; marshalledCreateInfo->Next = null; if (flags != null) { marshalledCreateInfo->Flags = flags.Value; } else { marshalledCreateInfo->Flags = default(SharpVk.Multivendor.DebugReportFlags); } marshalledCreateInfo->Callback = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(callback); if (userData != null) { marshalledCreateInfo->UserData = userData.Value.ToPointer(); } else { marshalledCreateInfo->UserData = default(void *); } 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.Multivendor.VkInstanceCreateDebugReportCallbackDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Multivendor.VkInstanceCreateDebugReportCallbackDelegate>("vkCreateDebugReportCallbackEXT", "instance"); Result methodResult = commandDelegate(extendedHandle.handle, marshalledCreateInfo, marshalledAllocator, &marshalledCallback); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } result = new SharpVk.Multivendor.DebugReportCallback(extendedHandle, marshalledCallback); return(result); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> /// <param name="extendedHandle"> /// The PhysicalDevice handle to extend. /// </param> /// <param name="queueFamilyIndex"> /// </param> /// <param name="counters"> /// </param> /// <param name="counterDescriptions"> /// </param> public static unsafe Result EnumerateQueueFamilyPerformanceQueryCounters(this SharpVk.PhysicalDevice extendedHandle, uint queueFamilyIndex, out PerformanceCounter[] counters, out PerformanceCounterDescription[] counterDescriptions) { try { Result result = default(Result); uint marshalledCounterCount = default(uint); CommandCache commandCache = default(CommandCache); SharpVk.Interop.Khronos.PerformanceCounter * marshalledCounters = default(SharpVk.Interop.Khronos.PerformanceCounter *); SharpVk.Interop.Khronos.PerformanceCounterDescription *marshalledCounterDescriptions = default(SharpVk.Interop.Khronos.PerformanceCounterDescription *); commandCache = extendedHandle.commandCache; SharpVk.Interop.Khronos.VkPhysicalDeviceEnumerateQueueFamilyPerformanceQueryCountersDelegate commandDelegate = commandCache.Cache.vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR; result = commandDelegate(extendedHandle.handle, queueFamilyIndex, &marshalledCounterCount, marshalledCounters, marshalledCounterDescriptions); if (SharpVkException.IsError(result)) { throw SharpVkException.Create(result); } marshalledCounterDescriptions = (SharpVk.Interop.Khronos.PerformanceCounterDescription *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.PerformanceCounterDescription>((uint)(marshalledCounterCount))); marshalledCounters = (SharpVk.Interop.Khronos.PerformanceCounter *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.PerformanceCounter>((uint)(marshalledCounterCount))); commandDelegate(extendedHandle.handle, queueFamilyIndex, &marshalledCounterCount, marshalledCounters, marshalledCounterDescriptions); if (marshalledCounters != null) { var fieldPointer = new SharpVk.Khronos.PerformanceCounter[(uint)(marshalledCounterCount)]; for (int index = 0; index < (uint)(marshalledCounterCount); index++) { fieldPointer[index] = SharpVk.Khronos.PerformanceCounter.MarshalFrom(&marshalledCounters[index]); } counters = fieldPointer; } else { counters = null; } if (marshalledCounterDescriptions != null) { var fieldPointer = new SharpVk.Khronos.PerformanceCounterDescription[(uint)(marshalledCounterCount)]; for (int index = 0; index < (uint)(marshalledCounterCount); index++) { fieldPointer[index] = SharpVk.Khronos.PerformanceCounterDescription.MarshalFrom(&marshalledCounterDescriptions[index]); } counterDescriptions = fieldPointer; } else { counterDescriptions = null; } return(result); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// Create a SurfaceKHR structure representing a display plane and /// mode. /// </summary> /// <param name="extendedHandle"> /// The Instance handle to extend. /// </param> /// <param name="flags"> /// Reserved for future use, and must be zero. /// </param> /// <param name="displayMode"> /// The mode to use when displaying this surface. /// </param> /// <param name="planeIndex"> /// The plane on which this surface appears. /// </param> /// <param name="planeStackIndex"> /// The z-order of the plane. /// </param> /// <param name="transform"> /// The transform to apply to the images as part of the scanout /// operation. /// </param> /// <param name="globalAlpha"> /// The global alpha value. This value is ignored if alphaMode is not /// VK_DISPLAY_PLANE_ALPHA_GLOBAL_BIT_KHR. /// </param> /// <param name="alphaMode"> /// The type of alpha blending to use. /// </param> /// <param name="imageExtent"> /// </param> /// <param name="allocator"> /// An optional AllocationCallbacks instance that controls host memory /// allocation. /// </param> public static unsafe SharpVk.Khronos.Surface CreateDisplayPlaneSurface(this SharpVk.Instance extendedHandle, SharpVk.Khronos.DisplayMode displayMode, uint planeIndex, uint planeStackIndex, SharpVk.Khronos.SurfaceTransformFlags transform, float globalAlpha, SharpVk.Khronos.DisplayPlaneAlphaFlags alphaMode, SharpVk.Extent2D imageExtent, SharpVk.Khronos.DisplaySurfaceCreateFlags?flags = default(SharpVk.Khronos.DisplaySurfaceCreateFlags?), SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?)) { try { SharpVk.Khronos.Surface result = default(SharpVk.Khronos.Surface); CommandCache commandCache = default(CommandCache); SharpVk.Interop.Khronos.DisplaySurfaceCreateInfo *marshalledCreateInfo = default(SharpVk.Interop.Khronos.DisplaySurfaceCreateInfo *); void *vkDisplaySurfaceCreateInfoKHRNextPointer = default(void *); SharpVk.Interop.AllocationCallbacks *marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *); SharpVk.Interop.Khronos.Surface marshalledSurface = default(SharpVk.Interop.Khronos.Surface); commandCache = extendedHandle.commandCache; marshalledCreateInfo = (SharpVk.Interop.Khronos.DisplaySurfaceCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.DisplaySurfaceCreateInfo>()); marshalledCreateInfo->SType = StructureType.DisplaySurfaceCreateInfo; marshalledCreateInfo->Next = vkDisplaySurfaceCreateInfoKHRNextPointer; if (flags != null) { marshalledCreateInfo->Flags = flags.Value; } else { marshalledCreateInfo->Flags = default(SharpVk.Khronos.DisplaySurfaceCreateFlags); } marshalledCreateInfo->DisplayMode = displayMode?.handle ?? default(SharpVk.Interop.Khronos.DisplayMode); marshalledCreateInfo->PlaneIndex = planeIndex; marshalledCreateInfo->PlaneStackIndex = planeStackIndex; marshalledCreateInfo->Transform = transform; marshalledCreateInfo->GlobalAlpha = globalAlpha; marshalledCreateInfo->AlphaMode = alphaMode; marshalledCreateInfo->ImageExtent = imageExtent; 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.VkInstanceCreateDisplayPlaneSurfaceDelegate commandDelegate = commandCache.Cache.vkCreateDisplayPlaneSurfaceKHR; Result methodResult = commandDelegate(extendedHandle.handle, marshalledCreateInfo, marshalledAllocator, &marshalledSurface); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } result = new SharpVk.Khronos.Surface(extendedHandle, marshalledSurface); return(result); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// Create a SurfaceKHR object for a Wayland window. /// </summary> /// <param name="extendedHandle"> /// The Instance handle to extend. /// </param> /// <param name="flags"> /// Reserved for future use. /// </param> /// <param name="display"> /// display and surface are pointers to the Wayland wl_display and /// wl_surface to associate the surface with. /// </param> /// <param name="surface"> /// </param> /// <param name="allocator"> /// An optional AllocationCallbacks instance that controls host memory /// allocation. /// </param> public static unsafe SharpVk.Khronos.Surface CreateWaylandSurface(this SharpVk.Instance extendedHandle, IntPtr display, IntPtr surface, SharpVk.Khronos.WaylandSurfaceCreateFlags?flags = default(SharpVk.Khronos.WaylandSurfaceCreateFlags?), SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?)) { try { SharpVk.Khronos.Surface result = default(SharpVk.Khronos.Surface); CommandCache commandCache = default(CommandCache); SharpVk.Interop.Khronos.WaylandSurfaceCreateInfo *marshalledCreateInfo = default(SharpVk.Interop.Khronos.WaylandSurfaceCreateInfo *); void *vkWaylandSurfaceCreateInfoKHRNextPointer = default(void *); SharpVk.Interop.AllocationCallbacks *marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *); SharpVk.Interop.Khronos.Surface marshalledSurface = default(SharpVk.Interop.Khronos.Surface); commandCache = extendedHandle.commandCache; marshalledCreateInfo = (SharpVk.Interop.Khronos.WaylandSurfaceCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.WaylandSurfaceCreateInfo>()); marshalledCreateInfo->SType = StructureType.WaylandSurfaceCreateInfo; marshalledCreateInfo->Next = vkWaylandSurfaceCreateInfoKHRNextPointer; if (flags != null) { marshalledCreateInfo->Flags = flags.Value; } else { marshalledCreateInfo->Flags = default(SharpVk.Khronos.WaylandSurfaceCreateFlags); } marshalledCreateInfo->Display = (IntPtr *)(Interop.HeapUtil.Allocate <IntPtr>()); *marshalledCreateInfo->Display = display; marshalledCreateInfo->Surface = (IntPtr *)(Interop.HeapUtil.Allocate <IntPtr>()); *marshalledCreateInfo->Surface = surface; 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.VkInstanceCreateWaylandSurfaceDelegate commandDelegate = commandCache.Cache.vkCreateWaylandSurfaceKHR; Result methodResult = commandDelegate(extendedHandle.handle, marshalledCreateInfo, marshalledAllocator, &marshalledSurface); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } result = new SharpVk.Khronos.Surface(extendedHandle, marshalledSurface); return(result); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// Create a SurfaceKHR object for a Mir window. /// </summary> /// <param name="extendedHandle"> /// The Instance handle to extend. /// </param> /// <param name="flags"> /// Reserved for future use. /// </param> /// <param name="connection"> /// connection and surface are pointers to the MirConnection and /// MirSurface for the window to associate the surface with. /// </param> /// <param name="allocator"> /// An optional AllocationCallbacks instance that controls host memory /// allocation. /// </param> public static unsafe SharpVk.Khronos.Surface CreateMirSurface(this SharpVk.Instance extendedHandle, IntPtr connection, IntPtr mirSurface, SharpVk.Khronos.MirSurfaceCreateFlags?flags = default(SharpVk.Khronos.MirSurfaceCreateFlags?), SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?)) { try { SharpVk.Khronos.Surface result = default(SharpVk.Khronos.Surface); CommandCache commandCache = default(CommandCache); SharpVk.Interop.Khronos.MirSurfaceCreateInfo *marshalledCreateInfo = default(SharpVk.Interop.Khronos.MirSurfaceCreateInfo *); SharpVk.Interop.AllocationCallbacks * marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *); SharpVk.Interop.Khronos.Surface marshalledSurface = default(SharpVk.Interop.Khronos.Surface); commandCache = extendedHandle.commandCache; marshalledCreateInfo = (SharpVk.Interop.Khronos.MirSurfaceCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.MirSurfaceCreateInfo>()); marshalledCreateInfo->SType = StructureType.MirSurfaceCreateInfoKhr; marshalledCreateInfo->Next = null; if (flags != null) { marshalledCreateInfo->Flags = flags.Value; } else { marshalledCreateInfo->Flags = default(SharpVk.Khronos.MirSurfaceCreateFlags); } marshalledCreateInfo->Connection = (IntPtr *)(Interop.HeapUtil.Allocate <IntPtr>()); *marshalledCreateInfo->Connection = connection; marshalledCreateInfo->MirSurface = (IntPtr *)(Interop.HeapUtil.Allocate <IntPtr>()); *marshalledCreateInfo->MirSurface = mirSurface; 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.VkInstanceCreateMirSurfaceDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Khronos.VkInstanceCreateMirSurfaceDelegate>("vkCreateMirSurfaceKHR", "instance"); Result methodResult = commandDelegate(extendedHandle.handle, marshalledCreateInfo, marshalledAllocator, &marshalledSurface); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } result = new SharpVk.Khronos.Surface(extendedHandle, marshalledSurface); return(result); } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> public unsafe void Release() { try { SharpVk.Interop.Intel.VkPerformanceConfigurationINTELReleaseDelegate commandDelegate = commandCache.Cache.vkReleasePerformanceConfigurationINTEL; Result methodResult = commandDelegate(this.parent.handle, this.handle); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// /// </summary> public unsafe void GetStatus() { try { SharpVk.Interop.Khronos.VkSwapchainKHRGetStatusDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Khronos.VkSwapchainKHRGetStatusDelegate>("vkGetSwapchainStatusKHR", "instance"); Result methodResult = commandDelegate(this.parent.handle, this.handle); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// Create a SurfaceKHR object for a VI layer. /// </summary> /// <param name="extendedHandle"> /// The Instance handle to extend. /// </param> /// <param name="flags"> /// Reserved for future use. /// </param> /// <param name="window"> /// The nn::vi::NativeWindowHandle for the nn::vi::Layer with which to /// associate the surface. /// </param> /// <param name="allocator"> /// An optional AllocationCallbacks instance that controls host memory /// allocation. /// </param> public static unsafe SharpVk.Khronos.Surface CreateViSurface(this SharpVk.Instance extendedHandle, IntPtr window, SharpVk.Nintendo.ViSurfaceCreateFlags?flags = default(SharpVk.Nintendo.ViSurfaceCreateFlags?), SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?)) { try { SharpVk.Khronos.Surface result = default(SharpVk.Khronos.Surface); CommandCache commandCache = default(CommandCache); SharpVk.Interop.Nintendo.ViSurfaceCreateInfo *marshalledCreateInfo = default(SharpVk.Interop.Nintendo.ViSurfaceCreateInfo *); void *nextPointer = default(void *); SharpVk.Interop.AllocationCallbacks *marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *); SharpVk.Interop.Khronos.Surface marshalledSurface = default(SharpVk.Interop.Khronos.Surface); commandCache = extendedHandle.commandCache; marshalledCreateInfo = (SharpVk.Interop.Nintendo.ViSurfaceCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Nintendo.ViSurfaceCreateInfo>()); marshalledCreateInfo->SType = StructureType.ViSurfaceCreateInfo; marshalledCreateInfo->Next = nextPointer; if (flags != null) { marshalledCreateInfo->Flags = flags.Value; } else { marshalledCreateInfo->Flags = default(SharpVk.Nintendo.ViSurfaceCreateFlags); } marshalledCreateInfo->Window = window.ToPointer(); 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.Nintendo.VkInstanceCreateViSurfaceDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Nintendo.VkInstanceCreateViSurfaceDelegate>("vkCreateViSurfaceNN", "instance"); Result methodResult = commandDelegate(extendedHandle.handle, marshalledCreateInfo, marshalledAllocator, &marshalledSurface); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } result = new SharpVk.Khronos.Surface(extendedHandle, marshalledSurface); 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(); } }