| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Vulkan.Utils.Queues
Description
A common physical-device + logical-device boot recipe: pick a device
that exposes a graphicscomputetransfer queue triple (with the graphics
family also presenting, when a surface is supplied), then create a logical
device with one Queue allocated per slot.
This is the wheel every "draw a thing in Vulkan" application reinvents. The recipe here is opinionated:
- The graphics slot doubles as the present queue.
- The compute slot prefers a compute-only queue family (async compute); falls back to aliasing the graphics family.
- The transfer slot prefers a transfer-only queue family (DMA-only hardware queue); falls back to aliasing the compute family.
- Priorities are 1.0 0.5 0.2 for graphics compute transfer.
When two slots target the same family, two distinct Queue handles are
still allocated within that shared family with the requested priorities.
If you need a different shape (compute-only, multiple graphics queues,
custom priorities, …) reach for the lower-level
assignQueues directly.
Synopsis
- data Queues a = Queues {}
- allocateDevice :: (MonadResource m, MonadFail m) => Instance -> Maybe SurfaceKHR -> [DeviceRequirement] -> m (PhysicalDevice, Device, Queues (QueueFamilyIndex, Queue))
Documentation
The GCT queue kit. Parametric in the slot contents so the same
shape can carry priorities (Float), family indices (QueueFamilyIndex),
queue specs (QueueSpec), or fully-resolved (QueueFamilyIndex, Queue)
pairs.
Constructors
| Queues | |
Instances
| Applicative Queues Source # | Elementwise zip — handy for combining priorities with family predicates. |
| Functor Queues Source # | |
| Foldable Queues Source # | |
Defined in Vulkan.Utils.Queues Methods fold :: Monoid m => Queues m -> m # foldMap :: Monoid m => (a -> m) -> Queues a -> m # foldMap' :: Monoid m => (a -> m) -> Queues a -> m # foldr :: (a -> b -> b) -> b -> Queues a -> b # foldr' :: (a -> b -> b) -> b -> Queues a -> b # foldl :: (b -> a -> b) -> b -> Queues a -> b # foldl' :: (b -> a -> b) -> b -> Queues a -> b # foldr1 :: (a -> a -> a) -> Queues a -> a # foldl1 :: (a -> a -> a) -> Queues a -> a # elem :: Eq a => a -> Queues a -> Bool # maximum :: Ord a => Queues a -> a # minimum :: Ord a => Queues a -> a # | |
| Traversable Queues Source # | |
| Show a => Show (Queues a) Source # | |
allocateDevice :: (MonadResource m, MonadFail m) => Instance -> Maybe SurfaceKHR -> [DeviceRequirement] -> m (PhysicalDevice, Device, Queues (QueueFamilyIndex, Queue)) Source #
Pick a physical device that has the queue families needed for the caller, then create a logical device exposing one queue per GCT slot. Devices are scored by total memory.
Pass for windowed callers — the graphics family must also
support presentation. Pass Just surfaceNothing for headless callers — any graphics
family will do.
Pass any extra device requirements (extensions, features, API version) in
the third argument; they are forwarded to allocateDeviceFromRequirements.
Fails (via MonadFail) when no physical device satisfies the family
requirements.