HORIZON HASKELLDocslts/ghc-10.0.x77a86622026-10-31Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 77a8662 · 2026-10-31

Instance creation

Like allocateInstanceFromRequirements except it will create a debug utils messenger (from the VK_EXT_debug_utils extension).

If the VK_EXT_validation_features extension (from the VK_LAYER_KHRONOS_validation layer) is available is it will be enabled and best practices messages enabled.

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

Device creation

Physical device selection

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