« on: February 22, 2016, 08:23:43 PM »
A barrier is a new concept exposed to developers which was previously hidden inside the driver. If you think synchronization, you’re not too far off, as this is also part of what a barrier is.The synchronization part is well known for CPUs: you have multiple writer threads updating a buffer, then you synchronize to make sure all writes have finished, and then you can process the data with multiple reader threads. However, that’s not all there is to a GPU barrier (ResourceBarrier and vkCmdPipelineBarrier).
Related to barriers are fences (CreateFence and vkCreateFence), which are required to synchronize the CPU with the GPU as well as different queues on GPUs. A fence is a very heavyweight synchronization primitive as it requires the GPU to flush all caches at least, and potentially some additional synchronization. Due to those costs, fences should be used sparingly. In particular, try to group per-frame resources and track them together with a single fence instead of fine-grained per-resource tracking. For instance, all commands buffers used in one frame should be protected by one fence, instead of one fence per command buffer.
added to Vulkan resources list: