Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to guarantee ordering for vkCmdPushConstants?

My understanding of Vulkan is that (with a few exceptions) there’s basically no ordering guarantees for command execution within a command buffer: Commands are submitted in-order but they do not complete in-order.

Suppose a program issues these three commands in sequence:

vkCmdDraw

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

vkCmdPushConstants

vkCmdDraw

If I understand this correctly, the GPU is free to reorder these so the push constants get updated before both draws or after both draws. Is that correct? And if so, does that mean that updating things like push constants or descriptor bindings requires a synchronization object (like an event or pipeline barrier)?

>Solution :

There are several kinds of recorded commands. Among them are state commands and action commands. State commands set state to be used later. Action commands:

consume the current state of the command buffer when they are recorded, and will execute state changes on the device as required to match the recorded state.

More specifically:

The work involved in performing action commands is often allowed to overlap or to be reordered, but doing so must not alter the state to be used by each action command.

vkCmd/PushConstants is a state command; it states state into the command buffer. Therefore, subsequent action commands like vkCmdDraw will look at the state currently in the command buffer. Reordering is not allowed to affect this.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading