Issue with rendering a window with GLFW and Vulkan

Currently I am working on a VR game that uses Vulkan and GLFW. My machine is a Windows but has a Ubunutu 16.04 OS (not dual boot). I have an GeForce 1080Ti GPU. My driver version is 384.

I took my inspiration from OpenVr’s sample code for vulkan, except they use SDL.

VkXlibSurfaceCreateInfoKHR xlibSurfaceCreateInfo = { VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR };
xlibSurfaceCreateInfo.flags = 0;
xlibSurfaceCreateInfo.dpy = wmInfo.info.x11.display;
xlibSurfaceCreateInfo.window = wmInfo.info.x11.window;
nResult = vkCreateXlibSurfaceKHR( m_pInstance, &xlibSurfaceCreateInfo, nullptr, &m_pSurface );

This is the section of code that I am questionable about. For GLFW I used the native call for
glfwGetX11Window(window) and glfwGetX11Display() but when I run my application the window is created briefly then closed. Then my program hangs on the call vr::VRCompositor()->Submit( vr::Eye_Left, &texture, &bounds ) (Lin e 1754 in the OpenVr sample.

I would be happy to provide any additional details as needed. I have been stuck on this error for quite a while and it is quite frustrating. The full code has not been released so I cannot show all of it.

It’s very difficult to get any sense of what may be going wrong without looking at the source. Have you set a GLFW error callback?

I have with this function

void error_callback(int error, const char* description)
{
fprintf(stderr, “Error: %s\n”, description);
}

I do not see any errors in stderr so it makes me think something fishy is going on.

Sorry for the late reply.

There’s definitely something fishy going on. Have you tried setting a breakpoint at glfwDestroyWindow to see when it gets called and by what?

The manual surface creation code you quoted isn’t technically necessary with GLFW as it provides the glfwCreateWindowSurface function that can take care of those details for you. Doing it with the native access functions as you describe should still work, however, and even if it fails that shouldn’t take down the window.

If you’re still stuck I can try porting Valve’s example and seeing if I can get it to run.

I do not believe the function gets called at all after the window freezes.

However I do not use the function call glfwCreateWindowSurface. Debugging is pretty hard due to the fact that my program never returns any errors but still doesn’t behave as it should be.