VULKAN loader on MacOS

Hello guys! Can somebody give me a clue where is the problem. Developing new application under MacOS with latest SDK. If I am trying to link libMoltenVK.dylib to my bundle app then instance creates very well. But in case I am trying to link only vulkan.framework, ICD driver does not loads and fails to create an instance. Where can be the problem? Tried to play around with env vars, but it seems that I do not understand how vulkan.framework should load ICD driver and layers. I am trying to make it work with SDK installed into system folders /usr/local/

Correct me if I am wrong but if SDK installed into /usr/local then the only thing I need is to link vulkan.framework which should make a search in these system folders and in case of successfull search of /usr/local/share/vulkan/icd.d/MoltenVK_icd.json it should upload into memory libMoltenVK.dylib. Or I am missing something?

Here is vkconfig

I don’t deal with Apl, but documentation how you are supposed to install and use it is at LunarXchange. Supplemental MoltenVK documentation is at https://github.com/KhronosGroup/MoltenVK/blob/main/Docs/MoltenVK_Runtime_UserGuide.md.

I think perhaps that if you want to use the official Loader, you should link against that instead of the driver.

Yes I am using official loader but it does not load. And I do not understand why or how to try to find out where is the problem

I have a feeling that loader even does not try to load ICD. I add VK_LOADER_DEBUG=error,warn into CLan preprocessor as it is mentioned in here https://github.com/KhronosGroup/Vulkan-Loader/blob/main/docs/LoaderDriverInterface.md#driver-discovery and still no results

I investigated the problem by myself. MacOS restricted access of my application with sandbox. So as a result fopen() call inside vulkan.framework has failed to read ICD manifest json. To fix it you need to set “App Sandbox” = NO in your *.entitlements file

And in case some one wants to debug official loader problems, simply setup “VK_LOADER_DEBUG”=error in your target scheme

I suspect there may have been a pop-up you missed asking if you want to allow to access the directory containing the manifest. Such pop-ups are normal macOS behavior as far as I can see.

More importantly, if you want to distribute your app you need to copy the framework and libMoltenVK.dylib into your app bundle. As is, it will only work if the user has installed the Vulkan SDK. See the link provided by @krOoze earlier in this thread.

There are some interesting bits on the MoltenVK readme about VK_KHR_portability_subset and VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR: GitHub - KhronosGroup/MoltenVK: MoltenVK is a Vulkan Portability implementation. It layers a subset of the high-performance, industry-standard Vulkan graphics and compute API over Apple's Metal graphics framework, enabling Vulkan applications to run on macOS, iOS and tvOS.