Ejemplo n.º 1
0
        /// <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 GetFdKhr(this DeviceMemory memory, ExternalMemoryHandleTypesKhr handleType)
        {
            int    fd;
            Result result = vkGetMemoryFdKHR(memory)(memory.Parent, memory, handleType, &fd);

            VulkanException.ThrowForInvalidResult(result);
            return(fd);
        }
Ejemplo n.º 2
0
        /// <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 GetWin32HandleKhr(this DeviceMemory memory, ExternalMemoryHandleTypesKhr handleType)
        {
            IntPtr handle;
            Result result = vkGetMemoryWin32HandleKHR(memory)(memory.Parent, memory, handleType, &handle);

            VulkanException.ThrowForInvalidResult(result);
            return(handle);
        }
Ejemplo n.º 3
0
        /// <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 MemoryFdPropertiesKhr GetMemoryFdPropertiesKhr(this Device device,
                                                                     ExternalMemoryHandleTypesKhr handleType, int fd)
        {
            MemoryFdPropertiesKhr properties;
            Result result = vkGetMemoryFdPropertiesKHR(device)(device, handleType, fd, &properties);

            VulkanException.ThrowForInvalidResult(result);
            return(properties);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Get properties of external memory host pointer.
        /// </summary>
        /// <param name="device">The logical device that will be importing <paramref name="hostPointer"/>.</param>
        /// <param name="handleType">The type of the handle <paramref name="hostPointer"/>.</param>
        /// <param name="hostPointer">The host pointer to import from.</param>
        /// <returns>Properties of external memory host pointer.</returns>
        /// <exception cref="VulkanException">Vulkan returns an error code.</exception>
        public static MemoryHostPointerPropertiesExt GetMemoryHostPointerPropertiesExt(this Device device,
                                                                                       ExternalMemoryHandleTypesKhr handleType, IntPtr hostPointer)
        {
            MemoryHostPointerPropertiesExt properties;
            Result result = vkGetMemoryHostPointerPropertiesEXT(device)(device, handleType, hostPointer, &properties);

            VulkanException.ThrowForInvalidResult(result);
            return(properties);
        }