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)))
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))
def create_staging_command(): global staging_pool, staging_cmd, staging_fence # Create staging resources for uploading staging_pool = hvk.create_command_pool( api, device, hvk.command_pool_create_info( queue_family_index=render_queue.family.index, flags=vk.COMMAND_POOL_CREATE_TRANSIENT_BIT | vk.COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT)) staging_cmd = hvk.allocate_command_buffers( api, device, hvk.command_buffer_allocate_info(command_pool=staging_pool, command_buffer_count=1))[0] staging_fence = hvk.create_fence(api, device, hvk.fence_create_info())
def _setup_setup_commands(self): api, device = self.api, self.device render_queue = self.render_queue command_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 )) cmds = hvk.allocate_command_buffers(api, device, hvk.command_buffer_allocate_info( command_pool = command_pool, command_buffer_count = 1 )) fence_info = hvk.fence_create_info() fence = hvk.create_fence(api, device, fence_info) self.command_pool = command_pool self.setup_command_buffer = cmds[0] self.setup_fence = fence
def _setup_sync(self): _, api, device = self.ctx fence_info = hvk.fence_create_info() fence = hvk.create_fence(api, device, fence_info) self.fence = fence