Identifying Queue Families

Queues are collected together in queue families which all support the same operation type

After the application has selected a suitable physical device, it needs a method of telling it what to do. This is where queues come in. An application sends tasks to a queue using command buffers, which are then executed asynchronously by the GPU.

Queues have different types depending on the type of operations they can perform.

There are four different types of queues in Vulkan:
  • Graphics - supports graphics operations
  • Compute - supports compute operations
  • Transfer - supports memory transfer operations
  • Sparse - supports sparse memory management operations.

In basic graphics applications the only types of operations required are rendering and presenting, so it is likely that only a graphics queue would be needed.

What are queue families?

In Vulkan, queues are collected together in queue families. Queue families contain a set of queues which all support the same type of operations. An application can query the physical device for the properties of the supported queue families. For an application to create queues, it must identify a queue family which supports the commands it requires.

Example: initQueueFamilies()

In the example code, initQueueFamilies() identifies two queue families:

  • one which supports graphics operations
  • one which supports presenting images to a surface.

It stores the indices of these queue families so they can be used to create queues later.