About Shader Objects and Dynamic States

Hello,
I am reading Vulkan Spec 1.4 pdf

If I use Shader Objects, I don’t need to create Pipelines
However, it looks I need to use Dynamic States concepts if I use Shader Objects

But strangely, this Dynamic States belong to the Chapter about Pipelines and also, it looks Dynamics States are using Pipeline objects

So could you please introduce to me
how to use Shader Objects without Pipelines in coding command buffer writing functions ?
Because there are validation errors such that

ERROR: [-1511012899][VUID-vkCmdDrawIndexed-None-07846] : Validation Error: [ VUID-vkCmdDrawIndexed-None-07846 ] Object 0: handle = 0x15f99e638f0, type = VK_OBJECT_TYPE_COMMAND_BUFFER; | MessageID = 0xa5efc5dd | vkCmdDrawIndexed(): VK_DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE state is dynamic, but the command buffer never called vkCmdSetDepthBoundsTestEnable.
vkCmdSetRasterizerDiscardEnable last set rasterizerDiscardEnable to VK_FALSE.
The Vulkan spec states: If the depthBounds feature is enabled, a shader object is bound to any graphics stage or a graphics pipeline is bound which was created with the VK_DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE dynamic state enabled, and the current value of rasterizerDiscardEnable is VK_FALSE, then vkCmdSetDepthBoundsTestEnable must have been called and not subsequently invalidated in the current command buffer prior to this drawing command (Drawing Commands :: Vulkan Documentation Project)

The validation message likely predates the introduction of shader objects so it only talks about dynamic state.
However, when using shader objects there is some state that you need to set in your command buffer before you can record a draw call, see this section of the spec.

As you observe with shader objects there is no pipeline object that can supply settings for the various states. That is conceptually pretty similar to having a pipeline object bound where all states are marked as dynamic - in that case you also have to set them all before you can issue a draw call.

1 Like

Oh, now I understand
9.1.5 section has the answers, as you guide me

Thank you for your explanation
Have a great weekend and see you, Carsten