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

Vulkan.Utils.Initialization

Synopsis

Instance creation

allocateInstanceFromRequirements Source #

Arguments

:: forall m (es :: [Type]). (MonadResource m, Extendss InstanceCreateInfo es, PokeChain es) 
=> [InstanceRequirement]

Required

-> [InstanceRequirement]

Optional

-> InstanceCreateInfo es 
-> m Instance 

Create an 'Instance from some requirements.

Will throw an 'IOError in the case of unsatisfied non-optional requirements. Unsatisfied requirements will be listed on stderr.

allocateDebugInstanceFromRequirements Source #

Arguments

:: forall m (es :: [Type]). (MonadResource m, Extendss InstanceCreateInfo es, PokeChain es) 
=> [InstanceRequirement]

Required

-> [InstanceRequirement]

Optional

-> InstanceCreateInfo es 
-> m Instance 

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.

allocateVulkanInstance Source #

Arguments

:: MonadResource m 
=> Vector ByteString

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

-> Maybe ApplicationInfo 
-> [InstanceRequirement]

Caller's required requirements

-> [InstanceRequirement]

Caller's optional requirements

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

portabilityRequirements :: [InstanceRequirement] Source #

portabilityFlags :: InstanceCreateFlags Source #

Instance create flag bits that pair with portabilityRequirements. zero on every non-macOS platform.

devicePortabilityRequirements :: [DeviceRequirement] Source #

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

allocateDeviceFromRequirements Source #

Arguments

:: MonadResource m 
=> [DeviceRequirement]

Required

-> [DeviceRequirement]

Optional

-> PhysicalDevice 
-> DeviceCreateInfo ('[] :: [Type]) 
-> m Device 

Create a Device from some requirements.

Will throw an 'IOError in the case of unsatisfied non-optional requirements. Unsatisfied requirements will be listed on stderr.

Physical device selection

pickPhysicalDevice Source #

Arguments

:: (MonadIO m, Ord b) 
=> Instance 
-> (PhysicalDevice -> m (Maybe a))

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

-> (a -> b)

Scoring function to rate this result

-> 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 Requirements and return the DeviceCreateInfo too.

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

physicalDeviceName :: MonadIO m => PhysicalDevice -> m Text Source #

Extract the name of a PhysicalDevice with getPhysicalDeviceProperties

Deprecated aliases

createInstanceFromRequirements :: forall m (es :: [Type]). (MonadResource m, Extendss InstanceCreateInfo es, PokeChain es) => [InstanceRequirement] -> [InstanceRequirement] -> InstanceCreateInfo es -> m Instance Source #

Deprecated: Renamed to allocateInstanceFromRequirements

createDebugInstanceFromRequirements :: forall m (es :: [Type]). (MonadResource m, Extendss InstanceCreateInfo es, PokeChain es) => [InstanceRequirement] -> [InstanceRequirement] -> InstanceCreateInfo es -> m Instance Source #

Deprecated: Renamed to allocateDebugInstanceFromRequirements

createDeviceFromRequirements :: MonadResource m => [DeviceRequirement] -> [DeviceRequirement] -> PhysicalDevice -> DeviceCreateInfo ('[] :: [Type]) -> m Device Source #

Deprecated: Renamed to allocateDeviceFromRequirements