Home > Net >  Vulkan fails to load layer library
Vulkan fails to load layer library

Time:09-11

I am using MoltenVK on MacBook Air with Apple Silicon. I have set my environment according to instructions on Vulkan Tutorial website but when I try to run my program in Xcode I get the following two error messages from validation layer:

ERROR (Callback: Validation Layer): Loading layer library /usr/local/share/vulkan/explicit_layer.d/../../../lib/libVkLayer_api_dump.dylib
ERROR (Callback: Validation Layer): Loading layer library /usr/local/share/vulkan/explicit_layer.d/../../../lib/libVkLayer_khronos_validation.dylib

I have played around with the settings in vkconfig and added environment variable VK_INSTANCE_LAYERS pointing to list of those two layers that failed to load and VK_LAYER_PATH that points to path /Users/jakub/VulkanSDK/1.3.224.1/macOS/share/vulkan/explicit_layer.d. None of that worked.

CodePudding user response:

Those environment variables only work on macOS if you launch the apps from the command line. Apple does not allow environment variables to be set for GUI apps launched from the desktop, etc. A better way to use layers on macOS is to use VKConfig. You can create a configuration with the layers you want (and there's a nice GUI for tweaking layer parameters). This creates a "metalayer" that the loader will always see and make use without the need for environment variables. Also, make sure you do not link statically to MoltenVK, as this does not use the actual loader and layers will not work (although linking statically is perfectly fine for shipping your apps).

  • Related