Using descriptor indexing and arrays of textures in Vulkan
Before we can use the material system described earlier in this chapter on the GPU, as discussed in the recipe Implementing a material system, let’s first explore some Vulkan functionality that is essential for conveniently handling numerous materials with multiple textures on the GPU. Descriptor indexing is a highly useful feature that became mandatory in Vulkan 1.3 and is now widely supported on both desktop and mobile devices. We briefly discussed this in Chapter 3, in the recipe Using Vulkan descriptor indexing, where we explored how LightweightVK manages descriptor sets. Descriptor indexing allows for the creation of unbounded descriptor sets and the use of non-uniform dynamic indexing to access textures within them. This enables materials to be stored in shader storage buffers, with each one referencing the necessary textures using integer IDs. These IDs can be retrieved from buffers and used directly to index...