diff --git a/src/ptk_vk/init.c b/src/ptk_vk/init.c index 9051aad..63f0db2 100644 --- a/src/ptk_vk/init.c +++ b/src/ptk_vk/init.c @@ -25,6 +25,14 @@ #include #include +#ifdef DEBUG +static const PTK_ARRAY(constcharptr) m_validation_layers = PTK_ARRAY_NEW(constcharptr, { + "VK_LAYER_KHRONOS_validation" +}); +#else +static const PTK_ARRAY(constcharptr) m_validation_layers = PTK_ARRAY_EMPTY(constcharptr); +#endif + static VkInstance m_instance; static VkDevice m_dev; static VkPhysicalDevice m_physical_dev; @@ -67,13 +75,8 @@ static VkRenderPass m_render_pass; static VkDescriptorPool m_descriptor_pool; static PTK_LIST(VkDescriptorSet) m_descriptor_sets; -#ifdef DEBUG -static const PTK_ARRAY(constcharptr) m_validation_layers = PTK_ARRAY_NEW(constcharptr, { - "VK_LAYER_KHRONOS_validation" -}); -#else -static const PTK_ARRAY(constcharptr) m_validation_layers = PTK_ARRAY_EMPTY(constcharptr); -#endif +static bool m_framebuffer_resized = false; +static uint32_t m_current_frame = 0; bool vk_transfer_vertex_data(void) { PTK_DEBUG("vertices updated!"); @@ -180,6 +183,11 @@ static void mouse_button_callback(GLFWwindow *window, int button, int action, in vk_handle_mouse_button_input((PtkPos){ .x = x, .y = y }, button, action, mods); } +static void framebuffer_resized(GLFWwindow *window, int width, int height) { + (void)window; (void)width; (void)height; + m_framebuffer_resized = true; +} + bool vk_init(GLFWwindow *window, const size_t width, const size_t height, const char *title, const PtkVersion version) { m_window = window; m_uniform_buffer_object.initial_window_size.w = width; @@ -187,7 +195,7 @@ bool vk_init(GLFWwindow *window, const size_t width, const size_t height, const vk_init_vertices(); - glfwSetFramebufferSizeCallback(window, vk_framebuffer_resized); + glfwSetFramebufferSizeCallback(window, framebuffer_resized); glfwSetMouseButtonCallback(window, mouse_button_callback); PTK_OPTION(VkInstance) instance_opt = vk_instance_create(title, version, m_validation_layers); @@ -364,14 +372,6 @@ bool vk_is_done(void) { return glfwWindowShouldClose(m_window); } -static bool m_framebuffer_resized = false; -static uint32_t m_current_frame = 0; - -void vk_framebuffer_resized(GLFWwindow *window, int width, int height) { - (void)window; (void)width; (void)height; - m_framebuffer_resized = true; -} - uint32_t vk_current_frame(void) { return m_current_frame; } diff --git a/src/ptk_vk/init.h b/src/ptk_vk/init.h index 47f61c4..f1a1fcc 100644 --- a/src/ptk_vk/init.h +++ b/src/ptk_vk/init.h @@ -16,8 +16,6 @@ bool vk_init(GLFWwindow *window, const size_t width, const size_t height, const bool vk_is_done(void); -void vk_framebuffer_resized(GLFWwindow *window, int width, int height); - uint32_t vk_current_frame(void); bool vk_draw_frame(void);