Descriptor/Set Confusion

I come from a C#/XNA background, so I have never used OpenGL, and have only worked with DirectX indirectly via the XNA wrapper (and only up to version 9.0).

I’ve just started to learn Vulkan (with C). I’ve got a basic program working quite well (no validation errors), but there is one concept I’m struggling with and can’t find a comprehensive answer for online.

I can’t properly understand the difference between a Descriptor and a DescriptorSet. This is causing me problems when trying to work out what DescriptorSets I need.

Descriptor is a thing that stores metadata necessary to interface\bind one of our Vulkan Resource (VkBuffer or VkImage) into one of a Spir-V shader resource (Texture, Storage Image, Storage Buffer, Uniform, etc.).

Descriptor Set is just multiple Descriptors (i.e. a set).

Best look at VkDescriptorSetLayoutCreateInfo. (Descriptor Set Layout describes most of the Desriptor Set, minus the references to actual real VkBuffers or VkImages, which would be provided later.)

It has array of bindings, where each has array of (homogenous) Descriptors. So there would be 1:1 relationship between Descriptors, and your in-shader type. E.g. each of your sampler2D variables in shader would have its own descriptor that tells it which Resource on the C++ side it should use and how to use it.

You must specify in shader which Descriptor your variable refers to.
E.g. if you had something like layout (binding = 3, set = 2) uniform sampler2D s[5]; then the sampler s[4] would use Descriptor 4 (i.e. 5th) of binding 3 of Descriptor Set 2.

Thanks krOoze, this helps. It’s starting to make more sense.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.