Exemplo n.º 1
0
def render():
    # Render commands submitting

    # Get next image in core swapchain
    image_index, result = hvk.acquire_next_image(api,
                                                 device,
                                                 swapchain,
                                                 semaphore=image_ready)

    # Wait until the rendering of the last scene is done
    fence = render_fences[image_index]
    hvk.wait_for_fences(api, device, (fence, ))
    hvk.reset_fences(api, device, (fence, ))

    # Start rendering on the next image
    submit_info = hvk.submit_info(
        wait_dst_stage_mask=(vk.PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, ),
        wait_semaphores=(image_ready, ),
        signal_semaphores=(rendering_done, ),
        command_buffers=(cmd_draw[image_index], ))

    hvk.queue_submit(api, render_queue.handle, (submit_info, ), fence=fence)

    # Present the next image once rendering is done
    hvk.queue_present(
        api, render_queue.handle,
        hvk.present_info(swapchains=(swapchain, ),
                         image_indices=(image_index, ),
                         wait_semaphores=(rendering_done, )))
Exemplo n.º 2
0
    def _setup_render_cache(self):
        engine = self.engine

        self.render_cache["submit_info"] = hvk.submit_info(
            wait_dst_stage_mask=(
                vk.PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, ),
            wait_semaphores=(self.image_ready, ),
            signal_semaphores=(self.rendering_done, ),
            command_buffers=(0, ))

        self.render_cache["present_info"] = hvk.present_info(
            swapchains=(engine.swapchain, ),
            image_indices=(0, ),
            wait_semaphores=(self.rendering_done, ))