| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Vulkan.Utils.QueueAssignment
Contents
Synopsis
- assignQueues :: forall f m n. (Traversable f, MonadIO m, MonadIO n) => PhysicalDevice -> f (QueueSpec m) -> m (Maybe (Vector (DeviceQueueCreateInfo '[]), Device -> n (f (QueueFamilyIndex, Queue))))
- data QueueSpec m = QueueSpec {}
- newtype QueueFamilyIndex = QueueFamilyIndex {}
- newtype QueueIndex = QueueIndex {}
- isComputeQueueFamily :: QueueFamilyProperties -> Bool
- isGraphicsQueueFamily :: QueueFamilyProperties -> Bool
- isTransferQueueFamily :: QueueFamilyProperties -> Bool
- isTransferOnlyQueueFamily :: QueueFamilyProperties -> Bool
- isPresentQueueFamily :: MonadIO m => PhysicalDevice -> SurfaceKHR -> QueueFamilyIndex -> m Bool
Documentation
Arguments
| :: forall f m n. (Traversable f, MonadIO m, MonadIO n) | |
| => PhysicalDevice | |
| -> f (QueueSpec m) | A set of requirements for |
| -> m (Maybe (Vector (DeviceQueueCreateInfo '[]), Device -> n (f (QueueFamilyIndex, Queue)))) |
|
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.
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))
Constructors
| QueueSpec | |
Fields | |
newtype QueueFamilyIndex Source #
Constructors
| QueueFamilyIndex | |
Fields | |
Instances
newtype QueueIndex Source #
Constructors
| QueueIndex | |
Fields | |
Instances
Queue Family Predicates
isTransferOnlyQueueFamily :: QueueFamilyProperties -> Bool Source #
Does this queue have QUEUE_TRANSFER_BIT set and not QUEUE_COMPUTE_BIT
or QUEUE_GRAPHICS_BIT
isPresentQueueFamily :: MonadIO m => PhysicalDevice -> SurfaceKHR -> QueueFamilyIndex -> m Bool Source #
Can this queue family present to this surface on this device