Reputation:
I am trying to run a Vulkan application I wrote on Mac OSX (MacBook Air late 2014, Big Sur 11.7.7, Intel HD5000, Vulkan SDK 1.3.250.0).
When doing:
glfw_extensions = glfwGetRequiredInstanceExtensions (&glfw_extension_count)
I get NULL as glfw_extensions
and zero as glfw_extension_count
.
I am following this tutorial: https://vulkan-tutorial.com/Drawing_a_triangle/Setup/Instance
I can create the Vulkan instance and the window but it looks like the described behavior makes result = glfwCreateWindowSurface (instance, window, nullptr, &surface)
returning a -7 error code as result.
Investigating a little bit, I found that maybe this could be connected to the fact that Vulkan is not able to find the ICD drivers. When I installed the SDK I had a popup telling the about a problem already described here: How to install a Vulkan extension?
When I launch my application, the Validation layer tells me: "Searching for ICD drivers named ../../../lib/libMoltenVK.dylib" and "Loading layer library /usr/local/share/vulkan/explicit_layer.d/../../../lib/libVkLayer_khronos_validation.dylib".
I can run the vkcube app provided the SDK, so for this I believe Vulkan works on my system.
I also tried to export some environmental variables as they say here: https://github.com/glfw/glfw/issues/1299 but with no success. However, as far as I understand, that should be not necessary according to what the SDK installation note says: https://vulkan.lunarg.com/doc/view/latest/mac/getting_started.html
"...SDK System Paths: macOS allows the installation of files to /usr/local which are then in the standard system paths and the loader's search paths for ICDs, if the [X] System Global Files option is selected during installation. The Vulkan installer program will copy the loader, command line tools, and the MoltenVK ICD to these folders. This eliminates the need to set PATH, DYLD_LIBRARY_PATH, VK_LAYER_PATH, and VK_ICD_FILENAMES environment variables in order to use SDK components during development. " and I selected that flag during the installation.
I don't know how to fix all this. Any idea?
Best regards,
ezor
P.S: in the recent past, some months ago, I was perfectly able to write and run Vulkan applications of mine on the same system: I don't know if something has changed do to some OSx updates or such kind of things (deprecations, ect...)
Upvotes: 0
Views: 1302
Reputation:
I solved my problem, I was creating the Vulkan instance before creating the GLFW window: that was later causing the window surface to throw the error. Switching the order to: creating the window --> creating the Vulkan instance --> creating the window surface, fixed my issue.
According to the Vulkan Tutorial example I was citing: https://vulkan-tutorial.com/Drawing_a_triangle/Setup/Base_code
they first invoke initWindow()
and then initVulkan()
, if you want to do graphics.
It had nothing to do with what it originally looked like to be the cause. Shame on me.
ezor
Upvotes: 1