Every sample code i tried generate ERROR_LAYER_NOT_PRESENT

Started by Graou, February 21, 2019, 17:17:11

Previous topic - Next topic

Graou

Hello everybody,

I am trying Vulkan in order to replace OpenGl in my Java application.

I develop on Mac OS with Eclipse and OpenJdk 11.

I downloaded many LWJGL examples that fail because the layers are not found.

It's been almost two days that I'm searching without finding out how to give the Java runtime environment this information.

The vkCreateInstance() method fails because its VkInstanceCreateInfo argument contains only MoltenVK and not the expected VK_LAYER_LUNARG_standard_validation.

Does anyone know a solution to this problem?

spasi

Validation layers like VK_LAYER_LUNARG_standard_validation are provided by the Vulkan SDK. Have you installed it?

Graou

Thank you for the quick return. Following your question I checked the installation of the SDK which now seems correct. But the problem persists.

I think I have filled in all the environment variables. Here is a trace of the execution of the program with at the beginning a Java println() of the environment variables and then the stacktrace. Afterwards there is a printenv to show that environment variables are there.

PATH : 			/Users/fbmac/anaconda3/bin:/Users/fbmac/Documents/_projets/Zulu-java-11/com/ondine/libs/vulkansdk-macos-1.1.97.0/macOS/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Applications/Wireshark.app/Contents/MacOS
DYLD_LIBRARY_PATH :	/Users/fbmac/Documents/_projets/Zulu-java-11/com/ondine/libs/vulkansdk-macos-1.1.97.0/macOS/bin
VK_LAYER_PATH : 	/Users/fbmac/Documents/_projets/Zulu-java-11/com/ondine/libs/vulkansdk-macos-1.1.97.0/macOS/etc/vulkan/explicit_layer.d
VK_ICD_FILENAMES : 	/Users/fbmac/Documents/_projets/Zulu-java-11/com/ondine/libs/vulkansdk-macos-1.1.97.0/macOS/etc/vulkan/icd.d/MoltenVK_icd.json


[***MoltenVK ERROR***] VK_ERROR_LAYER_NOT_PRESENT: Vulkan layer VK_LAYER_LUNARG_standard_validation is not supported.
[***MoltenVK ERROR***] VK_ERROR_EXTENSION_NOT_PRESENT: Vulkan extension VK_EXT_debug_utils is not supported.
[***MoltenVK ERROR***] VK_ERROR_INCOMPATIBLE_DRIVER: Request for driver version 401000 is not compatible with provided version 40005f.
févr. 22, 2019 3:58:17 PM com.justindriggers.example.Application main
GRAVE: An fatal error occurred
com.justindriggers.vulkan.instance.models.VulkanException: ERROR_LAYER_NOT_PRESENT (-6)
	at java.base/java.util.Optional.map(Optional.java:265)
	at com.justindriggers.vulkan.instance.VulkanFunction.execute(VulkanFunction.java:18)
	at com.justindriggers.vulkan.instance.VulkanFunction.execute(VulkanFunction.java:25)
	at com.justindriggers.vulkan.instance.VulkanInstance.createVulkanInstance(VulkanInstance.java:174)
	at com.justindriggers.vulkan.instance.VulkanInstance.<init>(VulkanInstance.java:54)
	at com.justindriggers.example.window.GLFWWindow.<init>(GLFWWindow.java:98)
	at com.justindriggers.example.Application.main(Application.java:73)


iMac-de-Franck:~ fbmac$ printenv
VK_ICD_FILENAMES=/Users/fbmac/Documents/_projets/Zulu-java-11/com/ondine/libs/vulkansdk-macos-1.1.97.0/macOS/etc/vulkan/icd.d/MoltenVK_icd.json
TERM_PROGRAM=iTerm.app
VULKAN_SDK=/Users/fbmac/Documents/_projets/Zulu-java-11/com/ondine/libs/vulkansdk-macos-1.1.97.0/macOS
TERM=xterm-256color
SHELL=/bin/bash
TMPDIR=/var/folders/4t/wfx1sb3d2b7d82x56zmr3l1h0000gn/T/
Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.3lUDbcpUYz/Render
TERM_PROGRAM_VERSION=3.2.0
VK_LAYER_PATH=/Users/fbmac/Documents/_projets/Zulu-java-11/com/ondine/libs/vulkansdk-macos-1.1.97.0/macOS/etc/vulkan/explicit_layer.d
TERM_SESSION_ID=w5t0p0:DDFEC3E6-D859-49AB-86AC-83EECE2D5D1B
USER=fbmac
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.iBgOwthfEQ/Listeners
__CF_USER_TEXT_ENCODING=0x0:0:1
PATH=/Users/fbmac/anaconda3/bin:/Users/fbmac/Documents/_projets/Zulu-java-11/com/ondine/libs/vulkansdk-macos-1.1.97.0/macOS/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Applications/Wireshark.app/Contents/MacOS
PWD=/Users/fbmac
ITERM_PROFILE=Default
XPC_FLAGS=0x0
XPC_SERVICE_NAME=0
SHLVL=1
HOME=/Users/fbmac
COLORFGBG=7;0
DYLD_LIBRARY_PATH=/Users/fbmac/Documents/_projets/Zulu-java-11/com/ondine/libs/vulkansdk-macos-1.1.97.0/macOS/bin

spasi

Right, the problem is that LWJGL loads and uses MoltenVK directly, bypassing the Vulkan loader. To fix this, pass -Dorg.lwjgl.vulkan.libname=<path_to_vulkan_sdk>/macOS/lib/libvulkan.dylib to your program (or set it programmatically using Configuration.VULKAN_LIBRARY_NAME). This will make LWJGL load the Vulkan loader instead, which knows how to discover the validation loaders and forward Vulkan function calls to the ICD (i.e. MoltenVK).

Note that you'll also need to export VK_LAYER_PATH & VK_ICD_FILENAMES (like you've done already). Modifying PATH or DYLD_LIBRARY_PATH is not necessary.

Finally, <vulkan_sdk>/macOS/etc/vulkan/icd.d/MoltenVK_icd.json points to the MoltenVK build that comes with the Vulkan SDK. This is usually behind the build that comes with the latest LWJGL snapshot (MoltenVK is updated frequently). However, you can modify the json to make it point to the LWJGL build instead.

Graou

Thank you very much for your expertise and your quick response. You have solved my problem.