Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why can't create xcb surface? #46

Closed
sunbearc22 opened this issue Aug 4, 2018 · 1 comment
Closed

Why can't create xcb surface? #46

sunbearc22 opened this issue Aug 4, 2018 · 1 comment

Comments

@sunbearc22
Copy link

@realitix I noticed an issue with creating a xcb surface. My function to create such a surface is given below. However, vkGetInstanceProcAddr gives a ProcedureNotFoundError.

I can create a xlib surface. Also, previously I had tested the same code to make a xcb surface a year ago and that worked. Can you point me the cause of the issue as I can't figure it out? I have checked for the presence of vkCreateXcbSurfaceKHR in _vulkan.py and vulkan.cdef.h and found it mentioned there. The libx11 packages on my system are shown below too. So what gives?

    def setSurface(self):

        info = self.window.info.info
        
        def create_surface(name, surface_createInfo):
            f = vkGetInstanceProcAddr(self.instance, name)
            return f(self.instance, surface_createInfo, None)
        
        def _surface_xlib():
            surface_createInfo = VkXlibSurfaceCreateInfoKHR(
                sType = VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR,
                flags = 0,
                dpy    = info.x11.display,
                window = info.x11.window)
            return create_surface('vkCreateXlibSurfaceKHR', surface_createInfo)

        def _surface_xcb():
            surface_createInfo = VkXcbSurfaceCreateInfoKHR(
                sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR,
                flags = 0,
                connection = info.x11.display,
                window     = info.x11.window)
            return create_surface('vkCreateXcbSurfaceKHR', surface_createInfo)

        surface_mapping = { 'VK_KHR_xlib_surface': _surface_xlib,
                            'VK_KHR_xcb_surface': _surface_xcb,
                            }

        err = '- fail to create Vulkan Surface: '
        try:
            self.surface = surface_mapping[self.window.vulkan_surface_ext]()
        except VkError:
            logging.error(err)
            self.cleanup()

  File "~/Vulkan/MyProject/triangle_example/triangle11.py", line 160, in surface_xlib
    vkCreateXlibSurfaceKHR = vkGetInstanceProcAddr(instance, "vkCreateXlibSurfaceKHR")
  File "~/.local/lib/python3.5/site-packages/vulkan/_vulkan.py", line 6856, in vkGetInstanceProcAddr
    raise ProcedureNotFoundError()
vulkan._vulkan.ProcedureNotFoundError
$ dpkg -l | grep libx11
ii  libx11-6:amd64                              2:1.6.3-1ubuntu2                                 amd64        X11 client-side library
ii  libx11-data                                 2:1.6.3-1ubuntu2                                 all          X11 client-side library
ii  libx11-dev:amd64                            2:1.6.3-1ubuntu2                                 amd64        X11 client-side library (development headers)
ii  libx11-doc                                  2:1.6.3-1ubuntu2                                 all          X11 client-side library (development documentation)
ii  libx11-protocol-perl                        0.56-7                                           all          Perl module for the X Window System Protocol, version 11
ii  libx11-xcb-dev:amd64                        2:1.6.3-1ubuntu2                                 amd64        Xlib/XCB interface library (development headers)
ii  libx11-xcb1:amd64                           2:1.6.3-1ubuntu2                                 amd64        Xlib/XCB interface library

@sunbearc22
Copy link
Author

Pardon me. The issue was caused by my code and I have resolve it. Able to create xcb surface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant