这种对 VkDescriptorPoolCreateInfo.pPoolSizes 的理解是否正确? [英] Is this understanding of VkDescriptorPoolCreateInfo.pPoolSizes correct?

查看:40
本文介绍了这种对 VkDescriptorPoolCreateInfo.pPoolSizes 的理解是否正确?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Vulkan 中,我知道描述符池用于分配一些布局的描述符集以在着色器中使用,但是在传递给 vkCreateDescriptorPoolVkDescriptorPoolCreateInfo 中,有是一个字段 pPoolSizes,它接受一堆包含描述符类型和数字的对象.

In Vulkan, I understand that a descriptor pool is used to allocate descriptor sets of some layout for use in a shader, but in the VkDescriptorPoolCreateInfo passed to vkCreateDescriptorPool, there is a field pPoolSizes that takes a bunch of objects containing a descriptor type and a number.

文档似乎有些含糊不清,但这是否是说给定的描述符池只能在描述符集中从它分配的每种类型的描述符中分配一定数量的预定数量?如果是这样,我如何事先确定我需要多少?如果用完会怎样?

The documentation seems somewhat vague, but is this saying that a given descriptor pool can only have a certain, predetermined amount of each type of descriptor allocated from it in descriptor sets? If so, how do I determine how many I will need beforehand? What happens if it runs out?

推荐答案

您对描述符池的理解是正确的.

Your understanding of descriptor pools is correct.

如果是这样,我如何事先确定我需要多少?

If so, how do I determine how many I will need beforehand?

这取决于您和您的应用程序的需求.

That's up to you and your application's needs.

如果您的应用程序需要完全灵活和自由,那么您需要根据需要动态创建描述符池.如果您的应用程序对场景的外观有更深入的了解,那么您的应用程序将需要较少的此类操作.

If your application needs to be completely flexible and freeform, then you will need to create descriptor pools dynamically as needed. If your application has greater foreknowledge of what the scene will look like, then your application will need fewer of such gymnastics.

许多严肃的 Vulkan 应用程序试图避免基于场景中对象的数量来设置描述符集的数量.推送常量和/或动态 UBO/SSBO 描述符允许使用不同的每个对象状态,而无需更改描述符本身.许多对象的纹理可以捆绑在一起形成阵列纹理,或者根据硬件,纹理阵列.

Many serious Vulkan applications try to avoid having the number of descriptor sets be based on the number of objects in the scene. Push constants and/or dynamic UBO/SSBO descriptors allow different per-object state to be used without changing the descriptor itself. Textures for lots of objects can be bundled together into array textures, or depending on the hardware, arrays of textures.

在一个完美的世界中,可以使用完全相同的描述符集渲染一种类型的所有网格(例如蒙皮网格),使用一些每个对象的状态来获取正确的矩阵/纹理数据对于那个对象.

In a perfect world, all meshes of a type (say, skinned meshes) could be rendered with the exact same descriptor set, using some per-object state to fetch the right matrix/texture data for that object.

但这就是他们渲染的方式.此类应用程序可以严格控制它们渲染的对象种类、每个对象的数据是什么样的,等等.其他应用程序可能有不同的需求.

But that's how they render. Such applications have firm control over the kinds of objects they render, what per-object data looks like, and so forth. Other applications may have different needs.

Vulkan 是一个工具;您如何使用它完全取决于您.

Vulkan is a tool; how you use it is entirely up to you.

如果用完会怎样?

然后你不能从那个池中分配更多的描述符.如果您需要分配另一个描述符集,则需要创建另一个池.

Then you cannot allocate more descriptors from that pool. If you need to allocate another descriptor set, you will need to create another pool.

这篇关于这种对 VkDescriptorPoolCreateInfo.pPoolSizes 的理解是否正确?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆