using System.Runtime.Versioning; namespace Brutal.VulkanApi.Win32 { public static unsafe partial class Win32Extensions { /// /// vkCreateWin32SurfaceKHR - Create a VkSurfaceKHR object for a Win32 native window /// /// /// /// :refpage: vkCreateWin32SurfaceKHR /// /// /// To create a VkSurfaceKHR object for a Win32 window, call: /// /// /// // Provided by VK_KHR_win32_surface /// VkResult vkCreateWin32SurfaceKHR( /// VkInstance instance, /// const VkWin32SurfaceCreateInfoKHR* pCreateInfo, /// const VkAllocationCallbacks* pAllocator, /// VkSurfaceKHR* pSurface); /// /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [SupportedOSPlatform("windows")] public static unsafe void CreateWin32SurfaceKHR( this VulkanHandleWrapper handle, in VkWin32SurfaceCreateInfoKHR pCreateInfo, VkAllocator? pAllocator, out VkSurfaceKHR pSurface ) { fixed (VkWin32SurfaceCreateInfoKHR* pCreateInfoFixed = &pCreateInfo) { VkSurfaceKHR pSurfaceLocal = default; VkResult result = handle.PInvoke.vkCreateWin32SurfaceKHR.Invoke( handle.Handle, pCreateInfoFixed, pAllocator, &pSurfaceLocal ); switch (result) { case VkResult.ErrorOutOfHostMemory: throw new VkResultError( VkResult.ErrorOutOfHostMemory, "Vulkan call to vkCreateWin32SurfaceKHR failed with error: VK_ERROR_OUT_OF_HOST_MEMORY" ); case VkResult.ErrorOutOfDeviceMemory: throw new VkResultError( VkResult.ErrorOutOfDeviceMemory, "Vulkan call to vkCreateWin32SurfaceKHR failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY" ); case VkResult.ErrorUnknown: throw new VkResultError( VkResult.ErrorUnknown, "Vulkan call to vkCreateWin32SurfaceKHR failed with error: VK_ERROR_UNKNOWN" ); case VkResult.ErrorValidationFailed: throw new VkResultError( VkResult.ErrorValidationFailed, "Vulkan call to vkCreateWin32SurfaceKHR failed with error: VK_ERROR_VALIDATION_FAILED" ); case VkResult.Success: default: break; } pSurface = pSurfaceLocal; } } /// /// vkGetPhysicalDeviceWin32PresentationSupportKHR - Query queue family support for presentation on a Win32 display /// /// /// /// To determine whether a queue family of a physical device supports /// presentation to the Microsoft Windows desktop, call: /// /// /// // Provided by VK_KHR_win32_surface /// VkBool32 vkGetPhysicalDeviceWin32PresentationSupportKHR( /// VkPhysicalDevice physicalDevice, /// uint32_t queueFamilyIndex); /// /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [SupportedOSPlatform("windows")] public static Brutal.Bool32 GetWin32PresentationSupportKHR( this VulkanHandleWrapper handle, int queueFamilyIndex ) { return handle.PInvoke.vkGetPhysicalDeviceWin32PresentationSupportKHR.Invoke( handle.Handle, queueFamilyIndex ); } /// /// vkGetMemoryWin32HandleKHR - Get a Windows HANDLE for a memory object /// /// /// /// To export a Windows handle representing the payload of a Vulkan device /// memory object, call: /// /// /// // Provided by VK_KHR_external_memory_win32 /// VkResult vkGetMemoryWin32HandleKHR( /// VkDevice device, /// const VkMemoryGetWin32HandleInfoKHR* pGetWin32HandleInfo, /// HANDLE* pHandle); /// /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [SupportedOSPlatform("windows")] public static unsafe nint GetMemoryWin32HandleKHR( this VulkanHandleWrapper handle, in VkMemoryGetWin32HandleInfoKHR pGetWin32HandleInfo ) { fixed (VkMemoryGetWin32HandleInfoKHR* pGetWin32HandleInfoFixed = &pGetWin32HandleInfo) { nint pHandleLocal = default; VkResult result = handle.PInvoke.vkGetMemoryWin32HandleKHR.Invoke( handle.Handle, pGetWin32HandleInfoFixed, &pHandleLocal ); switch (result) { case VkResult.ErrorTooManyObjects: throw new VkResultError( VkResult.ErrorTooManyObjects, "Vulkan call to vkGetMemoryWin32HandleKHR failed with error: VK_ERROR_TOO_MANY_OBJECTS" ); case VkResult.ErrorOutOfHostMemory: throw new VkResultError( VkResult.ErrorOutOfHostMemory, "Vulkan call to vkGetMemoryWin32HandleKHR failed with error: VK_ERROR_OUT_OF_HOST_MEMORY" ); case VkResult.ErrorUnknown: throw new VkResultError( VkResult.ErrorUnknown, "Vulkan call to vkGetMemoryWin32HandleKHR failed with error: VK_ERROR_UNKNOWN" ); case VkResult.ErrorValidationFailed: throw new VkResultError( VkResult.ErrorValidationFailed, "Vulkan call to vkGetMemoryWin32HandleKHR failed with error: VK_ERROR_VALIDATION_FAILED" ); case VkResult.Success: default: break; } return pHandleLocal; } } /// /// vkGetMemoryWin32HandlePropertiesKHR - Get Properties of External Memory Win32 Handles /// /// /// /// Windows memory handles compatible with Vulkan may: also be created by /// non-Vulkan APIs using methods beyond the scope of this specification. /// To determine the correct parameters to use when importing such handles, /// call: /// /// /// // Provided by VK_KHR_external_memory_win32 /// VkResult vkGetMemoryWin32HandlePropertiesKHR( /// VkDevice device, /// VkExternalMemoryHandleTypeFlagBits handleType, /// HANDLE handle, /// VkMemoryWin32HandlePropertiesKHR* pMemoryWin32HandleProperties); /// /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [SupportedOSPlatform("windows")] public static unsafe void GetMemoryWin32HandlePropertiesKHR( this VulkanHandleWrapper handle, VkExternalMemoryHandleTypeFlags handleType, nint win32Handle, ref VkMemoryWin32HandlePropertiesKHR pMemoryWin32HandleProperties ) { fixed (VkMemoryWin32HandlePropertiesKHR* pMemoryWin32HandlePropertiesFixed = &pMemoryWin32HandleProperties) { VkResult result = handle.PInvoke.vkGetMemoryWin32HandlePropertiesKHR.Invoke( handle.Handle, handleType, win32Handle, pMemoryWin32HandlePropertiesFixed ); switch (result) { case VkResult.ErrorOutOfHostMemory: throw new VkResultError( VkResult.ErrorOutOfHostMemory, "Vulkan call to vkGetMemoryWin32HandlePropertiesKHR failed with error: VK_ERROR_OUT_OF_HOST_MEMORY" ); case VkResult.ErrorInvalidExternalHandle: throw new VkResultError( VkResult.ErrorInvalidExternalHandle, "Vulkan call to vkGetMemoryWin32HandlePropertiesKHR failed with error: VK_ERROR_INVALID_EXTERNAL_HANDLE" ); case VkResult.ErrorUnknown: throw new VkResultError( VkResult.ErrorUnknown, "Vulkan call to vkGetMemoryWin32HandlePropertiesKHR failed with error: VK_ERROR_UNKNOWN" ); case VkResult.ErrorValidationFailed: throw new VkResultError( VkResult.ErrorValidationFailed, "Vulkan call to vkGetMemoryWin32HandlePropertiesKHR failed with error: VK_ERROR_VALIDATION_FAILED" ); case VkResult.Success: default: break; } } } /// Wrapper that returns the struct instead of taking it as a ref parameter. /// The VkMemoryWin32HandlePropertiesKHR. [SupportedOSPlatform("windows")] public static VkMemoryWin32HandlePropertiesKHR GetMemoryWin32HandlePropertiesKHR( this VulkanHandleWrapper handle, VkExternalMemoryHandleTypeFlags handleType, nint win32Handle ) { VkMemoryWin32HandlePropertiesKHR outValue = new(); GetMemoryWin32HandlePropertiesKHR(handle, handleType, win32Handle, ref outValue); return outValue; } /// /// vkImportSemaphoreWin32HandleKHR - Import a semaphore from a Windows HANDLE /// /// /// /// To import a semaphore payload from a Windows handle, call: /// /// /// // Provided by VK_KHR_external_semaphore_win32 /// VkResult vkImportSemaphoreWin32HandleKHR( /// VkDevice device, /// const VkImportSemaphoreWin32HandleInfoKHR* pImportSemaphoreWin32HandleInfo); /// /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [SupportedOSPlatform("windows")] public static unsafe void ImportSemaphoreWin32HandleKHR( this VulkanHandleWrapper handle, in VkImportSemaphoreWin32HandleInfoKHR pImportSemaphoreWin32HandleInfo ) { fixed ( VkImportSemaphoreWin32HandleInfoKHR* pImportSemaphoreWin32HandleInfoFixed = &pImportSemaphoreWin32HandleInfo ) { VkResult result = handle.PInvoke.vkImportSemaphoreWin32HandleKHR.Invoke( handle.Handle, pImportSemaphoreWin32HandleInfoFixed ); switch (result) { case VkResult.ErrorOutOfHostMemory: throw new VkResultError( VkResult.ErrorOutOfHostMemory, "Vulkan call to vkImportSemaphoreWin32HandleKHR failed with error: VK_ERROR_OUT_OF_HOST_MEMORY" ); case VkResult.ErrorInvalidExternalHandle: throw new VkResultError( VkResult.ErrorInvalidExternalHandle, "Vulkan call to vkImportSemaphoreWin32HandleKHR failed with error: VK_ERROR_INVALID_EXTERNAL_HANDLE" ); case VkResult.ErrorUnknown: throw new VkResultError( VkResult.ErrorUnknown, "Vulkan call to vkImportSemaphoreWin32HandleKHR failed with error: VK_ERROR_UNKNOWN" ); case VkResult.ErrorValidationFailed: throw new VkResultError( VkResult.ErrorValidationFailed, "Vulkan call to vkImportSemaphoreWin32HandleKHR failed with error: VK_ERROR_VALIDATION_FAILED" ); case VkResult.Success: default: break; } } } /// /// vkGetSemaphoreWin32HandleKHR - Get a Windows HANDLE for a semaphore /// /// /// /// To export a Windows handle representing the payload of a semaphore, call: /// /// /// // Provided by VK_KHR_external_semaphore_win32 /// VkResult vkGetSemaphoreWin32HandleKHR( /// VkDevice device, /// const VkSemaphoreGetWin32HandleInfoKHR* pGetWin32HandleInfo, /// HANDLE* pHandle); /// /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [SupportedOSPlatform("windows")] public static unsafe nint GetSemaphoreWin32HandleKHR( this VulkanHandleWrapper handle, in VkSemaphoreGetWin32HandleInfoKHR pGetWin32HandleInfo ) { fixed (VkSemaphoreGetWin32HandleInfoKHR* pGetWin32HandleInfoFixed = &pGetWin32HandleInfo) { nint pHandleLocal = default; VkResult result = handle.PInvoke.vkGetSemaphoreWin32HandleKHR.Invoke( handle.Handle, pGetWin32HandleInfoFixed, &pHandleLocal ); switch (result) { case VkResult.ErrorTooManyObjects: throw new VkResultError( VkResult.ErrorTooManyObjects, "Vulkan call to vkGetSemaphoreWin32HandleKHR failed with error: VK_ERROR_TOO_MANY_OBJECTS" ); case VkResult.ErrorOutOfHostMemory: throw new VkResultError( VkResult.ErrorOutOfHostMemory, "Vulkan call to vkGetSemaphoreWin32HandleKHR failed with error: VK_ERROR_OUT_OF_HOST_MEMORY" ); case VkResult.ErrorUnknown: throw new VkResultError( VkResult.ErrorUnknown, "Vulkan call to vkGetSemaphoreWin32HandleKHR failed with error: VK_ERROR_UNKNOWN" ); case VkResult.ErrorValidationFailed: throw new VkResultError( VkResult.ErrorValidationFailed, "Vulkan call to vkGetSemaphoreWin32HandleKHR failed with error: VK_ERROR_VALIDATION_FAILED" ); case VkResult.Success: default: break; } return pHandleLocal; } } /// /// vkImportFenceWin32HandleKHR - Import a fence from a Windows HANDLE /// /// /// /// To import a fence payload from a Windows handle, call: /// /// /// // Provided by VK_KHR_external_fence_win32 /// VkResult vkImportFenceWin32HandleKHR( /// VkDevice device, /// const VkImportFenceWin32HandleInfoKHR* pImportFenceWin32HandleInfo); /// /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [SupportedOSPlatform("windows")] public static unsafe void ImportFenceWin32HandleKHR( this VulkanHandleWrapper handle, in VkImportFenceWin32HandleInfoKHR pImportFenceWin32HandleInfo ) { fixed (VkImportFenceWin32HandleInfoKHR* pImportFenceWin32HandleInfoFixed = &pImportFenceWin32HandleInfo) { VkResult result = handle.PInvoke.vkImportFenceWin32HandleKHR.Invoke( handle.Handle, pImportFenceWin32HandleInfoFixed ); switch (result) { case VkResult.ErrorOutOfHostMemory: throw new VkResultError( VkResult.ErrorOutOfHostMemory, "Vulkan call to vkImportFenceWin32HandleKHR failed with error: VK_ERROR_OUT_OF_HOST_MEMORY" ); case VkResult.ErrorInvalidExternalHandle: throw new VkResultError( VkResult.ErrorInvalidExternalHandle, "Vulkan call to vkImportFenceWin32HandleKHR failed with error: VK_ERROR_INVALID_EXTERNAL_HANDLE" ); case VkResult.ErrorUnknown: throw new VkResultError( VkResult.ErrorUnknown, "Vulkan call to vkImportFenceWin32HandleKHR failed with error: VK_ERROR_UNKNOWN" ); case VkResult.ErrorValidationFailed: throw new VkResultError( VkResult.ErrorValidationFailed, "Vulkan call to vkImportFenceWin32HandleKHR failed with error: VK_ERROR_VALIDATION_FAILED" ); case VkResult.Success: default: break; } } } /// /// vkGetFenceWin32HandleKHR - Get a Windows HANDLE for a fence /// /// /// /// To export a Windows handle representing the state of a fence, call: /// /// /// // Provided by VK_KHR_external_fence_win32 /// VkResult vkGetFenceWin32HandleKHR( /// VkDevice device, /// const VkFenceGetWin32HandleInfoKHR* pGetWin32HandleInfo, /// HANDLE* pHandle); /// /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [SupportedOSPlatform("windows")] public static unsafe nint GetFenceWin32HandleKHR( this VulkanHandleWrapper handle, in VkFenceGetWin32HandleInfoKHR pGetWin32HandleInfo ) { fixed (VkFenceGetWin32HandleInfoKHR* pGetWin32HandleInfoFixed = &pGetWin32HandleInfo) { nint pHandleLocal = default; VkResult result = handle.PInvoke.vkGetFenceWin32HandleKHR.Invoke( handle.Handle, pGetWin32HandleInfoFixed, &pHandleLocal ); switch (result) { case VkResult.ErrorTooManyObjects: throw new VkResultError( VkResult.ErrorTooManyObjects, "Vulkan call to vkGetFenceWin32HandleKHR failed with error: VK_ERROR_TOO_MANY_OBJECTS" ); case VkResult.ErrorOutOfHostMemory: throw new VkResultError( VkResult.ErrorOutOfHostMemory, "Vulkan call to vkGetFenceWin32HandleKHR failed with error: VK_ERROR_OUT_OF_HOST_MEMORY" ); case VkResult.ErrorUnknown: throw new VkResultError( VkResult.ErrorUnknown, "Vulkan call to vkGetFenceWin32HandleKHR failed with error: VK_ERROR_UNKNOWN" ); case VkResult.ErrorValidationFailed: throw new VkResultError( VkResult.ErrorValidationFailed, "Vulkan call to vkGetFenceWin32HandleKHR failed with error: VK_ERROR_VALIDATION_FAILED" ); case VkResult.Success: default: break; } return pHandleLocal; } } /// /// vkGetMemoryWin32HandleNV - Retrieve Win32 handle to a device memory object /// /// /// /// To retrieve the handle corresponding to a device memory object created with /// VkExportMemoryAllocateInfoNV::handleTypes set to include /// VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_NV or /// VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_NV, call: /// /// /// // Provided by VK_NV_external_memory_win32 /// VkResult vkGetMemoryWin32HandleNV( /// VkDevice device, /// VkDeviceMemory memory, /// VkExternalMemoryHandleTypeFlagsNV handleType, /// HANDLE* pHandle); /// /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [SupportedOSPlatform("windows")] public static unsafe nint GetMemoryWin32HandleNV( this VulkanHandleWrapper handle, VkDeviceMemory memory, VkExternalMemoryHandleTypeFlagsNV handleType ) { nint pHandleLocal = default; VkResult result = handle.PInvoke.vkGetMemoryWin32HandleNV.Invoke( handle.Handle, memory, handleType, &pHandleLocal ); switch (result) { case VkResult.ErrorTooManyObjects: throw new VkResultError( VkResult.ErrorTooManyObjects, "Vulkan call to vkGetMemoryWin32HandleNV failed with error: VK_ERROR_TOO_MANY_OBJECTS" ); case VkResult.ErrorOutOfHostMemory: throw new VkResultError( VkResult.ErrorOutOfHostMemory, "Vulkan call to vkGetMemoryWin32HandleNV failed with error: VK_ERROR_OUT_OF_HOST_MEMORY" ); case VkResult.ErrorUnknown: throw new VkResultError( VkResult.ErrorUnknown, "Vulkan call to vkGetMemoryWin32HandleNV failed with error: VK_ERROR_UNKNOWN" ); case VkResult.ErrorValidationFailed: throw new VkResultError( VkResult.ErrorValidationFailed, "Vulkan call to vkGetMemoryWin32HandleNV failed with error: VK_ERROR_VALIDATION_FAILED" ); case VkResult.Success: default: break; } return pHandleLocal; } /// /// vkGetPhysicalDeviceSurfacePresentModes2EXT - Query supported presentation modes /// /// /// /// :refpage: vkGetPhysicalDeviceSurfacePresentModes2EXT /// /// /// To query the supported presentation modes for a surface combined with select /// other fixed swapchain creation parameters, call: /// /// /// // Provided by VK_EXT_full_screen_exclusive /// VkResult vkGetPhysicalDeviceSurfacePresentModes2EXT( /// VkPhysicalDevice physicalDevice, /// const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, /// uint32_t* pPresentModeCount, /// VkPresentModeKHR* pPresentModes); /// /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [SupportedOSPlatform("windows")] private static unsafe VkResult GetSurfacePresentModes2EXT( this VulkanHandleWrapper handle, in VkPhysicalDeviceSurfaceInfo2KHR pSurfaceInfo, ref int pPresentModeCount, scoped ReadOnlySpan pPresentModes ) { fixed (VkPresentModeKHR* pPresentModesFixed = pPresentModes) fixed (VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfoFixed = &pSurfaceInfo) fixed (int* pPresentModeCountFixed = &pPresentModeCount) { VkResult result = handle.PInvoke.vkGetPhysicalDeviceSurfacePresentModes2EXT.Invoke( handle.Handle, pSurfaceInfoFixed, pPresentModeCountFixed, pPresentModesFixed ); switch (result) { case VkResult.ErrorOutOfHostMemory: throw new VkResultError( VkResult.ErrorOutOfHostMemory, "Vulkan call to vkGetPhysicalDeviceSurfacePresentModes2EXT failed with error: VK_ERROR_OUT_OF_HOST_MEMORY" ); case VkResult.ErrorOutOfDeviceMemory: throw new VkResultError( VkResult.ErrorOutOfDeviceMemory, "Vulkan call to vkGetPhysicalDeviceSurfacePresentModes2EXT failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY" ); case VkResult.ErrorSurfaceLostKHR: throw new VkResultError( VkResult.ErrorSurfaceLostKHR, "Vulkan call to vkGetPhysicalDeviceSurfacePresentModes2EXT failed with error: VK_ERROR_SURFACE_LOST_KHR" ); case VkResult.ErrorUnknown: throw new VkResultError( VkResult.ErrorUnknown, "Vulkan call to vkGetPhysicalDeviceSurfacePresentModes2EXT failed with error: VK_ERROR_UNKNOWN" ); case VkResult.ErrorValidationFailed: throw new VkResultError( VkResult.ErrorValidationFailed, "Vulkan call to vkGetPhysicalDeviceSurfacePresentModes2EXT failed with error: VK_ERROR_VALIDATION_FAILED" ); case VkResult.Success: case VkResult.Incomplete: default: break; } return result; } } /// Queries the required length. /// The required length. [SupportedOSPlatform("windows")] public static int GetSurfacePresentModes2EXT_Count( this VulkanHandleWrapper handle, in VkPhysicalDeviceSurfaceInfo2KHR pSurfaceInfo ) { int pPresentModeCount = default; GetSurfacePresentModes2EXT(handle, pSurfaceInfo, ref pPresentModeCount, null); return pPresentModeCount; } /// Writes to a provided span. /// The span to write to. /// Return value of the underlying function. [SupportedOSPlatform("windows")] public static VkResult GetSurfacePresentModes2EXT_Write( this VulkanHandleWrapper handle, in VkPhysicalDeviceSurfaceInfo2KHR pSurfaceInfo, scoped ReadOnlySpan pPresentModes ) { int pPresentModeCount = pPresentModes.Length; return GetSurfacePresentModes2EXT(handle, pSurfaceInfo, ref pPresentModeCount, pPresentModes); } /// /// vkAcquireFullScreenExclusiveModeEXT - Acquire full-screen exclusive mode for a swapchain /// /// /// /// To acquire exclusive full-screen access for a swapchain, call: /// /// /// // Provided by VK_EXT_full_screen_exclusive /// VkResult vkAcquireFullScreenExclusiveModeEXT( /// VkDevice device, /// VkSwapchainKHR swapchain); /// /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [SupportedOSPlatform("windows")] public static void AcquireFullScreenExclusiveModeEXT( this VulkanHandleWrapper handle, VkSwapchainKHR swapchain ) { VkResult result = handle.PInvoke.vkAcquireFullScreenExclusiveModeEXT.Invoke(handle.Handle, swapchain); switch (result) { case VkResult.ErrorOutOfHostMemory: throw new VkResultError( VkResult.ErrorOutOfHostMemory, "Vulkan call to vkAcquireFullScreenExclusiveModeEXT failed with error: VK_ERROR_OUT_OF_HOST_MEMORY" ); case VkResult.ErrorOutOfDeviceMemory: throw new VkResultError( VkResult.ErrorOutOfDeviceMemory, "Vulkan call to vkAcquireFullScreenExclusiveModeEXT failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY" ); case VkResult.ErrorInitializationFailed: throw new VkResultError( VkResult.ErrorInitializationFailed, "Vulkan call to vkAcquireFullScreenExclusiveModeEXT failed with error: VK_ERROR_INITIALIZATION_FAILED" ); case VkResult.ErrorSurfaceLostKHR: throw new VkResultError( VkResult.ErrorSurfaceLostKHR, "Vulkan call to vkAcquireFullScreenExclusiveModeEXT failed with error: VK_ERROR_SURFACE_LOST_KHR" ); case VkResult.ErrorUnknown: throw new VkResultError( VkResult.ErrorUnknown, "Vulkan call to vkAcquireFullScreenExclusiveModeEXT failed with error: VK_ERROR_UNKNOWN" ); case VkResult.ErrorValidationFailed: throw new VkResultError( VkResult.ErrorValidationFailed, "Vulkan call to vkAcquireFullScreenExclusiveModeEXT failed with error: VK_ERROR_VALIDATION_FAILED" ); case VkResult.Success: default: break; } } /// /// vkReleaseFullScreenExclusiveModeEXT - Release full-screen exclusive mode from a swapchain /// /// /// /// To release exclusive full-screen access from a swapchain, call: /// /// /// // Provided by VK_EXT_full_screen_exclusive /// VkResult vkReleaseFullScreenExclusiveModeEXT( /// VkDevice device, /// VkSwapchainKHR swapchain); /// /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [SupportedOSPlatform("windows")] public static void ReleaseFullScreenExclusiveModeEXT( this VulkanHandleWrapper handle, VkSwapchainKHR swapchain ) { VkResult result = handle.PInvoke.vkReleaseFullScreenExclusiveModeEXT.Invoke(handle.Handle, swapchain); switch (result) { case VkResult.ErrorOutOfHostMemory: throw new VkResultError( VkResult.ErrorOutOfHostMemory, "Vulkan call to vkReleaseFullScreenExclusiveModeEXT failed with error: VK_ERROR_OUT_OF_HOST_MEMORY" ); case VkResult.ErrorOutOfDeviceMemory: throw new VkResultError( VkResult.ErrorOutOfDeviceMemory, "Vulkan call to vkReleaseFullScreenExclusiveModeEXT failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY" ); case VkResult.ErrorSurfaceLostKHR: throw new VkResultError( VkResult.ErrorSurfaceLostKHR, "Vulkan call to vkReleaseFullScreenExclusiveModeEXT failed with error: VK_ERROR_SURFACE_LOST_KHR" ); case VkResult.ErrorUnknown: throw new VkResultError( VkResult.ErrorUnknown, "Vulkan call to vkReleaseFullScreenExclusiveModeEXT failed with error: VK_ERROR_UNKNOWN" ); case VkResult.ErrorValidationFailed: throw new VkResultError( VkResult.ErrorValidationFailed, "Vulkan call to vkReleaseFullScreenExclusiveModeEXT failed with error: VK_ERROR_VALIDATION_FAILED" ); case VkResult.Success: default: break; } } /// /// vkGetDeviceGroupSurfacePresentModes2EXT - Query device group present capabilities for a surface /// /// /// /// To query the supported device group presentation modes for a surface /// combined with select other fixed swapchain creation parameters, call: /// /// /// // Provided by VK_EXT_full_screen_exclusive with VK_KHR_device_group or VK_VERSION_1_1 /// VkResult vkGetDeviceGroupSurfacePresentModes2EXT( /// VkDevice device, /// const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, /// VkDeviceGroupPresentModeFlagsKHR* pModes); /// /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [SupportedOSPlatform("windows")] public static unsafe VkDeviceGroupPresentModeFlagsKHR GetGroupSurfacePresentModes2EXT( this VulkanHandleWrapper handle, in VkPhysicalDeviceSurfaceInfo2KHR pSurfaceInfo ) { fixed (VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfoFixed = &pSurfaceInfo) { VkDeviceGroupPresentModeFlagsKHR pModesLocal = default; VkResult result = handle.PInvoke.vkGetDeviceGroupSurfacePresentModes2EXT.Invoke( handle.Handle, pSurfaceInfoFixed, &pModesLocal ); switch (result) { case VkResult.ErrorOutOfHostMemory: throw new VkResultError( VkResult.ErrorOutOfHostMemory, "Vulkan call to vkGetDeviceGroupSurfacePresentModes2EXT failed with error: VK_ERROR_OUT_OF_HOST_MEMORY" ); case VkResult.ErrorOutOfDeviceMemory: throw new VkResultError( VkResult.ErrorOutOfDeviceMemory, "Vulkan call to vkGetDeviceGroupSurfacePresentModes2EXT failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY" ); case VkResult.ErrorSurfaceLostKHR: throw new VkResultError( VkResult.ErrorSurfaceLostKHR, "Vulkan call to vkGetDeviceGroupSurfacePresentModes2EXT failed with error: VK_ERROR_SURFACE_LOST_KHR" ); case VkResult.ErrorUnknown: throw new VkResultError( VkResult.ErrorUnknown, "Vulkan call to vkGetDeviceGroupSurfacePresentModes2EXT failed with error: VK_ERROR_UNKNOWN" ); case VkResult.ErrorValidationFailed: throw new VkResultError( VkResult.ErrorValidationFailed, "Vulkan call to vkGetDeviceGroupSurfacePresentModes2EXT failed with error: VK_ERROR_VALIDATION_FAILED" ); case VkResult.Success: default: break; } return pModesLocal; } } /// /// vkAcquireWinrtDisplayNV - Acquire access to a VkDisplayKHR /// /// /// /// :refpage: vkAcquireWinrtDisplayNV /// /// /// To acquire permission to directly access a display in Vulkan on Windows 10, /// call: /// /// /// // Provided by VK_NV_acquire_winrt_display /// VkResult vkAcquireWinrtDisplayNV( /// VkPhysicalDevice physicalDevice, /// VkDisplayKHR display); /// /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [SupportedOSPlatform("windows")] public static void AcquireWinrtDisplayNV( this VulkanHandleWrapper handle, VkDisplayKHR display ) { VkResult result = handle.PInvoke.vkAcquireWinrtDisplayNV.Invoke(handle.Handle, display); switch (result) { case VkResult.ErrorOutOfHostMemory: throw new VkResultError( VkResult.ErrorOutOfHostMemory, "Vulkan call to vkAcquireWinrtDisplayNV failed with error: VK_ERROR_OUT_OF_HOST_MEMORY" ); case VkResult.ErrorDeviceLost: throw new VkResultError( VkResult.ErrorDeviceLost, "Vulkan call to vkAcquireWinrtDisplayNV failed with error: VK_ERROR_DEVICE_LOST" ); case VkResult.ErrorInitializationFailed: throw new VkResultError( VkResult.ErrorInitializationFailed, "Vulkan call to vkAcquireWinrtDisplayNV failed with error: VK_ERROR_INITIALIZATION_FAILED" ); case VkResult.ErrorUnknown: throw new VkResultError( VkResult.ErrorUnknown, "Vulkan call to vkAcquireWinrtDisplayNV failed with error: VK_ERROR_UNKNOWN" ); case VkResult.ErrorValidationFailed: throw new VkResultError( VkResult.ErrorValidationFailed, "Vulkan call to vkAcquireWinrtDisplayNV failed with error: VK_ERROR_VALIDATION_FAILED" ); case VkResult.Success: default: break; } } /// /// vkGetWinrtDisplayNV - Query the VkDisplayKHR corresponding to a WinRT DisplayTarget /// /// /// /// :refpage: vkGetWinrtDisplayNV /// /// /// When acquiring displays on Windows 10, an application may also wish to /// enumerate and identify them using a native handle rather than a /// VkDisplayKHR handle. /// /// /// To determine the VkDisplayKHR handle corresponding to a /// https://docs.microsoft.com/en-us/uwp/api/windows.devices.display.core.displaytarget["`winrt::Windows::Devices::Display::Core::DisplayTarget`"], /// call: /// /// /// // Provided by VK_NV_acquire_winrt_display /// VkResult vkGetWinrtDisplayNV( /// VkPhysicalDevice physicalDevice, /// uint32_t deviceRelativeId, /// VkDisplayKHR* pDisplay); /// /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [SupportedOSPlatform("windows")] public static unsafe VkDisplayKHR GetWinrtDisplayNV( this VulkanHandleWrapper handle, int deviceRelativeId ) { VkDisplayKHR pDisplayLocal = default; VkResult result = handle.PInvoke.vkGetWinrtDisplayNV.Invoke( handle.Handle, deviceRelativeId, &pDisplayLocal ); switch (result) { case VkResult.ErrorOutOfHostMemory: throw new VkResultError( VkResult.ErrorOutOfHostMemory, "Vulkan call to vkGetWinrtDisplayNV failed with error: VK_ERROR_OUT_OF_HOST_MEMORY" ); case VkResult.ErrorDeviceLost: throw new VkResultError( VkResult.ErrorDeviceLost, "Vulkan call to vkGetWinrtDisplayNV failed with error: VK_ERROR_DEVICE_LOST" ); case VkResult.ErrorInitializationFailed: throw new VkResultError( VkResult.ErrorInitializationFailed, "Vulkan call to vkGetWinrtDisplayNV failed with error: VK_ERROR_INITIALIZATION_FAILED" ); case VkResult.ErrorUnknown: throw new VkResultError( VkResult.ErrorUnknown, "Vulkan call to vkGetWinrtDisplayNV failed with error: VK_ERROR_UNKNOWN" ); case VkResult.ErrorValidationFailed: throw new VkResultError( VkResult.ErrorValidationFailed, "Vulkan call to vkGetWinrtDisplayNV failed with error: VK_ERROR_VALIDATION_FAILED" ); case VkResult.Success: default: break; } return pDisplayLocal; } } }