diff --git a/src/ptk_vk/init.c b/src/ptk_vk/init.c index 24bbc3d..3389df2 100644 --- a/src/ptk_vk/init.c +++ b/src/ptk_vk/init.c @@ -108,7 +108,7 @@ bool vk_transfer_vertex_data(void) { return true; } -bool vk_record_command_buffer(const VkCommandBuffer command_buffer, const uint32_t image_index) { +bool record_command_buffer(const VkCommandBuffer command_buffer, const uint32_t image_index) { VK_TRY(false, vkBeginCommandBuffer( command_buffer, @@ -167,7 +167,7 @@ bool vk_record_command_buffer(const VkCommandBuffer command_buffer, const uint32 return true; } -bool vk_update_uniform_buffer(const size_t current_frame) { +bool update_uniform_buffer(const size_t current_frame) { const VkExtent2D current_extent = vk_current_swapchain_extent(); m_uniform_buffer_object.window_size.w = current_extent.width; m_uniform_buffer_object.window_size.h = current_extent.height; @@ -395,12 +395,12 @@ bool vk_draw_frame(void) { return false; } - vk_update_uniform_buffer(m_current_frame); + update_uniform_buffer(m_current_frame); vkResetFences(m_dev, 1, &m_in_flight_fences.data[m_current_frame]); vkResetCommandBuffer(m_command_buffers.data[m_current_frame], 0); - if (!vk_record_command_buffer(m_command_buffers.data[m_current_frame], image_index)) { + if (!record_command_buffer(m_command_buffers.data[m_current_frame], image_index)) { PTK_ERR("failed recording command buffer"); return false; } @@ -457,14 +457,7 @@ bool vk_draw_frame(void) { return true; } -void vk_finish(void) { - vkDeviceWaitIdle(m_dev); - - vk_cleanup(); - vk_components_cleanup(); -} - -void vk_cleanup(void) { +void cleanup(void) { vk_cleanup_swapchain(m_dev); vkDestroyPipeline(m_dev, m_pipeline, NULL); @@ -507,3 +500,10 @@ void vk_cleanup(void) { glfwTerminate(); } + +void vk_finish(void) { + vkDeviceWaitIdle(m_dev); + + cleanup(); + vk_components_cleanup(); +} diff --git a/src/ptk_vk/init.h b/src/ptk_vk/init.h index 89702fd..e5f1350 100644 --- a/src/ptk_vk/init.h +++ b/src/ptk_vk/init.h @@ -22,10 +22,4 @@ void vk_finish(void); bool vk_transfer_vertex_data(void); -bool vk_record_command_buffer(const VkCommandBuffer command_buffer, const uint32_t image_index); - -bool vk_update_uniform_buffer(const size_t current_frame); - -void vk_cleanup(void); - #endif // PTK_PTK_VK_INIT_H_