As a lot of "beginner", I thought use TOP_OF_PIPELINE as a dst and BOTTOM_OF_PIPELINE as a src meant ALL_COMMANDS for both.
Here Nicol Bolas wrote that "Since top/bottom of the pipe make no sense for memory barriers, maybe using them should just be flat-out invalid. And thus useful only for execution barriers."
From what I understand, since TOP and BOTTOM does not perform any access into memory, putting barrier on top or bottom can't make memory visible^^.
As I understand what Nicol Bolas means and what I just said about memory access / visibility, when you use bottom or top, you must set accessMask to 0.
If I want to present the image, I can do something like that :
srcStage = COLOR_ATTACHMENT_OUTPUT_BIT
srcAccess = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT
oldLayout = ATTACHMENT_OPTIMAL
dstStage = BOTTOM
dstAccess = 0; // Since memory read access will be "issued" by semaphore
newLayout = PRESENT_KHR;
We use bottom here because we do not want the memory barrier make the current queue wait as it is described in the specs :
The VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT is useful for accomplishing memory barriers and layout transitions when the next accesses will be done in a different queue or by a presentation engine; in these cases subsequent commands in the same queue do not need to wait, but the barrier or transition must complete before semaphores associated with the batch signal.
So now, I can say (I hope...) that I understand when to use every stages but TOP_OF_PIPE nop...
So, there are my questions : What exactly is an execution barrier (thus without memory barrier)? Why are they useful? (because it is good to say that one operation happen after one other, but it is better to can say that we can consume the data produced in the first operation in the second operation). When should have I to put a barrier on Bottom or Top of pipeline?
Thanks !