vulkan-utils-0.4: Utils for the vulkan package
Safe HaskellNone
LanguageHaskell2010

Vulkan.Utils.QueueAssignment

Synopsis

Documentation

assignQueues Source #

Arguments

:: forall f m n. (Traversable f, MonadIO m, MonadIO n) 
=> PhysicalDevice 
-> f (QueueSpec m)

A set of requirements for Queues to be created

-> 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.

data QueueSpec m Source #

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))

newtype QueueFamilyIndex Source #

Instances

Instances details
Enum QueueFamilyIndex Source # 
Instance details

Defined in Vulkan.Utils.QueueAssignment

Eq QueueFamilyIndex Source # 
Instance details

Defined in Vulkan.Utils.QueueAssignment

Ord QueueFamilyIndex Source # 
Instance details

Defined in Vulkan.Utils.QueueAssignment

Show QueueFamilyIndex Source # 
Instance details

Defined in Vulkan.Utils.QueueAssignment

Queue Family Predicates

isPresentQueueFamily :: MonadIO m => PhysicalDevice -> SurfaceKHR -> QueueFamilyIndex -> m Bool Source #

Can this queue family present to this surface on this device