HORIZON HASKELLDocslts/ghc-10.0.xfc4e5982026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · fc4e598 · 2026-10-11

Modulevulkan-utils-0.5.11.0Haskell2010

Vulkan.Utils.QueueAssignment

  • 3 types
  • 6 values
valueassignQueues
  1. :: (Traversable f, MonadIO m, MonadIO n)
  2. => PhysicalDevice
  3. -> f (QueueSpec m)

    A set of requirements for Queues to be created

  4. -> m (Maybe (Vector (DeviceQueueCreateInfo '[]), Device -> n (f (QueueFamilyIndex, Queue))))

    Nothing if it wasn't possible to satisfy all the QueueSpecs

#

Given a PhysicalDevice and a set of requirements for queues, calculate an assignment of queues to queue families and return information with which to create a Device and also a function to extract the requested Queues from the device.

You may want to create a custom type with a Traversable instance to store your queues like:

data MyQueues q = MyQueues
  { computeQueue            :: q
  , graphicsAndPresentQueue :: q
  , transferQueue           :: q
  }

myQueueSpecs :: MyQueues QueueSpec
myQueueSpecs = MyQueues
  { computeQueue            = QueueSpec 0.5 isComputeQueueFamily
  , graphicsAndPresentQueue = QueueSpec 1   isPresentQueueFamily
  , transferQueue           = QueueSpec 1   isTransferOnlyQueueFamily
  }

Note, this doesn't permit differentiating queue family assignment based on whether or not the queue is protected.

datadata QueueSpec (m :: Type -> Type)
#

Requirements for a Queue to be assigned a family by assignQueues.

To assign to a specific queue family index f:

queueSpecFamilyPredicate = i _ -> i == f

To assign to any queue family which supports compute operations:

let isComputeQueue q = QUEUE_COMPUTE_BIT .&&. queueFlags q
in QueueSpec priority (_index q -> pure (isComputeQueue q))

Queue Family Predicates

5 declarations