8

Quoting Vulkan 1.0 specification document, chapter.5(Command Buffers) 4th paragraph,

"Unless otherwise specified, and without explicit synchronization, the various commands submitted to a queue via command buffers may execute in arbitrary order relative to each other, and/or concurrently"

In 1st paragraph of chapter 2.1.1(Queue Operation), it also states

"... Command buffers submitted to a single queue are played back in the order they were submitted, and commands within each buffer are played back in the order they were recorded"

Does "arbitrary order" in chapter 5 mean even out-of-order? Then isn't it a conflict to statement of chapter 2.1.1 "played back in the order they were submitted"? Or are commands just "PLAYED BACK" in-order but "EXECUTED" out-of-order?

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
jspark
  • 105
  • 1
  • 6

1 Answers1

12

Chapter 2.1.1 is defining the API ordering of commands: the order of command buffers submitted into the queue, and the order of commands within the command buffer (and the order of primitives within a command).

Chapter 5 is saying that the API ordering doesn't mean anything about execution ordering unless some text specifically says otherwise. Chapter 2.1.1 includes specific exceptions to this (blending, depth test), and Chapter 6 introduces execution dependencies which can enforce execution ordering, based on the API ordering defined in 2.1.1. But outside of cases that explicitly declare ordering, the API ordering does not prohibit the queue from doing whatever else it wants with regard to execution.

That being said, the spec explains that poorly.

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
  • Then vulkan implementation does not have to keep API order of commands unless there are explicit synchronization by the application, right? In OpenGL, API calling order implies to command order implicitly. (Effect of a API call is assumed to be applied before following API call.) – jspark Mar 12 '16 at 05:43
  • 1
    "*unless there are explicit synchronization by the application, right?*" Or the other specific cases the spec talks about (blending, depth test, stencil, etc). But in general yes: unless you create an explicit dependency, the Vulkan implementation is free to alter the execution order of commands as it sees fit. This is also how OpenGL's Image Load/Store's [memory model works](https://www.opengl.org/wiki/Incoherent_Memory_Access). – Nicol Bolas Mar 12 '16 at 13:26
  • @NicolBolas Does this mean that commands recorded to a single command buffer and submitted to a queue may execute out of order? – Xatian Sep 20 '20 at 15:56