Compare commits

...

2 commits

Author SHA1 Message Date
61308ed427
stop exposing a few functions 2024-10-04 16:41:24 +02:00
a55d67b9b5
get rid of another useless function 2024-10-04 16:39:40 +02:00
2 changed files with 13 additions and 25 deletions

View file

@ -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,
@ -154,7 +154,7 @@ bool vk_record_command_buffer(const VkCommandBuffer command_buffer, const uint32
vkCmdBindIndexBuffer(command_buffer, m_index_buffer, 0, VK_INDEX_TYPE_UINT32);
vkCmdBindDescriptorSets(command_buffer, VK_PIPELINE_BIND_POINT_GRAPHICS, m_pipeline_layout, 0, 1, &m_descriptor_sets.data[vk_current_frame()], 0, NULL);
vkCmdBindDescriptorSets(command_buffer, VK_PIPELINE_BIND_POINT_GRAPHICS, m_pipeline_layout, 0, 1, &m_descriptor_sets.data[m_current_frame], 0, NULL);
vkCmdDrawIndexed(command_buffer, g_indices.size, 1, 0, 0, 0);
@ -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;
@ -372,10 +372,6 @@ bool vk_is_done(void) {
return glfwWindowShouldClose(m_window);
}
uint32_t vk_current_frame(void) {
return m_current_frame;
}
bool vk_draw_frame(void) {
vkWaitForFences(m_dev, 1, &m_in_flight_fences.data[m_current_frame], VK_TRUE, UINT64_MAX);
@ -399,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;
}
@ -461,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);
@ -511,3 +500,10 @@ void vk_cleanup(void) {
glfwTerminate();
}
void vk_finish(void) {
vkDeviceWaitIdle(m_dev);
cleanup();
vk_components_cleanup();
}

View file

@ -16,18 +16,10 @@ bool vk_init(GLFWwindow *window, const size_t width, const size_t height, const
bool vk_is_done(void);
uint32_t vk_current_frame(void);
bool vk_draw_frame(void);
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_