realitix / vulkan

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

vkQueuePresentKHR returned None #37

Closed sunbearc22 closed 7 years ago

sunbearc22 commented 7 years ago

Hi realitix, Is the function vkQueuePresentKHR suppose to return None or VkResult? I was expecting the latter.

I am attempting the resizeable window tutorial of Vulkan Tutorial. I noticed that vkQueuePresentKHR returns None.

        result = self.fnp['vkQueuePresentKHR'](self.present_queue, presentInfo)
        print('result = ',result)

        if result == VK_ERROR_OUT_OF_DATE_KHR or result == VK_SUBOPTIMAL_KHR:
            logging.error("Needs to recreate swapchain.!")
            self._recreateSwapChain()
        elif result != VK_SUCCESS:
            logging.error("Failed to present swapchain image!")

        vkQueueWaitIdle(self.present_queue)

Output:

result =  None
2017-10-18 16:21:19,156 vulkanbase_v3_recreateSwapChain._drawFrame                     +1625 : ERROR    Failed to present swapchain image!
realitix commented 7 years ago

Hello @sunbearc22, it's strange because this function can't return None. Can you show how you initialize

self.fnp['vkQueuePresentKHR']
sunbearc22 commented 7 years ago

Yes. I just uploaded my codes https://github.com/sunbearc22/vulkan_examples/blob/master/HelloTriangle/vulkanbase_v3_recreateSwapChain.py#L208. version 3 codes.

realitix commented 7 years ago

My last comment was wrong. It's normal that it returns None. All functions return None with the wrapper. To catch the return value, you must use the exception system.