vulkan-utils-0.5.10.6: Utils for the vulkan package
Safe HaskellSafe-Inferred
LanguageHaskell2010

Vulkan.Utils.CommandCheck

Synopsis

Documentation

checkCommandsExp Source #

Arguments

:: [Name]

The names of functions from the vulkan package. Unknown commands are ignored

-> Q Exp 

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"
              ..
            ]
  ]