/// <summary>
 /// Initializes a new instance of the <see cref="ImportMemoryWin32HandleInfoNV"/> structure.
 /// </summary>
 /// <param name="handle">A Windows <c>HANDLE</c> referring to the memory.</param>
 /// <param name="handleType">
 /// Is <c>0</c> or a <see cref="ExternalMemoryHandleTypesNV"/> value specifying the type of
 /// memory handle in handle.
 /// </param>
 /// <param name="next">
 /// Is <see cref="IntPtr.Zero"/> or a pointer to an extension-specific structure.
 /// </param>
 public ImportMemoryWin32HandleInfoNV(IntPtr handle, ExternalMemoryHandleTypesNV handleType = 0,
                                      IntPtr next = default(IntPtr))
 {
     Type       = StructureType.ImportMemoryWin32HandleInfoNV;
     Next       = next;
     HandleType = handleType;
     Handle     = handle;
 }
        /// <summary>
        /// Retrieve Win32 handle to a device memory object.
        /// </summary>
        /// <param name="deviceMemory">Opaque handle to a device memory object.</param>
        /// <param name="handleType">
        /// A bitmask containing a single bit specifying the type of handle requested.
        /// </param>
        /// <returns>A Windows HANDLE.</returns>
        /// <exception cref="VulkanException">Vulkan returns an error code.</exception>
        public static IntPtr GetWin32HandleNV(this DeviceMemory deviceMemory,
                                              ExternalMemoryHandleTypesNV handleType)
        {
            IntPtr handle;
            Result result = vkGetMemoryWin32HandleNV(deviceMemory.Parent, deviceMemory, handleType, &handle);

            VulkanException.ThrowForInvalidResult(result);
            return(handle);
        }
Beispiel #3
0
        /// <summary>
        /// Determine image capabilities compatible with external memory handle types.
        /// </summary>
        /// <param name="physicalDevice">The physical device from which to query the image capabilities.</param>
        /// <param name="format">The image format, corresponding to <see cref="ImageCreateInfo.Format"/>.</param>
        /// <param name="type">The image type, corresponding to <see cref="ImageCreateInfo.ImageType"/>.</param>
        /// <param name="tiling">The image tiling, corresponding to <see cref="ImageCreateInfo.Tiling"/>.</param>
        /// <param name="usage">The intended usage of the image, corresponding to <see cref="ImageCreateInfo.Usage"/>.</param>
        /// <param name="flags">
        /// A bitmask describing additional parameters of the image, corresponding to <see cref="ImageCreateInfo.Flags"/>.
        /// </param>
        /// <param name="externalHandleType">
        /// Either one of the bits from <see cref="ExternalMemoryHandleTypesNV"/>, or 0.
        /// </param>
        /// <returns>The structure in which capabilities are returned.</returns>
        /// <exception cref="VulkanException">Vulkan returns an error code.</exception>
        public static ExternalImageFormatPropertiesNV GetExternalImageFormatPropertiesNV(this PhysicalDevice physicalDevice,
                                                                                         Format format, ImageType type, ImageTiling tiling, ImageUsages usage, ImageCreateFlags flags,
                                                                                         ExternalMemoryHandleTypesNV externalHandleType)
        {
            ExternalImageFormatPropertiesNV properties;
            Result result = vkGetPhysicalDeviceExternalImageFormatPropertiesNV(physicalDevice, format, type, tiling, usage, flags,
                                                                               externalHandleType, &properties);

            VulkanException.ThrowForInvalidResult(result);
            return(properties);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ExportMemoryAllocateInfoNV"/> structure.
 /// </summary>
 /// <param name="handleTypes">
 /// Specifies one or more memory handle types that may be exported.
 /// <para>
 /// Multiple handle types may be requested for the same allocation as long as they are
 /// compatible, as reported by <see cref="PhysicalDeviceExtensions.GetExternalImageFormatPropertiesNV"/>.
 /// </para>
 /// </param>
 /// <param name="next">
 /// Is <see cref="IntPtr.Zero"/> or a pointer to an extension-specific structure.
 /// </param>
 public ExportMemoryAllocateInfoNV(ExternalMemoryHandleTypesNV handleTypes, IntPtr next = default(IntPtr))
 {
     Type        = StructureType.ExportMemoryAllocateInfoNV;
     Next        = next;
     HandleTypes = handleTypes;
 }