Ejemplo n.º 1
0
def create_render_resources():
    global drawing_pool, cmd_draw, image_ready, rendering_done, render_fences

    # Render commands setup
    drawing_pool = hvk.create_command_pool(
        api, device,
        hvk.command_pool_create_info(
            queue_family_index=render_queue.family.index,
            flags=vk.COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT))

    cmd_draw = hvk.allocate_command_buffers(
        api, device,
        hvk.command_buffer_allocate_info(
            command_pool=drawing_pool,
            command_buffer_count=len(swapchain_images)))

    # Render commands synchronisation resources
    info = hvk.semaphore_create_info()
    image_ready = hvk.create_semaphore(api, device, info)
    rendering_done = hvk.create_semaphore(api, device, info)

    info = hvk.fence_create_info(flags=vk.FENCE_CREATE_SIGNALED_BIT)
    render_fences = tuple(
        hvk.create_fence(api, device, info)
        for _ in range(len(swapchain_images)))
Ejemplo n.º 2
0
    def _setup_sync(self):
        engine, api, device = self.ctx
        info = hvk.semaphore_create_info()

        self.image_ready = hvk.create_semaphore(api, device, info)
        self.rendering_done = hvk.create_semaphore(api, device, info)

        self.render_fences = []
        info = hvk.fence_create_info(flags=vk.FENCE_CREATE_SIGNALED_BIT)
        for _ in range(len(engine.render_target.swapchain_images)):
            self.render_fences.append(hvk.create_fence(api, device, info))