Hello Guest

Running Vulkan on macOS with MoltenVK

  • 4 Replies
  • 745 Views
Running Vulkan on macOS with MoltenVK
« on: April 06, 2018, 11:50:48 »
Hello all,

I am trying to use the recently open sourced MoltenVK port of Vulkan on macOS. I downloaded the LunarG dev kit and setup the environment variables. The included binaries all work well.

I then tried one of the demos of LWJGL, and finaly found that to make it find the Vulkan dynamic library I had to add -Dorg.lwjgl.vulkan.libname=MoltenVK as a jvm argument.

All works well excepted that I cannot add any validation layers. If I do, I always get the following error :

VK_ERROR_LAYER_NOT_PRESENT: Vulkan layer VK_LAYER_LUNARG_standard_validation is not supported.

Am I missing something ? I found the -Dorg.lwjgk.vulkan.libname in the forum. Is this the correct way to tell LWJGL what to use ? Should I use something else or add something ? Is there a documentation I missed ?

I think my environment is correctly setup (VULKAN_SDK and VK_LAYER_PATH are set, correctly I hope).

Sorry if this is a silly or misinformed question.

Thanks a lot

*

Offline spasi

  • *****
  • 2028
    • WebHotelier
Re: Running Vulkan on macOS with MoltenVK
« Reply #1 on: April 06, 2018, 16:23:37 »
finaly found that to make it find the Vulkan dynamic library I had to add -Dorg.lwjgl.vulkan.libname=MoltenVK as a jvm argument.

This is not required when lwjgl-vulkan-natives-macos.jar is available in the class/module-path. By default, LWJGL tries to load libMoltenVK.dylib and if that fails, tries libvulkan.1.dylib. The mentioned jar contains libMoltenVK.dylib, so you don't have to download it separately or build it on your own.

Specifying -Dorg.lwjgl.vulkan.libname overrides the above. Using libMoltenVK.dylib from LunarG should work fine. Note that the override can also be an absolute path to the .dylib you want to use.

All works well excepted that I cannot add any validation layers. If I do, I always get the following error :

VK_ERROR_LAYER_NOT_PRESENT: Vulkan layer VK_LAYER_LUNARG_standard_validation is not supported.

Am I missing something ?

From the list of known MoltenVK limitations:

Quote
MoltenVK is a Layer-0 driver implementation of Vulkan, and currently does not support the loading of higher level Vulkan Layers.

This may change soon, there has been some progress in porting the validation layers to macOS.

Re: Running Vulkan on macOS with MoltenVK
« Reply #2 on: April 07, 2018, 07:47:10 »
Thanks for this reply, it makes things clearer for me :)

In fact I searched for the org.lwjgl.vulkan.libname because the 3.1.6 release of lwjgl I use does not have any natives in the vulkan directory, so I imagined I had to provide the library by myself. But maybe I missed something else ? I downloaded it here : https://github.com/LWJGL/lwjgl3/releases

I also tried the 3.1.5 and a customized zip (selecting minimal vulkan).

From the list of known MoltenVK limitations:

Quote
MoltenVK is a Layer-0 driver implementation of Vulkan, and currently does not support the loading of higher level Vulkan Layers.

This may change soon, there has been some progress in porting the validation layers to macOS.

Thanks a lot, this is the part I missed indeed !

By the way I discovered LWJGL recently and played a lot with OpenGL, an now trying Vulkan. This library is a pleasure to work with :)

*

Offline spasi

  • *****
  • 2028
    • WebHotelier
Re: Running Vulkan on macOS with MoltenVK
« Reply #3 on: April 07, 2018, 08:32:45 »
In fact I searched for the org.lwjgl.vulkan.libname because the 3.1.6 release of lwjgl I use does not have any natives in the vulkan directory, so I imagined I had to provide the library by myself. But maybe I missed something else ?

That's because the open source version of MoltenVK was released after 3.1.6 and is currently available only in 3.1.7 snapshots. The LWJGL build customizer has been updated to support this, if you choose Nightly + macOS + the Vulkan bindings, you'll get the MoltenVK binary.

Re: Running Vulkan on macOS with MoltenVK
« Reply #4 on: April 07, 2018, 08:58:29 »
Thanks a lot ! :D
« Last Edit: April 07, 2018, 09:11:41 by 4nt01n3 »