Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- checkCommandsExp :: [Name] -> Q Exp
Documentation
Create an expression which checks the function pointers for all the Vulkan commands depended upon by the specified list of function names.
It returns a list of function names corresponding to those functions with null pointers.
Your program can use this function to fail early if a command couldn't be loaded for some reason (missing extension or layer for example).
One can create a function called checkCommands
with the following:
[d| checkCommands = $(checkCommandsExp ['withInstance, 'cmdDraw, ...]) |]
It has the type IsString a => Instance -> Device -> [a]
It looks basically like
inst dev -> [ name | True <- [ nullFunPtr == pVkCreateDevice inst , nullFunPtr == pVkCreateFence dev .. ] | name <- [ "vkCreateDevice" , "vkCreateFence" .. ] ]