realitix / vulkan

The ultimate Python binding for Vulkan API
Apache License 2.0
505 stars 46 forks source link

vkGetPhysicalDeviceSurfaceCapabilitiesKHR gives VkErrorInitializationFailed for xcb surface #47

Closed sunbearc22 closed 6 years ago

sunbearc22 commented 6 years ago

Issue: I obtained the following error in my code for an xcb surface during vulkan command 'vkGetPhysicalDeviceSurfaceCapabilitiesKHR'.

File "~/.local/lib/python3.5/site-packages/vulkan/_vulkan.py", line 5207, in vkGetPhysicalDeviceSurfaceCapabilitiesKHR
    raise exception_codes[result]
vulkan._vulkan.VkErrorInitializationFailed

To investigate the issue, I used your example_sdl2.py script and substituted all definitions pertaining to xlib with xcb. And I got the same error msg.

Changes made to example_sdl2.py:

  1. replaced line 60 with extensions.append('VK_KHR_xcb_surface')
  2. replaced lines 101 to 109 with
    def surface_xcb():
    print("Create Xcb surface")
    vkCreateXcbSurfaceKHR = vkGetInstanceProcAddr(instance, "vkCreateXcbSurfaceKHR")
    surface_create = VkXcbSurfaceCreateInfoKHR(
            sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR,
            connection = wm_info.info.x11.display,
            window = wm_info.info.x11.window,
            flags = 0)
    return vkCreateXcbSurfaceKHR(instance, surface_create, None)
  3. replaced line 140 with sdl2.SDL_SYSWM_X11: surface_xcb

The xlib version of example_sdl2.py works well on my system.

Question: Is VkErrorInitializationFailed due to an issue in vulkan or Vulkan?

realitix commented 6 years ago

Hello @sunbearc22, Sorry for my late reply.

I think the problem comes from your Vulkan driver. To be sure, you can enable the debug layer, maybe you will find informations.

realitix commented 6 years ago

Hello @sunbearc22, I close this issue, you can reopen if you have more elements.