How do I use descriptors with "shader objects"?

I asked this on StackOverflow and so far there’s no response. Thought this might be a more suitable place to ask.

Basically, it seems that shader objects are a more flexible alternative to shader modules and pipeline objects. However, there doesn’t seem to be any explicit mention of how to pass resources to shader objects - I’m guessing descriptors and its sets and pools are directly reused without modification when working with shader objects.

So is that correct? What’s the real story here?

Shader objects and pipelines are different methods for doing the same thing: deciding what code gets executed in various shader stages. The behavior of that code is unchanged regardless of which method you use.

When you create a shader object, just like a pipeline, you provide it a series of descriptor set layouts that the object will be able to access. As well as push constant info.

A bit of a follow up.

  • The vkCmdBindDescriptorSets function binds descriptor sets to pipeline bind point(s), where as shader objects are bound to individual pipeline stages. Does this mean the corresponding resource can be received by all stages with relevant declaration(s)?

  • The vkCmdBindDescriptorSets function specifies the binding in the pipelineBindPoint and the layout parameter. Why is layout a pipeline layout instead of a descriptor set layout?

There’s a table in the standard explaining which pipeline binding points affect which shader stages.

Because pipeline layouts include multiple descriptor set layouts (in an order). vkCmdBindDescriptorSets can bind multiple sets, so the system needs to know the order of those sets. Pipeline layouts provide that information.

Note that the parameters used to create a pipeline layout are also used to create a shader object.