/// <summary> /// Initializes a new instance of the <see cref="PhysicalDeviceExternalImageFormatInfoKhx"/> structure. /// </summary> /// <param name="handleType"> /// A bit indicating a memory handle type that will be used with the memory associated with /// the image. /// </param> /// <param name="next"> /// Is <see cref="IntPtr.Zero"/> or a pointer to an extension-specific structure. /// </param> public PhysicalDeviceExternalImageFormatInfoKhx(ExternalMemoryHandleTypesKhx handleType, IntPtr next = default(IntPtr)) { Type = StructureType.PhysicalDeviceExternalImageFormatInfoKhx; Next = next; HandleType = handleType; }
/// <summary> /// Get a POSIX file descriptor for a memory object. /// </summary> /// <param name="memory">The memory object from which the handle will be exported.</param> /// <param name="handleType">The type of handle requested.</param> /// <returns>A file descriptor representing the underlying resources of the device memory object.</returns> /// <exception cref="VulkanException">Vulkan returns an error code.</exception> public static int GetFdKhx(this DeviceMemory memory, ExternalMemoryHandleTypesKhx handleType) { int fd; Result result = vkGetMemoryFdKHX(memory.Parent, memory, handleType, &fd); VulkanException.ThrowForInvalidResult(result); return(fd); }
/// <summary> /// Get a Windows HANDLE for a memory object. /// </summary> /// <param name="memory">The memory object from which the handle will be exported.</param> /// <param name="handleType">The type of handle requested.</param> /// <returns>The Windows handle representing the underlying resources of the device memory object.</returns> /// <exception cref="VulkanException">Vulkan returns an error code.</exception> public static IntPtr GetWin32HandleKhx(this DeviceMemory memory, ExternalMemoryHandleTypesKhx handleType) { IntPtr handle; Result result = vkGetMemoryWin32HandleKHX(memory.Parent, memory, handleType, &handle); VulkanException.ThrowForInvalidResult(result); return(handle); }
/// <summary> /// Get properties of external memory file descriptors. /// <para> /// POSIX file descriptor memory handles compatible with Vulkan may also be created by /// non-Vulkan APIs using methods beyond the scope of this specification. /// </para> /// </summary> /// <param name="device">The logical device that will be importing <paramref name="fd"/>.</param> /// <param name="handleType">The type of the handle <paramref name="fd"/>.</param> /// <param name="fd">The handle which will be imported.</param> /// <returns>Properties of the handle <paramref name="fd"/>.</returns> /// <exception cref="VulkanException">Vulkan returns an error code.</exception> public static MemoryFdPropertiesKhx GetMemoryFdPropertiesKhx(this Device device, ExternalMemoryHandleTypesKhx handleType, int fd) { MemoryFdPropertiesKhx properties; Result result = vkGetMemoryFdPropertiesKHX(device)(device, handleType, fd, &properties); VulkanException.ThrowForInvalidResult(result); return(properties); }
/// <summary> /// Get properties of external memory Win32 handles. /// <para> /// Windows memory handles compatible with Vulkan may also be created by non-Vulkan APIs /// using methods beyond the scope of this specification. /// </para> /// </summary> /// <param name="device">The logical device that will be importing <paramref name="handle"/>.</param> /// <param name="handleType">The type of the handle <paramref name="handle"/>.</param> /// <param name="handle">the handle which will be imported.</param> /// <returns>Properties of <paramref name="handle"/>.</returns> /// <exception cref="VulkanException">Vulkan returns an error code.</exception> public static MemoryWin32HandlePropertiesKhx GetMemoryWin32HandlePropertiesKhx(this Device device, ExternalMemoryHandleTypesKhx handleType, IntPtr handle) { MemoryWin32HandlePropertiesKhx properties; Result result = vkGetMemoryWin32HandlePropertiesKHX(device, handleType, handle, &properties); VulkanException.ThrowForInvalidResult(result); return(properties); }