Using Vulkan descriptor indexing
Descriptor indexing became part of the Vulkan core in version 1.2 as an optional feature, and it was made mandatory in Vulkan 1.3. This feature allows applications to place all their resources into one large descriptor set and make it available to all shaders. There’s no need to manage descriptor pools or construct per-shader descriptor sets. Everything is accessible to shaders at once. Shaders can access all resources in the system, and the only practical limit is performance. Let’s learn how to work with descriptor sets and descriptor indexing in Vulkan by exploring the LightweightVK framework.
How to do it...
Let’s examine the parts of the VulkanContext class that manage descriptors, as declared in lvk/vulkan/VulkanClasses.h. Integer variables currentMaxTextures_ and currentMaxSamplers_ define the maximum number of resources that can be stored in the descriptor set, referred to as vkDSet_. This descriptor set is allocated...