vulkan-go / vulkan

Vulkan API bindings for Go programming language
MIT License
742 stars 55 forks source link

SetDefaultGetInstanceProcAddr doesn't work on MacOS #58

Open Nv7-GitHub opened 2 years ago

Nv7-GitHub commented 2 years ago

Using SetDefaultGetInstanceProcAddr on MacOS just causes the error vulkan: error loading default getProcAddr. This is because:

  1. First, this function calls setDefaultProcAddr https://github.com/vulkan-go/vulkan/blob/956e3850d8f9d2e617caf5a60622c638ff729c2b/init.go#L22
  2. In setDefaultProcAddr, it calls getDefaultProcAddr https://github.com/vulkan-go/vulkan/blob/956e3850d8f9d2e617caf5a60622c638ff729c2b/vk_wrapper_desktop.c#L14
  3. In getDefaultProcAddr, for MacOS, it just returns NULL https://github.com/vulkan-go/vulkan/blob/956e3850d8f9d2e617caf5a60622c638ff729c2b/vk_default_loader.c#L35-L37
  4. In SetDefaultGetInstanceProcAddr, it checks for isProcAddrSet https://github.com/vulkan-go/vulkan/blob/956e3850d8f9d2e617caf5a60622c638ff729c2b/init.go#L23-L25
  5. In isProcAddrSet, it checks if it is equal to NULL https://github.com/vulkan-go/vulkan/blob/956e3850d8f9d2e617caf5a60622c638ff729c2b/vk_wrapper_desktop.c#L18

Therefore, on MacOS, isProcAddrSet will always return false. Why is it like this? Is there a way to get around this error? If you ignore it, you just get an error about proc addr not being set in Init.