Closed georgewsinger closed 6 years ago
From ViveCompositor.hs:
ViveCompositor.hs
foreign import ccall "wrapper" createDebugCallbackPtr :: (VkDebugReportFlagsEXT -> VkDebugReportObjectTypeEXT -> Word64 -> CSize -> Int32 -> Ptr CChar -> Ptr CChar -> Ptr Void -> IO VkBool32) -> IO PFN_vkDebugReportCallbackEXT
Question 1: Shouldn't this function's return type be
foreign import ccall "wrapper" createDebugCallbackPtr :: (VkDebugReportFlagsEXT -> VkDebugReportObjectTypeEXT -> Word64 -> CSize -> Int32 -> Ptr CChar -> Ptr CChar -> Ptr Void -> IO VkBool32) -> IO (FunPtr PFN_vkDebugReportCallbackEXT)
per usage of the "wrapper" keyword?
Note that this function is used in newVulkanInfo to print debugging messages to the console:
newVulkanInfo
newVulkanInfo :: Bool -> IO VulkanInfo newVulkanInfo verbose = do -- ... callbackPtr <- createDebugCallbackPtr $ \_ _ _ _ _ _ message _ -> peekCString message >>= print >> return (VkBool32 VK_FALSE) -- ...
Question 2: Technically, shouldn't this function pointer be freed somewhere in the program?
In case useful, here's the C++ type PFN_vkDebugReportCallbackEXT:
PFN_vkDebugReportCallbackEXT
typedef VkBool32 (VKAPI_PTR *PFN_vkDebugReportCallbackEXT)( VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char* pLayerPrefix, const char* pMessage, //<--- here's what's being using in Simula void* pUserData);
Issue obsolete after move to Godot.
From
ViveCompositor.hs
:Question 1: Shouldn't this function's return type be
per usage of the "wrapper" keyword?
Note that this function is used in
newVulkanInfo
to print debugging messages to the console:Question 2: Technically, shouldn't this function pointer be freed somewhere in the program?
In case useful, here's the C++ type
PFN_vkDebugReportCallbackEXT
: