Пример #1
0
 def __createSurface(self):
     surface_ptr = ffi.new('VkSurfaceKHR[1]')
     glfw.create_window_surface(self.__instance, self.__window, None,
                                surface_ptr)
     self.__surface = surface_ptr[0]
     if self.__surface is None:
         raise Exception("failed to create window surface!")
Пример #2
0
 def __createSurface(self):
     surface = ctypes.c_void_p(0)
     # instance = ctypes.cast(int(ffi.cast('intptr_t', self.__instance)), ctypes.c_void_p)
     instance = ctypes.cast(int(ffi.cast('uintptr_t', self.__instance)),
                            ctypes.c_void_p)
     glfw.create_window_surface(instance, self.__window, None,
                                ctypes.byref(surface))
     self.__surface = ffi.cast('VkSurfaceKHR', surface.value)
     if self.__surface is None:
         raise Exception("failed to create window surface!")
Пример #3
0
 def createSurface(self):
     surface = c_void_p(0)
     instance = cast(int(ffi.cast('uintptr_t', self.__instance)), c_void_p)
     _foo = glfw.create_window_surface(
         instance=instance,
         window=self.m_Window,
         allocator=None,
         surface=byref(surface)
     )
     assert _foo, '[createSurface]: failed to create window surface'
Пример #4
0
    def create_surface(self, vulkan_instance: VulkanInstance):

        instance = vulkan_instance.vk_instance
        ref = int(vulkan.ffi.cast('intptr_t', instance))
        instance = ctypes.c_void_p(ref)

        opaque = vulkan.ffi.new("int *")
        pSurface = vulkan.ffi.cast('VkSurfaceKHR', opaque)

        ref = int(vulkan.ffi.cast('intptr_t', pSurface))
        glfw_surface = ctypes.c_void_p(ref)

        code = glfw.create_window_surface(instance, self.window, None,
                                          glfw_surface)

        if code != vulkan.VK_SUCCESS:

            raise RuntimeError("Unable to create window surface")

        return VulkanSurface(vulkan_instance, opaque, pSurface)