/// <summary> /// Bind device memory to an image object. /// </summary> public unsafe void BindMemory(SharpVk.DeviceMemory memory, DeviceSize memoryOffset) { try { Result methodResult = Interop.Commands.vkBindImageMemory(this.parent.handle, this.handle, memory?.handle ?? default(SharpVk.Interop.DeviceMemory), memoryOffset); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// Bind device memory to a buffer object. /// </summary> /// <param name="memory"> /// </param> /// <param name="memoryOffset"> /// </param> public unsafe void BindMemory(SharpVk.DeviceMemory memory, ulong memoryOffset) { try { SharpVk.Interop.VkBufferBindMemoryDelegate commandDelegate = commandCache.Cache.vkBindBufferMemory; Result methodResult = commandDelegate(this.parent.handle, this.handle, memory?.handle ?? default(SharpVk.Interop.DeviceMemory), memoryOffset); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// Bind device memory to an image object. /// </summary> public unsafe void BindMemory(SharpVk.DeviceMemory memory, DeviceSize memoryOffset) { try { SharpVk.Interop.VkImageBindMemoryDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.VkImageBindMemoryDelegate>("vkBindImageMemory", ""); Result methodResult = commandDelegate(this.parent.handle, this.handle, memory?.handle ?? default(SharpVk.Interop.DeviceMemory), memoryOffset); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } } finally { Interop.HeapUtil.FreeAll(); } }
/// <summary> /// Retrieve Win32 handle to a device memory object. /// </summary> /// <param name="extendedHandle"> /// The DeviceMemory handle to extend. /// </param> public static unsafe IntPtr GetWin32Handle(this SharpVk.DeviceMemory extendedHandle, SharpVk.NVidia.ExternalMemoryHandleTypeFlags handleType) { try { IntPtr result = default(IntPtr); CommandCache commandCache = default(CommandCache); IntPtr marshalledHandle = default(IntPtr); commandCache = extendedHandle.commandCache; SharpVk.Interop.NVidia.VkDeviceMemoryGetWin32HandleDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.NVidia.VkDeviceMemoryGetWin32HandleDelegate>("vkGetMemoryWin32HandleNV", "instance"); Result methodResult = commandDelegate(extendedHandle.parent.handle, extendedHandle.handle, handleType, &marshalledHandle); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } result = marshalledHandle; return(result); } finally { Interop.HeapUtil.FreeAll(); } }