some more cleanup

This commit is contained in:
jacekpoz 2024-10-04 16:37:57 +02:00
parent 63b841fe63
commit 960d1247f7
Signed by: poz
SSH key fingerprint: SHA256:JyLeVWE4bF3tDnFeUpUaJsPsNlJyBldDGV/dIKSLyN8
2 changed files with 16 additions and 18 deletions

View file

@ -25,6 +25,14 @@
#include <stdio.h>
#include <string.h>
#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;
}

View file

@ -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);