Example #1
0
        public unsafe void BlitImage(
            VkImage source,
            VkFormat sourceFormat,
            VkImageLayout sourceLayout,
            int sourceX, int sourceY,
            int sourceWidth, int sourceHeight,
            uint sourceMipLevel,
            VkImage destination,
            VkFormat destinationFormat,
            VkImageLayout destinationLayout,
            int destinationX, int destinationY,
            int destinationWidth, int destinationHeight,
            uint destinationMipLevel
            )
        {
            var regionInfo = new VkImageBlit
            {
                srcOffsets_0 = new VkOffset3D
                {
                    x = sourceX,
                    y = sourceY,
                    z = 0
                },
                srcOffsets_1 = new VkOffset3D
                {
                    x = sourceWidth,
                    y = sourceHeight,
                    z = 1
                },
                srcSubresource = new VkImageSubresourceLayers
                {
                    aspectMask = GetAspectFlags(
                        source,
                        sourceFormat,
                        sourceLayout
                        ),
                    mipLevel       = sourceMipLevel,
                    baseArrayLayer = 0,
                    layerCount     = 1
                },
                dstOffsets_0 = new VkOffset3D
                {
                    x = destinationX,
                    y = destinationY,
                    z = 0
                },
                dstOffsets_1 = new VkOffset3D
                {
                    x = destinationWidth,
                    y = destinationHeight,
                    z = 1
                },
                dstSubresource = new VkImageSubresourceLayers
                {
                    aspectMask = GetAspectFlags(
                        destination,
                        destinationFormat,
                        destinationLayout
                        ),
                    mipLevel       = destinationMipLevel,
                    baseArrayLayer = 0,
                    layerCount     = 1
                }
            };

            VulkanNative.vkCmdBlitImage(
                _handle,
                source,
                sourceLayout,
                destination,
                destinationLayout,
                1,
                &regionInfo,
                VkFilter.Linear
                );
        }