c++ - 如何将深度图像复制到彩色图像?
问题描述
我尝试将深度图像转换为较小的图像(目的是模糊图像)。
问题是当我执行vkCmdBlitImage
时VK_FILTER_LINEAR
,我有这个消息:If the format of srcImage is a depth, stencil, or depth stencil then filter must be VK_FILTER_NEAREST
。我想我首先需要将深度图像复制到彩色图像。
我试过vkCmdBlitImage
了,VK_FILTER_NEAREST
但我有这个错误:If one of srcImage and dstImage images has a format of depth, stencil or depth stencil, the other one must have exactly the same format
。
我有同样的问题vkCmdCopyImage
。
我的问题是:我可以在不创建管道的情况下将深度图像复制到彩色图像吗?
解决方案
您不能直接将深度数据复制到彩色图像中。您可以通过将深度数据复制到缓冲区vkCmdCopyImageToBuffer
,然后使用 将该数据复制到图像中vkCmdCopyBufferToImage
。