何时消耗 vkCmd* 函数的参数?

编程入门 行业动态 更新时间:2024-10-27 21:19:10
本文介绍了何时消耗 vkCmd* 函数的参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

某些 vkCmd* 函数指定何时使用某些参数.例如,在vkCmdBindDescriptorSets的文档中:

Some of the vkCmd* functions specify when some parameters are consumed or not. For example, in the documentation of vkCmdBindDescriptorSets:

pDynamicOffsets 的内容在执行期间立即被消耗执行 vkCmdBindDescriptorSets.

The contents of pDynamicOffsets are consumed immediately during execution of vkCmdBindDescriptorSets.

但是他们中的大多数都没有澄清.vkCmd* 调用期间是否消耗了所有参数?例如,在以下代码中:

However most of them do not clarify. Are all parameters consumed during the the vkCmd* call? For example, in the following code:

void copyHelper() {
  VkBufferCopy copy_region = {...};
  vkCmdCopyBuffer(cmd_buffer, from_buffer, to_buffer, 1, &copy_region);
}

调用 copyHelper() 后,虽然 cmd_buffer 尚未提交,但 copy_region 不再在范围内.我是否需要将 copy_region 存储在某处以使其保持有效?还是在调用 vkCmdCopyBuffer 时立即消耗?其余的 vkCmd* 函数呢?

after calling copyHelper(), copy_region is not in scope anymore although cmd_buffer hasn't been submitted yet. Do I need to store copy_region somewhere so that it stays valid? Or is it immediately consumed when calling vkCmdCopyBuffer? What about the rest of the vkCmd* functions?

谢谢.

推荐答案

没有每个命令的说明,因为所有命令都在以下总括语句下运行:

There is no per-command clarification, because all commands operate under the following blanket statement:

应用程序拥有的内存的所有权会立即被传入的任何 Vulkan 命令获取.此类内存的所有权必须在命令持续时间结束时释放回应用程序,以便应用程序可以更改或释放此内存.获取它的命令已经返回.

The ownership of application-owned memory is immediately acquired by any Vulkan command it is passed into. Ownership of such memory must be released back to the application at the end of the duration of the command, so that the application can alter or free this memory as soon as all the commands that acquired it have returned.

强调规范.必须使用您在函数返回时传递的任何内存的内容来完成实现.无论是未格式化的内存,如 void* 还是数据结构.

Emphasis in the specification. The implementation has to be finished using the contents of any memory you pass by the time the function returns. Whether unformatted memory like a void* or data structures.

请注意,持续时间"定义为:

Note that "duration" is defined as:

Vulkan 命令的持续时间是指从调用命令到返回给调用者的时间间隔.

The duration of a Vulkan command refers to the interval between calling the command and its return to the caller.

这篇关于何时消耗 vkCmd* 函数的参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-26 22:26:53,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1142821.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:函数   消耗   参数   vkCmd

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!