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

Vulkan.Utils.Initialization

Synopsis

Instance creation

createInstanceFromRequirements Source #

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.

createDebugInstanceFromRequirements Source #

Arguments

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

Required

-> [InstanceRequirement]

Optional

-> InstanceCreateInfo es 
-> m Instance 

Like createInstanceFromRequirements 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.

Device creation

createDeviceFromRequirements Source #

Arguments

:: forall m. MonadResource m 
=> [DeviceRequirement]

Required

-> [DeviceRequirement]

Optional

-> PhysicalDevice 
-> DeviceCreateInfo '[] 
-> 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.