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

Vulkan.Utils.Misc

Synopsis

Sorting things

partitionOptReq Source #

Arguments

:: Eq a 
=> [a]

What do we have available

-> [a]

Optional desired elements

-> [a]

Required desired elements

-> ([a], Either [a] [a])

(Missing optional elements, Either (missing required elements) or (all required elements and as many optional elements as possible)

From a list of things, take all the required things and as many optional things as possible.

partitionOptReqIO Source #

Arguments

:: (Show a, Eq a, MonadIO m) 
=> String

What are we sorting (Used for a debug message)

-> [a]

What do we have available

-> [a]

Optional desired elements

-> [a]

Required desired elements

-> m ([a], [a])

All the required elements and as many optional elements as possible, as well as the missing optional elements.

Like partitionOptReq.

Will throw an 'IOError in the case of missing things. Details on missing things will be reported in stderr.

This is useful in dealing with layers and extensions.

Bit Utils

showBits :: forall a. (Show a, FiniteBits a) => a -> String Source #

Show valies as a union of their individual bits

>>> showBits @Int 5
"1 .|. 4"
>>> showBits @Int 0
"zeroBits"
>>> import Vulkan.Core10.Enums.QueueFlagBits
>>> showBits (QUEUE_COMPUTE_BIT .|. QUEUE_GRAPHICS_BIT)
"QUEUE_GRAPHICS_BIT .|. QUEUE_COMPUTE_BIT"

(.&&.) :: Bits a => a -> a -> Bool Source #

Check if the intersection of bits is non-zero