Beispiel #1
0
        public unsafe void CopyBufferToImage(
            Buffer buffer,
            Image image,
            uint mipLevel = 0
            )
        {
            var region = new VkBufferImageCopy
            {
                bufferOffset      = 0,
                bufferRowLength   = image.Width,
                bufferImageHeight = image.Height,
                imageOffset       = new VkOffset3D
                {
                    x = 0,
                    y = 0,
                    z = 0
                },
                imageExtent = new VkExtent3D
                {
                    width  = image.Width,
                    height = image.Height,
                    depth  = 1
                },
                imageSubresource = new VkImageSubresourceLayers
                {
                    aspectMask = GetAspectFlags(
                        image.Handle,
                        image.Format,
                        image.Layout[mipLevel]
                        ),
                    mipLevel       = mipLevel,
                    baseArrayLayer = 0,
                    layerCount     = 1
                }
            };

            VulkanNative.vkCmdCopyBufferToImage(
                _handle,
                buffer.Handle,
                image.Handle,
                image.Layout[mipLevel],
                1,
                &region
                );
        }