shadervulkan

Do I reuse pipeline layout for shader objects in Vulkan?


I noticed that in the new Vulkan spec, Render Pass objects are obsoleted in favor of the newer Render Pass instance. And there's a newer mechanism to compile and use shaders: Shader objects - which can be used directly; while the older Shader modules aren't obsoleted yet - which is used with pipeline objects.

But I find no mention of newer mechanism of using descriptors (and its sets and pools) with shader objects. I did a Ctrl-F over the Resource Descriptor page, there's no exact full-match for VkPipeline - Suggesting the same set of interfaces are directly applicable to shader objects?

So what's the real story here?


Solution

  • VK_EXT_shader_objects is an extension, not core functionality.

    If you look at what it takes to create a shader object, you'll find that VkShaderCreateInfoEXT has parameters that are suspiciously similar to those of VkPipelineLayoutCreateInfo. An array of VkDescriptorSetLayouts, and an array of VkPushConstantRanges.

    Shader objects use the same descriptor (and push-constant) functionality for accessing resources as pipelines. The only difference is that shader objects aren't bound to pipeline state the way shaders in pipeline objects are.