在命令缓冲区中,绘制调用是否按顺序执行?

huangapple go评论67阅读模式
英文:

Are draw calls sequenced in command buffers?

问题

假设我有两个 VkPipelines,并在一个 VkCommandBuffer 中记录...

vkCmdBeginRenderPass(cmd,/*...*/);
vkCmdBindPipeline(cmd,VK_PIPELINE_BIND_POINT_GRAPHICS,pipeline1);
vkCmdDraw(cmd,/*...*/); // [1]
vkCmdBindPipeline(cmd,VK_PIPELINE_BIND_POINT_GRAPHICS,pipeline2);
vkCmdDraw(cmd,/*...*/); // [2]
vkCmdEndRenderPass(cmd);

当命令缓冲区排队并执行时,渲染操作在 [2] 开始执行之前,会像在 1 的帧缓冲附件上完全实现吗?

即 [2] 会覆盖 1 吗?

英文:

Suppose I have two VkPipelines and within a VkCommandBuffer I record...

vkCmdBeginRenderPass(cmd, /*...*/);
vkCmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline1);
vkCmdDraw(cmd, /*...*/); // [1]
vkCmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline2);
vkCmdDraw(cmd, /*...*/); // [2]
vkCmdEndRenderPass(cmd);

When the command buffer is queued and executed, will it be as-if the rendering operations to the framebuffer attachments of 1 are fully realized before [2] starts executing.

ie Will [2] draw over 1 ?

答案1

得分: 2

大多数Vulkan中的阶段相对于彼此以任意顺序执行。然而,光栅化顺序在子通道内与帧缓冲附件处理相关时会受到尊重(在子通道之间,您必须使用子通道依赖关系,在渲染通道之外,您将需要使用外部子通道依赖关系或屏障)。每个图元都相对于其他图元排序,实现必须在重新排序时尊重光栅化顺序。

按光栅化顺序自动执行的阶段包括深度/模板测试、混合、写掩码等,但不包括片段着色器本身。也就是说,片段着色器的输出必须经过光栅化顺序,但片段着色器的副作用(即通过图像存储或SSBO进行的写操作)则不受此限制。

英文:

Most stages in Vulkan execute in an arbitrary order relative to each other. However, rasterization order is respected with regard to framebuffer attachment processes within a subpass (between subpasses, you have to use subpass dependencies, and outside of the renderpass, you'll need either external subpass dependencies or a barrier). Each primitive is ordered relative to each other primitive, and the implementation must respect rasterization order when doing reordering.

The stages that follow rasterization order atomically include depth/stencil test, blending, write masking, and the like, but they do not include the fragment shader itself. That is, FS outputs have to go through rasterization order, but FS side effects (ie: writes via image store or SSBOs) do not.

答案2

得分: 2

关于单个子通道中原始绘制的规则已在24.2. 光栅化顺序中定义。根据这些规则,第二个原始绘制的混合操作和颜色写入应严格发生在第一个原始绘制的混合操作和颜色写入之后。

英文:

There's a set of rules defined in 24.2. Rasterization Order regarding primitive drawing in a single subpass. According to these rules, blending operations and color writes of the second primitive should happen strictly after blending operations and color writes of the first primitive.

huangapple
  • 本文由 发表于 2020年1月6日 14:46:30
  • 转载请务必保留本文链接:https://go.coder-hub.com/59607788.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定