这种对 Vulkan 子通道图像布局的理解是否正确?
Is this understanding of the Vulkan sub-pass image layouts correct?
当我们在为渲染通道创建子通道时提供附件引用时,我们会执行如下操作:
VkAttachmentReference {.attachment = 1, .layout = VkImageLayout::VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL};
图像布局常量告诉 Vulkan 在子通道结束后将图像转换到什么布局。所以它是这样的:
BEGIN_RENDER_PASS: (EXPECTS THE LAYOUT TO BE THAT SPECIFIED IN THE ATTACHMENT DESCRIPTION)
FIRST SUB-PASS ( EXPECTS THE INITIAL LAYOUT SPECIFIED IN THE ATTACHMENT DESCRIPTION)
FIRST SUB-PASS ENDS (TRANSITIONS THE IMAGE TO THAT SPECIFIED IN THE ATTACHMENT REFERENCE LAYOUT
SECOND SUB-PASS ( EXPECTS THE LAYOUT OF THE IMAGE AS THE ONE SPECIFIED IN THE LAST SUB-PASS ATTACHMENT REFERENCE, AND WHEN SUB-PASS IS FINISHED TRANSITIONS THE IMAGE LAYOUT TO THAT SPECIFIED IN LAYOUT OF ATTACHMENT REFERENCE)
END_RENDER_PASS (TRANSITIONS THE IMAGE TO THE FINAL LAYOUT. IT KNOWS WHAT LAYOUT IT'S ALREADY IN BASED ON THE THE ATTACHMENT REFERENCE LAYOUT OF THE LAST SUB-PASS)
The image layout constant tells Vulkan what layout to transition the image to after the sub-pass ends.
没有。附件参考布局告诉 Vulkan 在定义此参考的子通道的 beginning 将图像转换到什么布局。或者更重要的是,它是图像在子通道持续时间内所处的布局。
渲染通道的附加图像的第一个过渡将从渲染通道的 initialLayout
到使用该图像的第一个子通道的参考布局。附加图像的最后一个过渡将从使用附件的最终子通道的参考布局到渲染通道的 finalLayout
。
当我们在为渲染通道创建子通道时提供附件引用时,我们会执行如下操作:
VkAttachmentReference {.attachment = 1, .layout = VkImageLayout::VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL};
图像布局常量告诉 Vulkan 在子通道结束后将图像转换到什么布局。所以它是这样的:
BEGIN_RENDER_PASS: (EXPECTS THE LAYOUT TO BE THAT SPECIFIED IN THE ATTACHMENT DESCRIPTION)
FIRST SUB-PASS ( EXPECTS THE INITIAL LAYOUT SPECIFIED IN THE ATTACHMENT DESCRIPTION)
FIRST SUB-PASS ENDS (TRANSITIONS THE IMAGE TO THAT SPECIFIED IN THE ATTACHMENT REFERENCE LAYOUT
SECOND SUB-PASS ( EXPECTS THE LAYOUT OF THE IMAGE AS THE ONE SPECIFIED IN THE LAST SUB-PASS ATTACHMENT REFERENCE, AND WHEN SUB-PASS IS FINISHED TRANSITIONS THE IMAGE LAYOUT TO THAT SPECIFIED IN LAYOUT OF ATTACHMENT REFERENCE)
END_RENDER_PASS (TRANSITIONS THE IMAGE TO THE FINAL LAYOUT. IT KNOWS WHAT LAYOUT IT'S ALREADY IN BASED ON THE THE ATTACHMENT REFERENCE LAYOUT OF THE LAST SUB-PASS)
The image layout constant tells Vulkan what layout to transition the image to after the sub-pass ends.
没有。附件参考布局告诉 Vulkan 在定义此参考的子通道的 beginning 将图像转换到什么布局。或者更重要的是,它是图像在子通道持续时间内所处的布局。
渲染通道的附加图像的第一个过渡将从渲染通道的 initialLayout
到使用该图像的第一个子通道的参考布局。附加图像的最后一个过渡将从使用附件的最终子通道的参考布局到渲染通道的 finalLayout
。