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

GHC 9.14.1 · lts/ghc-9.14.x · 45dd537 · 2026-10-11

Modulevulkan-utils-0.5.11.0Haskell2010

Vulkan.Utils.Initialization

  • 12 values

Instance creation

3 declarations
valueallocateVulkanInstance
  1. :: MonadResource m
  2. => Vector ByteString

    Backend-required instance extensions (e.g. from Vulkan.Utils.Init.SDL2.getRequiredInstanceExtensions). mempty for headless.

  3. -> Maybe ApplicationInfo
  4. -> [InstanceRequirement]

    Caller's required requirements

  5. -> [InstanceRequirement]

    Caller's optional requirements

  6. -> m Instance
#

Build a Vulkan Instance from a backend-supplied extension list plus caller-supplied requirements. Automatically merges portabilityRequirements into the required list and portabilityFlags into the create flags so macOS apps work without per-call plumbing.

Pass mempty for the extension list when running headless; or call allocateInstance which does so.

macOS portability

3 declarations

Device requirements needed on macOS: the Vulkan spec mandates that VK_KHR_portability_subset be enabled whenever a physical device advertises it (as MoltenVK does). Empty on every other platform.

Device creation

1 declaration

Physical device selection

2 declarations
valuepickPhysicalDevice
  1. :: (MonadIO m, Ord b)
  2. => Instance
  3. -> (PhysicalDevice -> m (Maybe a))

    A suitability funcion for a PhysicalDevice, Nothing if it is not to be chosen.

  4. -> (a -> b)

    Scoring function to rate this result

  5. -> m (Maybe (a, PhysicalDevice))

    The score and the device

#

Get a single PhysicalDevice deciding with a scoring function

Pass a function which will extract any required values from a device in the spirit of parse-don't-validate. Also provide a function to compare these results for sorting multiple suitable devices.

As an example, the suitability function could return a tuple of device memory and the compute queue family index, and the scoring function could be fst to select devices based on their memory capacity. Consider using assignQueues to find your desired queues in the suitability function.

Pehaps also use the functionality in Vulkan.Utils.Requirements and return the DeviceCreateInfo too.

If no devices are deemed suitable then a NoSuchThing IOError is thrown.

Deprecated aliases

3 declarations