#include #include "cq.h" #include "../lib/cglm/include/cglm/cglm.h" #pragma once #define MAX_FRAMES_IN_FLIGHT 2 typedef struct { mat4 model; mat4 view; mat4 proj; } UniformBufferObject; typedef struct { } frame_data; typedef struct state { int window_w, window_h; int cell_w, cell_h; int grid_w, grid_h; int char_w, char_h; int char_x, char_y; UniformBufferObject ubo; float x; int zoom; SDL_Window* sdl_window; VkInstance vk_instance; VkDebugUtilsMessengerEXT vk_debug_messenger; PFN_vkCreateDebugUtilsMessengerEXT pfnCreateDebugUtilsMessengerEXT; PFN_vkDestroyDebugUtilsMessengerEXT pfnDestroyDebugUtilsMessengerEXT; VkPhysicalDevice vk_physical_device; VkDevice vk_device; VkQueue vk_graphics_queue; VkSurfaceKHR vk_surface; VkQueue vk_present_queue; VkSwapchainKHR vk_swap_chain; uint32_t vk_swap_chain_image_count; // LIST vk_swap_chain_images; // VkImage VkImage vk_swap_chain_images[1024]; VkFormat vk_swap_chain_image_format; VkExtent2D vk_swap_chain_extent; //LIST vk_swap_chain_image_views; // VkImageView VkImageView vk_swap_chain_image_views[1000]; VkRenderPass vk_render_pass; VkDescriptorSetLayout vk_descriptor_set_layout; VkPipelineLayout vk_pipeline_layout; VkPipeline vk_graphics_pipeline; VkFramebuffer vk_swap_chain_framebuffers[1000]; uint32_t vk_swap_chain_framebuffers_count; VkCommandPool vk_command_pool; VkCommandBuffer vk_command_buffers[MAX_FRAMES_IN_FLIGHT]; VkSemaphore imageAvailableSemaphores[MAX_FRAMES_IN_FLIGHT]; VkSemaphore renderFinishedSemaphores[MAX_FRAMES_IN_FLIGHT]; VkFence inFlightFences[MAX_FRAMES_IN_FLIGHT]; VkBuffer vk_uniform_buffers[MAX_FRAMES_IN_FLIGHT]; VkDeviceMemory vk_uniform_buffers_memory[MAX_FRAMES_IN_FLIGHT]; void * vk_uniform_buffers_mapped[MAX_FRAMES_IN_FLIGHT]; VkBuffer vk_vertex_buffer; VkDeviceMemory vk_vertex_buffer_memory; VkBuffer vk_index_buffer; VkDeviceMemory vk_index_buffer_memory; VkDescriptorPool vk_descriptor_pool; VkDescriptorSet vk_descriptor_sets[MAX_FRAMES_IN_FLIGHT]; LIST test; } state_t ; void init_state(state_t * s) { s->window_w = 800; s->window_h = 600; s->cell_w = 10; s->cell_h = 10; s->grid_w = 0; s->grid_h = 0; s->char_w = 0; s->char_h = 0; s->char_x = 0; s->char_y = 0; s->zoom = 10; s->x = 0.0f; s->sdl_window = NULL; s->vk_swap_chain_image_count = 0; s->vk_physical_device = VK_NULL_HANDLE; s->vk_swap_chain_framebuffers_count = 0; list_init(VkImage *, s->test, 1024); }