简体   繁体   English

关于 VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT 的困惑

[英]Confusion about VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT

When I read Vulkan Specs for VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT , it says:当我阅读VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT的 Vulkan Specs 时,它说:

VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT specifies the stage of the pipeline after blending .... This stage also includes subpass load and store operations,.... VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT 指定混合后管道的阶段....这个阶段还包括子通道加载和存储操作,....

I am really confused as why this stage can include subpass load and store operation.我真的很困惑为什么这个阶段可以包括子通道加载和存储操作。

From my understanding, in a subpass that performs drawing on a color attachment:据我了解,在对颜色附件执行绘图的子通道中:

  • Subpass load operation happens first in submission order.子通道加载操作按提交顺序首先发生。
  • Then , there is graphics pipeline ( vkCmdDraw ) submitted afterwards.然后,有随后提交的图形管道( vkCmdDraw )。 Among all those graphics pipeline stages, there is a final color output stage that is after color blending.在所有这些图形流水线阶段中,有一个颜色混合后的最终颜色输出阶段。 That stage is called VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT该阶段称为VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT
  • At the end, subpass store operation happens.最后,子通道存储操作发生。

Since those three are very distinct stages all with their own purposes, how come they can be all specified in one VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT .由于这三个是非常不同的阶段,都有自己的目的,为什么它们都可以在一个VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT中指定。

If put this stage in dstStageMask , is subpass load operation waiting for the srcStageMask or the color output stage of a graphics pipeline waiting for srcStageMask .如果将此阶段放在dstStageMask中,是等待srcStageMask的子通道加载操作还是等待srcStageMask的图形管道的颜色输出阶段。

Similarly, if I put this stage in srcStageMask , is Vulkan waiting for previous subpass to perform store operation instead of the color output stage in a graphics pipeline?同样,如果我将此阶段放在srcStageMask中,Vulkan 是否正在等待上一个子通道执行存储操作,而不是图形管道中的颜色输出阶段?

I am really confused as why this stage can include subpass load and store operation.我真的很困惑为什么这个阶段可以包括子通道加载和存储操作。

It "can" do so by fiat;它“可以”通过法令来做到这一点; it does so because the standard says that it does so.它这样做是因为标准说它这样做。

All of this stuff is an abstraction, a model of a conceptual GPU that doesn't necessarily exist in any particular hardware.所有这些东西都是抽象的,是概念 GPU 的模型,不一定存在于任何特定硬件中。 The job of a Vulkan implementation is to translate this abstraction for their particular hardware. Vulkan 实现的工作是为他们的特定硬件翻译这个抽象。

Subpass load/store operations may or may not be a distinct thing for any particular piece of hardware.对于任何特定的硬件,子通道加载/存储操作可能是也可能不是不同的事情。 Some hardware has them;有些硬件有它们; others do not.其他人没有。

If these processes are distinct for a particular GPU, and a user specifies a dependency through the color output stage, it is that implementation's job to include whatever is necessary to make that dependency work with both the usual color outputs and the subpass load/store hardware.如果这些过程对于特定的 GPU 是不同的,并且用户通过颜色输出阶段指定了依赖关系,那么实现的工作就是包含使该依赖关系与通常的颜色输出子通道加载/存储硬件一起工作所必需的任何内容. That is, if there's separate caching for both operations (somehow), the implementation has to handle both sets of caches.也就是说,如果两个操作都有单独的缓存(以某种方式),则实现必须处理两组缓存。

So the answer to this question:所以这个问题的答案:

If put this stage in dstStageMask , is subpass load operation waiting for the srcStageMask or the color output stage of a graphics pipeline waiting for srcStageMask .如果将此阶段放在dstStageMask中,是等待srcStageMask的子通道加载操作还是等待srcStageMask的图形管道的颜色输出阶段。

is both .两者都是 If these are two separate processes on a particular GPU, the implementation must make them appear as though they are the same process.如果它们是特定 GPU 上的两个独立进程,则实现必须使它们看起来好像它们是同一个进程。

That being said, attachment load only happens before the first subpass that uses the attachment, and attachment store only happens after the last subpass that uses the attachment.也就是说,附件加载仅发生在使用附件的第一个子通道之前,而附件存储仅发生在使用附件的最后一个子通道之后。 So its not like this is a big deal that impacts every dependency.因此,这并不是影响每个依赖项的大问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT VkAccessFlags 设置为 0? - VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT VkAccessFlags set to 0? 单独使用VK_ACCESS_COLOR_ATTACHMENT_READ_BIT - Practical use of VK_ACCESS_COLOR_ATTACHMENT_READ_BIT alone LunarG教程中VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT的使用 - Use of VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT in LunarG's Tutorial 为什么有 VK_PIPELINE_STAGE_2_INDEX_INPUT_BIT 我必须使用它吗? - Why is there a VK_PIPELINE_STAGE_2_INDEX_INPUT_BIT and do I have to use it? 当设备未启用geometryShader功能时,vkQueueSubmit()调用包含一个具有VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT位置1的stageMask - vkQueueSubmit() call includes a stageMask with VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT bit set when device does not have geometryShader feature enabled VK_IMAGE_LAYOUT_UNDEFINED与VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL作为帧缓冲区附件的初始布局 - VK_IMAGE_LAYOUT_UNDEFINED vs VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL as initial layout for Framebuffer attachment VK_DEPENDENCY_BY_REGION_BIT的含义和含义 - The meaning and implications of VK_DEPENDENCY_BY_REGION_BIT WSI 同步子通道依赖和链接到颜色附件 output - WSI synchronization subpass dependency and link to color attachment output 在同一个子通道中将图像用作输入附件和颜色输出附件是否合法? - Is it legal to use an image both as an input attachment and a color output attachment in the same subpass? 为什么 VK_SAMPLE_COUNT_1_BIT 是 Vulkan 中多重采样的无效选择? - Why is VK_SAMPLE_COUNT_1_BIT an invalid choice for multisampling in Vulkan?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM