简体   繁体   English

为什么有 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?

According to the docs at Khronos.org the PIPELINE_STAGE_VERTEX_INPUT_BIT is:根据 Khronos.org 上的文档,PIPELINE_STAGE_VERTEX_INPUT_BIT 是:

VK_PIPELINE_STAGE_VERTEX_INPUT_BIT specifies the stage of the pipeline where vertex and index buffers are consumed

So that flag covers both vertex input and index input.因此该标志涵盖了顶点输入和索引输入。 However I've seen a:但是我见过一个:

VK_PIPELINE_STAGE_2_INDEX_INPUT_BIT

in my Vulkan header.在我的 Vulkan 标题中。 Have they now been separated into two separate flags?它们现在是否被分成两个独立的标志? And do I have to use them to flush of invalidate caches with respect to indices?我是否必须使用它们来刷新与索引相关的无效缓存?

VK_PIPELINE_STAGE_VERTEX_INPUT_BIT is part of VkPipelineStageFlagBits . VK_PIPELINE_STAGE_VERTEX_INPUT_BITVkPipelineStageFlagBits的一部分。 It covers both vertex and index buffers.它涵盖了顶点缓冲区和索引缓冲区。

VK_PIPELINE_STAGE_2_INDEX_INPUT_BIT is part of VkPipelineStageFlagBits2 . VK_PIPELINE_STAGE_2_INDEX_INPUT_BITVkPipelineStageFlagBits2的一部分。 It covers only index buffers.它仅涵盖索引缓冲区。

Have they now been separated into two separate flags?它们现在是否被分成两个独立的标志?

在此处输入图像描述

There are two flags in the new structure, one for index and one for vertex.新结构中两个标志,一个用于索引,一个用于顶点。 They are, respectively它们分别是

  • VK_PIPELINE_STAGE_2_VERTEX_ATTRIBUTE_INPUT_BIT for vertex buffers only VK_PIPELINE_STAGE_2_VERTEX_ATTRIBUTE_INPUT_BIT仅用于顶点缓冲区
  • VK_PIPELINE_STAGE_2_INDEX_INPUT_BIT for index buffers only VK_PIPELINE_STAGE_2_INDEX_INPUT_BIT仅用于索引缓冲区

However, there is also a VK_PIPELINE_STAGE_2_VERTEX_INPUT_BIT definition which is their bitwise or, so it acts just like VK_PIPELINE_STAGE_VERTEX_INPUT_BIT in the older versions of the barrier functions.但是,还有一个VK_PIPELINE_STAGE_2_VERTEX_INPUT_BIT定义,它是它们的按位或,所以它的作用就像旧版本的屏障函数中的VK_PIPELINE_STAGE_VERTEX_INPUT_BIT一样。

do I have to use them to flush of invalidate caches with respect to indices?我是否必须使用它们来刷新与索引相关的无效缓存?

It depends on what function you're calling.这取决于您要调用的函数。 If you're calling vkCmdPipelineBarrier , you don't need to think about any of this, because it still uses VkPipelineStageFlagBits .如果您正在调用vkCmdPipelineBarrier ,则无需考虑任何这些,因为它仍然使用VkPipelineStageFlagBits

If you're calling vkCmdPipelineBarrier2 then you need to use the newer VkPipelineStageFlagBits2 .如果您正在调用vkCmdPipelineBarrier2 ,那么您需要使用更新的VkPipelineStageFlagBits2 But if you don't care about the distinction between the index and vertex buffers in the pipeline, then you could just swap out VK_PIPELINE_STAGE_VERTEX_INPUT_BIT with VK_PIPELINE_STAGE_2_VERTEX_INPUT_BIT directly and everything should work the same as before, because VK_PIPELINE_STAGE_2_VERTEX_INPUT_BIT intentionally covers both vertex and index buffers.但是,如果您不关心管道中索引缓冲区和顶点缓冲区之间的区别,那么您可以直接将VK_PIPELINE_STAGE_VERTEX_INPUT_BITVK_PIPELINE_STAGE_2_VERTEX_INPUT_BIT并且一切都应该像以前一样工作,因为VK_PIPELINE_STAGE_2_VERTEX_INPUT_BIT有意覆盖了顶点缓冲区和索引缓冲区。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM