Hello,
I am creating a vulkan instance and a glfw window and then trying to create a window surface but I’m getting an error. I’m running:
MacOS 10.15.7
Vulkan Instance Version: 1.2.182 (from vulkaninfo)
glfw: stable 3.3.4 (installed from homebrew)
I am dynamically loading vulkan functions, an example would be:
VulkanApp::OS::LibraryHandle VulkanLibrary = dlopen("libvulkan.1.2.182.dylib", RTLD_NOW);
PFN_vkCreateDevice meta_vkCreateDevice = reinterpret_cast<PFN_vkCreateDevice>(dlsym(VulkanLibrary, "vkCreateDevice"));
and I then use the function e.g.
auto gd_err = meta_vkCreateDevice(gpu, &graphics_device_create_info, VK_NULL_HANDLE, &graphicsDevice);
if(VK_SUCCESS != gd_err){
throw std::runtime_error("Graphics logical device creation failed");
}
Everything works fine until I try and create the window surface:
void Window::createSurface(){
if (glfwCreateWindowSurface(renderer->getInstance(), window, nullptr, &surface) != VK_SUCCESS){
VkResult result = glfwCreateWindowSurface(renderer->getInstance(), window, nullptr, &surface);
std::cout << result << std::endl;
throw std::runtime_error("failed to create window surface!");
};
}
I have enabled error logging in glfw, and see:
GLFW error: Cocoa: Vulkan instance missing VK_EXT_metal_surface extension
libc++abi.dylib: terminating with uncaught exception of type std::runtime_error: failed to create window surface!
The instance has the “VK_EXT_metal_surface
” extension enabled, along with “VK_KHR_surface
” and “VK_EXT_debug_utils
”.
This is a guess, but is the error being thrown because glfwCreateWindowSurface
is calling vulkan functions, but not dynamically like I am doing and this is causing the errors? I have read the glfw web page about using Vulkan and it does mention using glfwGetInstanceProcAddress
but it’s a little unclear to me how I should be using it. Do I have to do something similar to the vulkan function whereby I create a meta_glfwCreateWindowSurface()
function calling “libglfw.3.3.dylib” directly?
I would really appreciate any suggestions, or any steps I can take to work out what the problem is.
Thanks