Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- createInstanceFromRequirements :: (MonadResource m, Extendss InstanceCreateInfo es, PokeChain es) => [InstanceRequirement] -> [InstanceRequirement] -> InstanceCreateInfo es -> m Instance
- createDebugInstanceFromRequirements :: forall m es. (MonadResource m, Extendss InstanceCreateInfo es, PokeChain es) => [InstanceRequirement] -> [InstanceRequirement] -> InstanceCreateInfo es -> m Instance
- createDeviceFromRequirements :: forall m. MonadResource m => [DeviceRequirement] -> [DeviceRequirement] -> PhysicalDevice -> DeviceCreateInfo '[] -> m Device
- pickPhysicalDevice :: (MonadIO m, Ord b) => Instance -> (PhysicalDevice -> m (Maybe a)) -> (a -> b) -> m (Maybe (a, PhysicalDevice))
- physicalDeviceName :: MonadIO m => PhysicalDevice -> m Text
Instance creation
createInstanceFromRequirements Source #
:: (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.
createDebugInstanceFromRequirements Source #
:: 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 #
:: 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
:: (MonadIO m, Ord b) | |
=> Instance | |
-> (PhysicalDevice -> m (Maybe a)) | A suitability funcion for a |
-> (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