本文整理汇总了C++中VkLayerDispatchTable::CmdBlitImage方法的典型用法代码示例。如果您正苦于以下问题:C++ VkLayerDispatchTable::CmdBlitImage方法的具体用法?C++ VkLayerDispatchTable::CmdBlitImage怎么用?C++ VkLayerDispatchTable::CmdBlitImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VkLayerDispatchTable
的用法示例。
在下文中一共展示了VkLayerDispatchTable::CmdBlitImage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writePPM
//.........这里部分代码省略.........
// destination.
pTableCommandBuffer->CmdPipelineBarrier(data.commandBuffer, srcStages,
dstStages, 0, 0, NULL, 0, NULL, 1,
&destMemoryBarrier);
const VkImageCopy imageCopyRegion = {{VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1},
{0, 0, 0},
{VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1},
{0, 0, 0},
{width, height, 1}};
if (copyOnly) {
pTableCommandBuffer->CmdCopyImage(
data.commandBuffer, image1, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
data.image2, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1,
&imageCopyRegion);
} else {
VkImageBlit imageBlitRegion = {};
imageBlitRegion.srcSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
imageBlitRegion.srcSubresource.baseArrayLayer = 0;
imageBlitRegion.srcSubresource.layerCount = 1;
imageBlitRegion.srcSubresource.mipLevel = 0;
imageBlitRegion.srcOffsets[1].x = width;
imageBlitRegion.srcOffsets[1].y = height;
imageBlitRegion.srcOffsets[1].z = 1;
imageBlitRegion.dstSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
imageBlitRegion.dstSubresource.baseArrayLayer = 0;
imageBlitRegion.dstSubresource.layerCount = 1;
imageBlitRegion.dstSubresource.mipLevel = 0;
imageBlitRegion.dstOffsets[1].x = width;
imageBlitRegion.dstOffsets[1].y = height;
imageBlitRegion.dstOffsets[1].z = 1;
pTableCommandBuffer->CmdBlitImage(
data.commandBuffer, image1, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
data.image2, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1,
&imageBlitRegion, VK_FILTER_NEAREST);
if (need2steps) {
// image 3 needs to be transitioned from its undefined state to a
// transfer destination.
destMemoryBarrier.image = data.image3;
pTableCommandBuffer->CmdPipelineBarrier(
data.commandBuffer, srcStages, dstStages, 0, 0, NULL, 0, NULL,
1, &destMemoryBarrier);
// Transition image2 so that it can be read for the upcoming copy to
// image 3.
destMemoryBarrier.oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
destMemoryBarrier.newLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL;
destMemoryBarrier.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
destMemoryBarrier.dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT;
destMemoryBarrier.image = data.image2;
pTableCommandBuffer->CmdPipelineBarrier(
data.commandBuffer, srcStages, dstStages, 0, 0, NULL, 0, NULL,
1, &destMemoryBarrier);
// This step essentially untiles the image.
pTableCommandBuffer->CmdCopyImage(
data.commandBuffer, data.image2,
VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, data.image3,
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &imageCopyRegion);
generalMemoryBarrier.image = data.image3;
}
}
// The destination needs to be transitioned from the optimal copy format to