This commit is contained in:
Rian Drake 2026-10-15 14:09:11 +13:00
commit b578433e37
8 changed files with 784842 additions and 0 deletions

View file

@ -0,0 +1,215 @@
using System.Runtime.Versioning;
namespace Brutal.VulkanApi.Android
{
public static unsafe partial class AndroidExtensions
{
/// <summary>
/// <see href="https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCreateAndroidSurfaceKHR.html">vkCreateAndroidSurfaceKHR</see> - Create a &lt;c&gt;VkSurfaceKHR&lt;/c&gt; object for an Android native window
/// </summary>
/// <remarks>
/// <para>
/// :refpage: vkCreateAndroidSurfaceKHR
/// </para>
/// <para>
/// To create a <c>VkSurfaceKHR</c> object for an Android native window, call:
/// </para>
/// <code>
/// // Provided by VK_KHR_android_surface
/// VkResult vkCreateAndroidSurfaceKHR(
/// VkInstance instance,
/// const VkAndroidSurfaceCreateInfoKHR* pCreateInfo,
/// const VkAllocationCallbacks* pAllocator,
/// VkSurfaceKHR* pSurface);
/// </code>
/// </remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[SupportedOSPlatform("android")]
public static unsafe void CreateAndroidSurfaceKHR(
this VulkanHandleWrapper<VkInstance, VkInstance.FunctionTable> handle,
in VkAndroidSurfaceCreateInfoKHR pCreateInfo,
VkAllocator? pAllocator,
out VkSurfaceKHR pSurface
)
{
fixed (VkAndroidSurfaceCreateInfoKHR* pCreateInfoFixed = &pCreateInfo)
{
VkSurfaceKHR pSurfaceLocal = default;
VkResult result = handle.PInvoke.vkCreateAndroidSurfaceKHR.Invoke(
handle.Handle,
pCreateInfoFixed,
pAllocator,
&pSurfaceLocal
);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkCreateAndroidSurfaceKHR failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkCreateAndroidSurfaceKHR failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorNativeWindowInUseKHR:
throw new VkResultError(
VkResult.ErrorNativeWindowInUseKHR,
"Vulkan call to vkCreateAndroidSurfaceKHR failed with error: VK_ERROR_NATIVE_WINDOW_IN_USE_KHR"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkCreateAndroidSurfaceKHR failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkCreateAndroidSurfaceKHR failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
pSurface = pSurfaceLocal;
}
}
/// <summary>
/// <see href="https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetAndroidHardwareBufferPropertiesANDROID.html">vkGetAndroidHardwareBufferPropertiesANDROID</see> - Get Properties of External Memory Android Hardware Buffers
/// </summary>
/// <remarks>
/// <para>
/// To determine the memory parameters to use when importing an Android hardware
/// buffer, call:
/// </para>
/// <code>
/// // Provided by VK_ANDROID_external_memory_android_hardware_buffer
/// VkResult vkGetAndroidHardwareBufferPropertiesANDROID(
/// VkDevice device,
/// const struct AHardwareBuffer* buffer,
/// VkAndroidHardwareBufferPropertiesANDROID* pProperties);
/// </code>
/// </remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[SupportedOSPlatform("android")]
public static unsafe void GetAndroidHardwareBufferPropertiesANDROID(
this VulkanHandleWrapper<VkDevice, VkDevice.FunctionTable> handle,
void* buffer,
ref VkAndroidHardwareBufferPropertiesANDROID pProperties
)
{
fixed (VkAndroidHardwareBufferPropertiesANDROID* pPropertiesFixed = &pProperties)
{
VkResult result = handle.PInvoke.vkGetAndroidHardwareBufferPropertiesANDROID.Invoke(
handle.Handle,
buffer,
pPropertiesFixed
);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkGetAndroidHardwareBufferPropertiesANDROID failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorInvalidExternalHandleKHR:
throw new VkResultError(
VkResult.ErrorInvalidExternalHandleKHR,
"Vulkan call to vkGetAndroidHardwareBufferPropertiesANDROID failed with error: VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkGetAndroidHardwareBufferPropertiesANDROID failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkGetAndroidHardwareBufferPropertiesANDROID failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
}
}
/// <summary>Wrapper that returns the struct instead of taking it as a ref parameter.</summary>
/// <returns>The VkAndroidHardwareBufferPropertiesANDROID.</returns>
[SupportedOSPlatform("android")]
public static unsafe VkAndroidHardwareBufferPropertiesANDROID GetAndroidHardwareBufferPropertiesANDROID(
this VulkanHandleWrapper<VkDevice, VkDevice.FunctionTable> handle,
void* buffer
)
{
VkAndroidHardwareBufferPropertiesANDROID outValue = new();
GetAndroidHardwareBufferPropertiesANDROID(handle, buffer, ref outValue);
return outValue;
}
/// <summary>
/// <see href="https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetMemoryAndroidHardwareBufferANDROID.html">vkGetMemoryAndroidHardwareBufferANDROID</see> - Get an Android hardware buffer for a memory object
/// </summary>
/// <remarks>
/// <para>
/// To export an Android hardware buffer referencing the payload of a Vulkan
/// device memory object, call:
/// </para>
/// <code>
/// // Provided by VK_ANDROID_external_memory_android_hardware_buffer
/// VkResult vkGetMemoryAndroidHardwareBufferANDROID(
/// VkDevice device,
/// const VkMemoryGetAndroidHardwareBufferInfoANDROID* pInfo,
/// struct AHardwareBuffer** pBuffer);
/// </code>
/// </remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[SupportedOSPlatform("android")]
public static unsafe void* GetMemoryAndroidHardwareBufferANDROID(
this VulkanHandleWrapper<VkDevice, VkDevice.FunctionTable> handle,
in VkMemoryGetAndroidHardwareBufferInfoANDROID pInfo
)
{
fixed (VkMemoryGetAndroidHardwareBufferInfoANDROID* pInfoFixed = &pInfo)
{
void* pBufferLocal = default;
VkResult result = handle.PInvoke.vkGetMemoryAndroidHardwareBufferANDROID.Invoke(
handle.Handle,
pInfoFixed,
&pBufferLocal
);
switch (result)
{
case VkResult.ErrorTooManyObjects:
throw new VkResultError(
VkResult.ErrorTooManyObjects,
"Vulkan call to vkGetMemoryAndroidHardwareBufferANDROID failed with error: VK_ERROR_TOO_MANY_OBJECTS"
);
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkGetMemoryAndroidHardwareBufferANDROID failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkGetMemoryAndroidHardwareBufferANDROID failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkGetMemoryAndroidHardwareBufferANDROID failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
return pBufferLocal;
}
}
}
}

View file

@ -0,0 +1,248 @@
using System.Runtime.Versioning;
namespace Brutal.VulkanApi.Metal
{
public static unsafe partial class MetalExtensions
{
/// <summary>
/// <see href="https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCreateMetalSurfaceEXT.html">vkCreateMetalSurfaceEXT</see> - Create a VkSurfaceKHR object for CAMetalLayer
/// </summary>
/// <remarks>
/// <para>
/// :refpage: vkCreateMetalSurfaceEXT
/// </para>
/// <para>
/// To create a <c>VkSurfaceKHR</c> object for a basetype:CAMetalLayer, call:
/// </para>
/// <code>
/// // Provided by VK_EXT_metal_surface
/// VkResult vkCreateMetalSurfaceEXT(
/// VkInstance instance,
/// const VkMetalSurfaceCreateInfoEXT* pCreateInfo,
/// const VkAllocationCallbacks* pAllocator,
/// VkSurfaceKHR* pSurface);
/// </code>
/// </remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[SupportedOSPlatform("macos"), SupportedOSPlatform("ios")]
public static unsafe void CreateMetalSurfaceEXT(
this VulkanHandleWrapper<VkInstance, VkInstance.FunctionTable> handle,
in VkMetalSurfaceCreateInfoEXT pCreateInfo,
VkAllocator? pAllocator,
out VkSurfaceKHR pSurface
)
{
fixed (VkMetalSurfaceCreateInfoEXT* pCreateInfoFixed = &pCreateInfo)
{
VkSurfaceKHR pSurfaceLocal = default;
VkResult result = handle.PInvoke.vkCreateMetalSurfaceEXT.Invoke(
handle.Handle,
pCreateInfoFixed,
pAllocator,
&pSurfaceLocal
);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkCreateMetalSurfaceEXT failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkCreateMetalSurfaceEXT failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorNativeWindowInUseKHR:
throw new VkResultError(
VkResult.ErrorNativeWindowInUseKHR,
"Vulkan call to vkCreateMetalSurfaceEXT failed with error: VK_ERROR_NATIVE_WINDOW_IN_USE_KHR"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkCreateMetalSurfaceEXT failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkCreateMetalSurfaceEXT failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
pSurface = pSurfaceLocal;
}
}
/// <summary>
/// <see href="https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkExportMetalObjectsEXT.html">vkExportMetalObjectsEXT</see> - Export Metal objects from the corresponding Vulkan objects
/// </summary>
/// <remarks>
/// <para>
/// To export Metal objects that underlie Vulkan objects, call:
/// </para>
/// <code>
/// // Provided by VK_EXT_metal_objects
/// void vkExportMetalObjectsEXT(
/// VkDevice device,
/// VkExportMetalObjectsInfoEXT* pMetalObjectsInfo);
/// </code>
/// </remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[SupportedOSPlatform("macos"), SupportedOSPlatform("ios")]
public static unsafe void ExportMetalObjectsEXT(
this VulkanHandleWrapper<VkDevice, VkDevice.FunctionTable> handle,
ref VkExportMetalObjectsInfoEXT pMetalObjectsInfo
)
{
fixed (VkExportMetalObjectsInfoEXT* pMetalObjectsInfoFixed = &pMetalObjectsInfo)
{
handle.PInvoke.vkExportMetalObjectsEXT.Invoke(handle.Handle, pMetalObjectsInfoFixed);
}
}
/// <summary>
/// <see href="https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetMemoryMetalHandleEXT.html">vkGetMemoryMetalHandleEXT</see> - Get a Metal handle for a memory object
/// </summary>
/// <remarks>
/// <para>
/// To export a Metal handle representing the payload of a Vulkan device memory
/// object, call:
/// </para>
/// <code>
/// // Provided by VK_EXT_external_memory_metal
/// VkResult vkGetMemoryMetalHandleEXT(
/// VkDevice device,
/// const VkMemoryGetMetalHandleInfoEXT* pGetMetalHandleInfo,
/// void** pHandle);
/// </code>
/// </remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[SupportedOSPlatform("macos"), SupportedOSPlatform("ios")]
public static unsafe void* GetMemoryMetalHandleEXT(
this VulkanHandleWrapper<VkDevice, VkDevice.FunctionTable> handle,
in VkMemoryGetMetalHandleInfoEXT pGetMetalHandleInfo
)
{
fixed (VkMemoryGetMetalHandleInfoEXT* pGetMetalHandleInfoFixed = &pGetMetalHandleInfo)
{
void* pHandleLocal = default;
VkResult result = handle.PInvoke.vkGetMemoryMetalHandleEXT.Invoke(
handle.Handle,
pGetMetalHandleInfoFixed,
&pHandleLocal
);
switch (result)
{
case VkResult.ErrorTooManyObjects:
throw new VkResultError(
VkResult.ErrorTooManyObjects,
"Vulkan call to vkGetMemoryMetalHandleEXT failed with error: VK_ERROR_TOO_MANY_OBJECTS"
);
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkGetMemoryMetalHandleEXT failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkGetMemoryMetalHandleEXT failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkGetMemoryMetalHandleEXT failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
return pHandleLocal;
}
}
/// <summary>
/// <see href="https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetMemoryMetalHandlePropertiesEXT.html">vkGetMemoryMetalHandlePropertiesEXT</see> - Get Properties of External Memory Metal Handles
/// </summary>
/// <remarks>
/// <para>
/// Metal 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:
/// </para>
/// <code>
/// // Provided by VK_EXT_external_memory_metal
/// VkResult vkGetMemoryMetalHandlePropertiesEXT(
/// VkDevice device,
/// VkExternalMemoryHandleTypeFlagBits handleType,
/// const void* pHandle,
/// VkMemoryMetalHandlePropertiesEXT* pMemoryMetalHandleProperties);
/// </code>
/// </remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[SupportedOSPlatform("macos"), SupportedOSPlatform("ios")]
public static unsafe void GetMemoryMetalHandlePropertiesEXT(
this VulkanHandleWrapper<VkDevice, VkDevice.FunctionTable> handle,
VkExternalMemoryHandleTypeFlags handleType,
void* pHandle,
ref VkMemoryMetalHandlePropertiesEXT pMemoryMetalHandleProperties
)
{
fixed (VkMemoryMetalHandlePropertiesEXT* pMemoryMetalHandlePropertiesFixed = &pMemoryMetalHandleProperties)
{
VkResult result = handle.PInvoke.vkGetMemoryMetalHandlePropertiesEXT.Invoke(
handle.Handle,
handleType,
pHandle,
pMemoryMetalHandlePropertiesFixed
);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkGetMemoryMetalHandlePropertiesEXT failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorInvalidExternalHandle:
throw new VkResultError(
VkResult.ErrorInvalidExternalHandle,
"Vulkan call to vkGetMemoryMetalHandlePropertiesEXT failed with error: VK_ERROR_INVALID_EXTERNAL_HANDLE"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkGetMemoryMetalHandlePropertiesEXT failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkGetMemoryMetalHandlePropertiesEXT failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
}
}
/// <summary>Wrapper that returns the struct instead of taking it as a ref parameter.</summary>
/// <returns>The VkMemoryMetalHandlePropertiesEXT.</returns>
[SupportedOSPlatform("macos"), SupportedOSPlatform("ios")]
public static unsafe VkMemoryMetalHandlePropertiesEXT GetMemoryMetalHandlePropertiesEXT(
this VulkanHandleWrapper<VkDevice, VkDevice.FunctionTable> handle,
VkExternalMemoryHandleTypeFlags handleType,
void* pHandle
)
{
VkMemoryMetalHandlePropertiesEXT outValue = new();
GetMemoryMetalHandlePropertiesEXT(handle, handleType, pHandle, ref outValue);
return outValue;
}
}
}

View file

@ -0,0 +1,106 @@
using System.Runtime.Versioning;
namespace Brutal.VulkanApi.Wayland
{
public static unsafe partial class WaylandExtensions
{
/// <summary>
/// <see href="https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCreateWaylandSurfaceKHR.html">vkCreateWaylandSurfaceKHR</see> - Create a &lt;c&gt;VkSurfaceKHR&lt;/c&gt; object for a Wayland window
/// </summary>
/// <remarks>
/// <para>
/// :refpage: vkCreateWaylandSurfaceKHR
/// </para>
/// <para>
/// To create a <c>VkSurfaceKHR</c> object for a Wayland surface, call:
/// </para>
/// <code>
/// // Provided by VK_KHR_wayland_surface
/// VkResult vkCreateWaylandSurfaceKHR(
/// VkInstance instance,
/// const VkWaylandSurfaceCreateInfoKHR* pCreateInfo,
/// const VkAllocationCallbacks* pAllocator,
/// VkSurfaceKHR* pSurface);
/// </code>
/// </remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[SupportedOSPlatform("linux")]
public static unsafe void CreateWaylandSurfaceKHR(
this VulkanHandleWrapper<VkInstance, VkInstance.FunctionTable> handle,
in VkWaylandSurfaceCreateInfoKHR pCreateInfo,
VkAllocator? pAllocator,
out VkSurfaceKHR pSurface
)
{
fixed (VkWaylandSurfaceCreateInfoKHR* pCreateInfoFixed = &pCreateInfo)
{
VkSurfaceKHR pSurfaceLocal = default;
VkResult result = handle.PInvoke.vkCreateWaylandSurfaceKHR.Invoke(
handle.Handle,
pCreateInfoFixed,
pAllocator,
&pSurfaceLocal
);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkCreateWaylandSurfaceKHR failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkCreateWaylandSurfaceKHR failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkCreateWaylandSurfaceKHR failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkCreateWaylandSurfaceKHR failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
pSurface = pSurfaceLocal;
}
}
/// <summary>
/// <see href="https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceWaylandPresentationSupportKHR.html">vkGetPhysicalDeviceWaylandPresentationSupportKHR</see> - Query physical device for presentation to Wayland
/// </summary>
/// <remarks>
/// <para>
/// To determine whether a queue family of a physical device supports
/// presentation to a Wayland compositor, call:
/// </para>
/// <code>
/// // Provided by VK_KHR_wayland_surface
/// VkBool32 vkGetPhysicalDeviceWaylandPresentationSupportKHR(
/// VkPhysicalDevice physicalDevice,
/// uint32_t queueFamilyIndex,
/// struct wl_display* display);
/// </code>
/// </remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[SupportedOSPlatform("linux")]
public static unsafe Brutal.Bool32 GetWaylandPresentationSupportKHR(
this VulkanHandleWrapper<VkPhysicalDevice, VkInstance.FunctionTable> handle,
int queueFamilyIndex,
void* display
)
{
return handle.PInvoke.vkGetPhysicalDeviceWaylandPresentationSupportKHR.Invoke(
handle.Handle,
queueFamilyIndex,
display
);
}
}
}

View file

@ -0,0 +1,962 @@
using System.Runtime.Versioning;
namespace Brutal.VulkanApi.Win32
{
public static unsafe partial class Win32Extensions
{
/// <summary>
/// <see href="https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCreateWin32SurfaceKHR.html">vkCreateWin32SurfaceKHR</see> - Create a VkSurfaceKHR object for a Win32 native window
/// </summary>
/// <remarks>
/// <para>
/// :refpage: vkCreateWin32SurfaceKHR
/// </para>
/// <para>
/// To create a <c>VkSurfaceKHR</c> object for a Win32 window, call:
/// </para>
/// <code>
/// // Provided by VK_KHR_win32_surface
/// VkResult vkCreateWin32SurfaceKHR(
/// VkInstance instance,
/// const VkWin32SurfaceCreateInfoKHR* pCreateInfo,
/// const VkAllocationCallbacks* pAllocator,
/// VkSurfaceKHR* pSurface);
/// </code>
/// </remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[SupportedOSPlatform("windows")]
public static unsafe void CreateWin32SurfaceKHR(
this VulkanHandleWrapper<VkInstance, VkInstance.FunctionTable> 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;
}
}
/// <summary>
/// <see href="https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceWin32PresentationSupportKHR.html">vkGetPhysicalDeviceWin32PresentationSupportKHR</see> - Query queue family support for presentation on a Win32 display
/// </summary>
/// <remarks>
/// <para>
/// To determine whether a queue family of a physical device supports
/// presentation to the Microsoft Windows desktop, call:
/// </para>
/// <code>
/// // Provided by VK_KHR_win32_surface
/// VkBool32 vkGetPhysicalDeviceWin32PresentationSupportKHR(
/// VkPhysicalDevice physicalDevice,
/// uint32_t queueFamilyIndex);
/// </code>
/// </remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[SupportedOSPlatform("windows")]
public static Brutal.Bool32 GetWin32PresentationSupportKHR(
this VulkanHandleWrapper<VkPhysicalDevice, VkInstance.FunctionTable> handle,
int queueFamilyIndex
)
{
return handle.PInvoke.vkGetPhysicalDeviceWin32PresentationSupportKHR.Invoke(
handle.Handle,
queueFamilyIndex
);
}
/// <summary>
/// <see href="https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetMemoryWin32HandleKHR.html">vkGetMemoryWin32HandleKHR</see> - Get a Windows HANDLE for a memory object
/// </summary>
/// <remarks>
/// <para>
/// To export a Windows handle representing the payload of a Vulkan device
/// memory object, call:
/// </para>
/// <code>
/// // Provided by VK_KHR_external_memory_win32
/// VkResult vkGetMemoryWin32HandleKHR(
/// VkDevice device,
/// const VkMemoryGetWin32HandleInfoKHR* pGetWin32HandleInfo,
/// HANDLE* pHandle);
/// </code>
/// </remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[SupportedOSPlatform("windows")]
public static unsafe nint GetMemoryWin32HandleKHR(
this VulkanHandleWrapper<VkDevice, VkDevice.FunctionTable> 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;
}
}
/// <summary>
/// <see href="https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetMemoryWin32HandlePropertiesKHR.html">vkGetMemoryWin32HandlePropertiesKHR</see> - Get Properties of External Memory Win32 Handles
/// </summary>
/// <remarks>
/// <para>
/// 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:
/// </para>
/// <code>
/// // Provided by VK_KHR_external_memory_win32
/// VkResult vkGetMemoryWin32HandlePropertiesKHR(
/// VkDevice device,
/// VkExternalMemoryHandleTypeFlagBits handleType,
/// HANDLE handle,
/// VkMemoryWin32HandlePropertiesKHR* pMemoryWin32HandleProperties);
/// </code>
/// </remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[SupportedOSPlatform("windows")]
public static unsafe void GetMemoryWin32HandlePropertiesKHR(
this VulkanHandleWrapper<VkDevice, VkDevice.FunctionTable> 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;
}
}
}
/// <summary>Wrapper that returns the struct instead of taking it as a ref parameter.</summary>
/// <returns>The VkMemoryWin32HandlePropertiesKHR.</returns>
[SupportedOSPlatform("windows")]
public static VkMemoryWin32HandlePropertiesKHR GetMemoryWin32HandlePropertiesKHR(
this VulkanHandleWrapper<VkDevice, VkDevice.FunctionTable> handle,
VkExternalMemoryHandleTypeFlags handleType,
nint win32Handle
)
{
VkMemoryWin32HandlePropertiesKHR outValue = new();
GetMemoryWin32HandlePropertiesKHR(handle, handleType, win32Handle, ref outValue);
return outValue;
}
/// <summary>
/// <see href="https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkImportSemaphoreWin32HandleKHR.html">vkImportSemaphoreWin32HandleKHR</see> - Import a semaphore from a Windows HANDLE
/// </summary>
/// <remarks>
/// <para>
/// To import a semaphore payload from a Windows handle, call:
/// </para>
/// <code>
/// // Provided by VK_KHR_external_semaphore_win32
/// VkResult vkImportSemaphoreWin32HandleKHR(
/// VkDevice device,
/// const VkImportSemaphoreWin32HandleInfoKHR* pImportSemaphoreWin32HandleInfo);
/// </code>
/// </remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[SupportedOSPlatform("windows")]
public static unsafe void ImportSemaphoreWin32HandleKHR(
this VulkanHandleWrapper<VkDevice, VkDevice.FunctionTable> 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;
}
}
}
/// <summary>
/// <see href="https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetSemaphoreWin32HandleKHR.html">vkGetSemaphoreWin32HandleKHR</see> - Get a Windows HANDLE for a semaphore
/// </summary>
/// <remarks>
/// <para>
/// To export a Windows handle representing the payload of a semaphore, call:
/// </para>
/// <code>
/// // Provided by VK_KHR_external_semaphore_win32
/// VkResult vkGetSemaphoreWin32HandleKHR(
/// VkDevice device,
/// const VkSemaphoreGetWin32HandleInfoKHR* pGetWin32HandleInfo,
/// HANDLE* pHandle);
/// </code>
/// </remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[SupportedOSPlatform("windows")]
public static unsafe nint GetSemaphoreWin32HandleKHR(
this VulkanHandleWrapper<VkDevice, VkDevice.FunctionTable> 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;
}
}
/// <summary>
/// <see href="https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkImportFenceWin32HandleKHR.html">vkImportFenceWin32HandleKHR</see> - Import a fence from a Windows HANDLE
/// </summary>
/// <remarks>
/// <para>
/// To import a fence payload from a Windows handle, call:
/// </para>
/// <code>
/// // Provided by VK_KHR_external_fence_win32
/// VkResult vkImportFenceWin32HandleKHR(
/// VkDevice device,
/// const VkImportFenceWin32HandleInfoKHR* pImportFenceWin32HandleInfo);
/// </code>
/// </remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[SupportedOSPlatform("windows")]
public static unsafe void ImportFenceWin32HandleKHR(
this VulkanHandleWrapper<VkDevice, VkDevice.FunctionTable> 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;
}
}
}
/// <summary>
/// <see href="https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetFenceWin32HandleKHR.html">vkGetFenceWin32HandleKHR</see> - Get a Windows HANDLE for a fence
/// </summary>
/// <remarks>
/// <para>
/// To export a Windows handle representing the state of a fence, call:
/// </para>
/// <code>
/// // Provided by VK_KHR_external_fence_win32
/// VkResult vkGetFenceWin32HandleKHR(
/// VkDevice device,
/// const VkFenceGetWin32HandleInfoKHR* pGetWin32HandleInfo,
/// HANDLE* pHandle);
/// </code>
/// </remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[SupportedOSPlatform("windows")]
public static unsafe nint GetFenceWin32HandleKHR(
this VulkanHandleWrapper<VkDevice, VkDevice.FunctionTable> 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;
}
}
/// <summary>
/// <see href="https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetMemoryWin32HandleNV.html">vkGetMemoryWin32HandleNV</see> - Retrieve Win32 handle to a device memory object
/// </summary>
/// <remarks>
/// <para>
/// To retrieve the handle corresponding to a device memory object created with
/// <c>VkExportMemoryAllocateInfoNV::handleTypes</c> set to include
/// <c>VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_NV</c> or
/// <c>VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_NV</c>, call:
/// </para>
/// <code>
/// // Provided by VK_NV_external_memory_win32
/// VkResult vkGetMemoryWin32HandleNV(
/// VkDevice device,
/// VkDeviceMemory memory,
/// VkExternalMemoryHandleTypeFlagsNV handleType,
/// HANDLE* pHandle);
/// </code>
/// </remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[SupportedOSPlatform("windows")]
public static unsafe nint GetMemoryWin32HandleNV(
this VulkanHandleWrapper<VkDevice, VkDevice.FunctionTable> 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;
}
/// <summary>
/// <see href="https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceSurfacePresentModes2EXT.html">vkGetPhysicalDeviceSurfacePresentModes2EXT</see> - Query supported presentation modes
/// </summary>
/// <remarks>
/// <para>
/// :refpage: vkGetPhysicalDeviceSurfacePresentModes2EXT
/// </para>
/// <para>
/// To query the supported presentation modes for a surface combined with select
/// other fixed swapchain creation parameters, call:
/// </para>
/// <code>
/// // Provided by VK_EXT_full_screen_exclusive
/// VkResult vkGetPhysicalDeviceSurfacePresentModes2EXT(
/// VkPhysicalDevice physicalDevice,
/// const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo,
/// uint32_t* pPresentModeCount,
/// VkPresentModeKHR* pPresentModes);
/// </code>
/// </remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[SupportedOSPlatform("windows")]
private static unsafe VkResult GetSurfacePresentModes2EXT(
this VulkanHandleWrapper<VkPhysicalDevice, VkInstance.FunctionTable> handle,
in VkPhysicalDeviceSurfaceInfo2KHR pSurfaceInfo,
ref int pPresentModeCount,
scoped ReadOnlySpan<VkPresentModeKHR> 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;
}
}
/// <summary>Queries the required length.</summary>
/// <returns>The required length.</returns>
[SupportedOSPlatform("windows")]
public static int GetSurfacePresentModes2EXT_Count(
this VulkanHandleWrapper<VkPhysicalDevice, VkInstance.FunctionTable> handle,
in VkPhysicalDeviceSurfaceInfo2KHR pSurfaceInfo
)
{
int pPresentModeCount = default;
GetSurfacePresentModes2EXT(handle, pSurfaceInfo, ref pPresentModeCount, null);
return pPresentModeCount;
}
/// <summary>Writes to a provided span.</summary>
/// <param name="pPresentModes">The span to write to.</param>
/// <returns>Return value of the underlying function.</returns>
[SupportedOSPlatform("windows")]
public static VkResult GetSurfacePresentModes2EXT_Write(
this VulkanHandleWrapper<VkPhysicalDevice, VkInstance.FunctionTable> handle,
in VkPhysicalDeviceSurfaceInfo2KHR pSurfaceInfo,
scoped ReadOnlySpan<VkPresentModeKHR> pPresentModes
)
{
int pPresentModeCount = pPresentModes.Length;
return GetSurfacePresentModes2EXT(handle, pSurfaceInfo, ref pPresentModeCount, pPresentModes);
}
/// <summary>
/// <see href="https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkAcquireFullScreenExclusiveModeEXT.html">vkAcquireFullScreenExclusiveModeEXT</see> - Acquire full-screen exclusive mode for a swapchain
/// </summary>
/// <remarks>
/// <para>
/// To acquire exclusive full-screen access for a swapchain, call:
/// </para>
/// <code>
/// // Provided by VK_EXT_full_screen_exclusive
/// VkResult vkAcquireFullScreenExclusiveModeEXT(
/// VkDevice device,
/// VkSwapchainKHR swapchain);
/// </code>
/// </remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[SupportedOSPlatform("windows")]
public static void AcquireFullScreenExclusiveModeEXT(
this VulkanHandleWrapper<VkDevice, VkDevice.FunctionTable> 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;
}
}
/// <summary>
/// <see href="https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkReleaseFullScreenExclusiveModeEXT.html">vkReleaseFullScreenExclusiveModeEXT</see> - Release full-screen exclusive mode from a swapchain
/// </summary>
/// <remarks>
/// <para>
/// To release exclusive full-screen access from a swapchain, call:
/// </para>
/// <code>
/// // Provided by VK_EXT_full_screen_exclusive
/// VkResult vkReleaseFullScreenExclusiveModeEXT(
/// VkDevice device,
/// VkSwapchainKHR swapchain);
/// </code>
/// </remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[SupportedOSPlatform("windows")]
public static void ReleaseFullScreenExclusiveModeEXT(
this VulkanHandleWrapper<VkDevice, VkDevice.FunctionTable> 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;
}
}
/// <summary>
/// <see href="https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetDeviceGroupSurfacePresentModes2EXT.html">vkGetDeviceGroupSurfacePresentModes2EXT</see> - Query device group present capabilities for a surface
/// </summary>
/// <remarks>
/// <para>
/// To query the supported device group presentation modes for a surface
/// combined with select other fixed swapchain creation parameters, call:
/// </para>
/// <code>
/// // 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);
/// </code>
/// </remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[SupportedOSPlatform("windows")]
public static unsafe VkDeviceGroupPresentModeFlagsKHR GetGroupSurfacePresentModes2EXT(
this VulkanHandleWrapper<VkDevice, VkDevice.FunctionTable> 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;
}
}
/// <summary>
/// <see href="https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkAcquireWinrtDisplayNV.html">vkAcquireWinrtDisplayNV</see> - Acquire access to a VkDisplayKHR
/// </summary>
/// <remarks>
/// <para>
/// :refpage: vkAcquireWinrtDisplayNV
/// </para>
/// <para>
/// To acquire permission to directly access a display in Vulkan on Windows 10,
/// call:
/// </para>
/// <code>
/// // Provided by VK_NV_acquire_winrt_display
/// VkResult vkAcquireWinrtDisplayNV(
/// VkPhysicalDevice physicalDevice,
/// VkDisplayKHR display);
/// </code>
/// </remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[SupportedOSPlatform("windows")]
public static void AcquireWinrtDisplayNV(
this VulkanHandleWrapper<VkPhysicalDevice, VkInstance.FunctionTable> 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;
}
}
/// <summary>
/// <see href="https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetWinrtDisplayNV.html">vkGetWinrtDisplayNV</see> - Query the VkDisplayKHR corresponding to a WinRT DisplayTarget
/// </summary>
/// <remarks>
/// <para>
/// :refpage: vkGetWinrtDisplayNV
/// </para>
/// <para>
/// When acquiring displays on Windows 10, an application may also wish to
/// enumerate and identify them using a native handle rather than a
/// <c>VkDisplayKHR</c> handle.
/// </para>
/// <para>
/// To determine the <c>VkDisplayKHR</c> handle corresponding to a
/// https://docs.microsoft.com/en-us/uwp/api/windows.devices.display.core.displaytarget[&quot;`winrt::Windows::Devices::Display::Core::DisplayTarget`&quot;],
/// call:
/// </para>
/// <code>
/// // Provided by VK_NV_acquire_winrt_display
/// VkResult vkGetWinrtDisplayNV(
/// VkPhysicalDevice physicalDevice,
/// uint32_t deviceRelativeId,
/// VkDisplayKHR* pDisplay);
/// </code>
/// </remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[SupportedOSPlatform("windows")]
public static unsafe VkDisplayKHR GetWinrtDisplayNV(
this VulkanHandleWrapper<VkPhysicalDevice, VkInstance.FunctionTable> 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;
}
}
}

View file

@ -0,0 +1,110 @@
using System.Runtime.Versioning;
namespace Brutal.VulkanApi.Xcb
{
public static unsafe partial class XcbExtensions
{
/// <summary>
/// <see href="https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCreateXcbSurfaceKHR.html">vkCreateXcbSurfaceKHR</see> - Create a &lt;c&gt;VkSurfaceKHR&lt;/c&gt; object for a X11 window, using the XCB client-side library
/// </summary>
/// <remarks>
/// <para>
/// :refpage: vkCreateXcbSurfaceKHR
/// </para>
/// <para>
/// To create a <c>VkSurfaceKHR</c> object for an X11 window, using the XCB
/// client-side library, call:
/// </para>
/// <code>
/// // Provided by VK_KHR_xcb_surface
/// VkResult vkCreateXcbSurfaceKHR(
/// VkInstance instance,
/// const VkXcbSurfaceCreateInfoKHR* pCreateInfo,
/// const VkAllocationCallbacks* pAllocator,
/// VkSurfaceKHR* pSurface);
/// </code>
/// </remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[SupportedOSPlatform("linux")]
public static unsafe void CreateXcbSurfaceKHR(
this VulkanHandleWrapper<VkInstance, VkInstance.FunctionTable> handle,
in VkXcbSurfaceCreateInfoKHR pCreateInfo,
VkAllocator? pAllocator,
out VkSurfaceKHR pSurface
)
{
fixed (VkXcbSurfaceCreateInfoKHR* pCreateInfoFixed = &pCreateInfo)
{
VkSurfaceKHR pSurfaceLocal = default;
VkResult result = handle.PInvoke.vkCreateXcbSurfaceKHR.Invoke(
handle.Handle,
pCreateInfoFixed,
pAllocator,
&pSurfaceLocal
);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkCreateXcbSurfaceKHR failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkCreateXcbSurfaceKHR failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkCreateXcbSurfaceKHR failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkCreateXcbSurfaceKHR failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
pSurface = pSurfaceLocal;
}
}
/// <summary>
/// <see href="https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceXcbPresentationSupportKHR.html">vkGetPhysicalDeviceXcbPresentationSupportKHR</see> - Query physical device for presentation to X11 server using XCB
/// </summary>
/// <remarks>
/// <para>
/// To determine whether a queue family of a physical device supports
/// presentation to an X11 server, using the XCB client-side library, call:
/// </para>
/// <code>
/// // Provided by VK_KHR_xcb_surface
/// VkBool32 vkGetPhysicalDeviceXcbPresentationSupportKHR(
/// VkPhysicalDevice physicalDevice,
/// uint32_t queueFamilyIndex,
/// xcb_connection_t* connection,
/// xcb_visualid_t visual_id);
/// </code>
/// </remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[SupportedOSPlatform("linux")]
public static unsafe Brutal.Bool32 GetXcbPresentationSupportKHR(
this VulkanHandleWrapper<VkPhysicalDevice, VkInstance.FunctionTable> handle,
int queueFamilyIndex,
void* connection,
int visual_id
)
{
return handle.PInvoke.vkGetPhysicalDeviceXcbPresentationSupportKHR.Invoke(
handle.Handle,
queueFamilyIndex,
connection,
visual_id
);
}
}
}

View file

@ -0,0 +1,223 @@
using System.Runtime.Versioning;
namespace Brutal.VulkanApi.Xlib
{
public static unsafe partial class XlibExtensions
{
/// <summary>
/// <see href="https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCreateXlibSurfaceKHR.html">vkCreateXlibSurfaceKHR</see> - Create a &lt;c&gt;VkSurfaceKHR&lt;/c&gt; object for an X11 window, using the Xlib client-side library
/// </summary>
/// <remarks>
/// <para>
/// :refpage: vkCreateXlibSurfaceKHR
/// </para>
/// <para>
/// To create a <c>VkSurfaceKHR</c> object for an X11 window, using the Xlib
/// client-side library, call:
/// </para>
/// <code>
/// // Provided by VK_KHR_xlib_surface
/// VkResult vkCreateXlibSurfaceKHR(
/// VkInstance instance,
/// const VkXlibSurfaceCreateInfoKHR* pCreateInfo,
/// const VkAllocationCallbacks* pAllocator,
/// VkSurfaceKHR* pSurface);
/// </code>
/// </remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[SupportedOSPlatform("linux")]
public static unsafe void CreateXlibSurfaceKHR(
this VulkanHandleWrapper<VkInstance, VkInstance.FunctionTable> handle,
in VkXlibSurfaceCreateInfoKHR pCreateInfo,
VkAllocator? pAllocator,
out VkSurfaceKHR pSurface
)
{
fixed (VkXlibSurfaceCreateInfoKHR* pCreateInfoFixed = &pCreateInfo)
{
VkSurfaceKHR pSurfaceLocal = default;
VkResult result = handle.PInvoke.vkCreateXlibSurfaceKHR.Invoke(
handle.Handle,
pCreateInfoFixed,
pAllocator,
&pSurfaceLocal
);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkCreateXlibSurfaceKHR failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorOutOfDeviceMemory:
throw new VkResultError(
VkResult.ErrorOutOfDeviceMemory,
"Vulkan call to vkCreateXlibSurfaceKHR failed with error: VK_ERROR_OUT_OF_DEVICE_MEMORY"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkCreateXlibSurfaceKHR failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkCreateXlibSurfaceKHR failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
pSurface = pSurfaceLocal;
}
}
/// <summary>
/// <see href="https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceXlibPresentationSupportKHR.html">vkGetPhysicalDeviceXlibPresentationSupportKHR</see> - Query physical device for presentation to X11 server using Xlib
/// </summary>
/// <remarks>
/// <para>
/// To determine whether a queue family of a physical device supports
/// presentation to an X11 server, using the Xlib client-side library, call:
/// </para>
/// <code>
/// // Provided by VK_KHR_xlib_surface
/// VkBool32 vkGetPhysicalDeviceXlibPresentationSupportKHR(
/// VkPhysicalDevice physicalDevice,
/// uint32_t queueFamilyIndex,
/// Display* dpy,
/// VisualID visualID);
/// </code>
/// </remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[SupportedOSPlatform("linux")]
public static unsafe Brutal.Bool32 GetXlibPresentationSupportKHR(
this VulkanHandleWrapper<VkPhysicalDevice, VkInstance.FunctionTable> handle,
int queueFamilyIndex,
void* dpy,
nint visualID
)
{
return handle.PInvoke.vkGetPhysicalDeviceXlibPresentationSupportKHR.Invoke(
handle.Handle,
queueFamilyIndex,
dpy,
visualID
);
}
/// <summary>
/// <see href="https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkAcquireXlibDisplayEXT.html">vkAcquireXlibDisplayEXT</see> - Acquire access to a VkDisplayKHR using Xlib
/// </summary>
/// <remarks>
/// <para>
/// To acquire permission to directly access a display in Vulkan from an X11
/// server, call:
/// </para>
/// <code>
/// // Provided by VK_EXT_acquire_xlib_display
/// VkResult vkAcquireXlibDisplayEXT(
/// VkPhysicalDevice physicalDevice,
/// Display* dpy,
/// VkDisplayKHR display);
/// </code>
/// </remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[SupportedOSPlatform("linux")]
public static unsafe void AcquireXlibDisplayEXT(
this VulkanHandleWrapper<VkPhysicalDevice, VkInstance.FunctionTable> handle,
void* dpy,
VkDisplayKHR display
)
{
VkResult result = handle.PInvoke.vkAcquireXlibDisplayEXT.Invoke(handle.Handle, dpy, display);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkAcquireXlibDisplayEXT failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorInitializationFailed:
throw new VkResultError(
VkResult.ErrorInitializationFailed,
"Vulkan call to vkAcquireXlibDisplayEXT failed with error: VK_ERROR_INITIALIZATION_FAILED"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkAcquireXlibDisplayEXT failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkAcquireXlibDisplayEXT failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
}
/// <summary>
/// <see href="https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetRandROutputDisplayEXT.html">vkGetRandROutputDisplayEXT</see> - Query the VkDisplayKHR corresponding to an X11 RandR Output
/// </summary>
/// <remarks>
/// <para>
/// When acquiring displays from an X11 server, an application may also wish to
/// enumerate and identify them using a native handle rather than a
/// <c>VkDisplayKHR</c> handle.
/// To determine the <c>VkDisplayKHR</c> handle corresponding to an X11 RandR
/// Output, call:
/// </para>
/// <code>
/// // Provided by VK_EXT_acquire_xlib_display
/// VkResult vkGetRandROutputDisplayEXT(
/// VkPhysicalDevice physicalDevice,
/// Display* dpy,
/// RROutput rrOutput,
/// VkDisplayKHR* pDisplay);
/// </code>
/// </remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[SupportedOSPlatform("linux")]
public static unsafe VkDisplayKHR GetRandROutputDisplayEXT(
this VulkanHandleWrapper<VkPhysicalDevice, VkInstance.FunctionTable> handle,
void* dpy,
nint rrOutput
)
{
VkDisplayKHR pDisplayLocal = default;
VkResult result = handle.PInvoke.vkGetRandROutputDisplayEXT.Invoke(
handle.Handle,
dpy,
rrOutput,
&pDisplayLocal
);
switch (result)
{
case VkResult.ErrorOutOfHostMemory:
throw new VkResultError(
VkResult.ErrorOutOfHostMemory,
"Vulkan call to vkGetRandROutputDisplayEXT failed with error: VK_ERROR_OUT_OF_HOST_MEMORY"
);
case VkResult.ErrorUnknown:
throw new VkResultError(
VkResult.ErrorUnknown,
"Vulkan call to vkGetRandROutputDisplayEXT failed with error: VK_ERROR_UNKNOWN"
);
case VkResult.ErrorValidationFailed:
throw new VkResultError(
VkResult.ErrorValidationFailed,
"Vulkan call to vkGetRandROutputDisplayEXT failed with error: VK_ERROR_VALIDATION_FAILED"
);
case VkResult.Success:
default:
break;
}
return pDisplayLocal;
}
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff