public void CmdCopyBufferToImage(IMgBuffer srcBuffer, IMgImage dstImage, MgImageLayout dstImageLayout, MgBufferImageCopy[] pRegions) { var bSrcBuffer = (VkBuffer)srcBuffer; Debug.Assert(bSrcBuffer != null); var bDstImage = (VkImage)dstImage; Debug.Assert(bDstImage != null); var handle = GCHandle.Alloc(pRegions, GCHandleType.Pinned); try { unsafe { var regionCount = (uint)pRegions.Length; var region = handle.AddrOfPinnedObject(); var regions = (MgBufferImageCopy *)region.ToPointer(); Interops.vkCmdCopyBufferToImage(this.Handle, bSrcBuffer.Handle, bDstImage.Handle, dstImageLayout, regionCount, regions); } } finally { handle.Free(); } }