#ifndef _RENDERER_H_ #define _RENDERER_H_ #include #include #include #include "buffer.h" #include "utils.h" #define MAX_FRAMES 3 struct vlkn_renderer { struct vlkn_window *win; VkInstance instance; VkSurfaceKHR surface; struct { uint32_t cap, len; struct phy_gpu { VkPhysicalDevice gpu; size_t graphics_queue; size_t present_queue; struct surface_caps { VkSurfaceCapabilitiesKHR caps; struct { uint32_t len; VkSurfaceFormatKHR *data; } formats; struct { uint32_t len; VkPresentModeKHR *data; } present_modes; } surface_caps; } *gpus; struct phy_gpu *chosen; } phy_gpus; struct { VkDevice device; VkQueue gfx_queue; VkQueue present_queue; } gpu; struct { VkSwapchainKHR swapchain; VkFormat format; VkExtent2D extent; struct { uint32_t len; struct { VkImage image; VkImageView view; VkFramebuffer framebuffer; } *data; } images; } swapchain; struct { VkCommandPool pool; VkCommandBuffer buffers[MAX_FRAMES]; } command; struct { VkPipelineLayout layout; VkPipeline gfx; VkPipeline transp; VkPipeline blend; } pipeline; struct { VkSemaphore image_available[MAX_FRAMES]; VkSemaphore render_finished[MAX_FRAMES]; VkFence in_flight[MAX_FRAMES]; } locks; struct vlkn_images depth; /* struct { VkDescriptorSetLayout layout; VkDescriptorPool pool; struct descriptor_allocator allocator; VkDescriptorSet sets[MAX_FRAMES]; } descriptor; struct { struct buffer buffer; void *data; } uniform[MAX_FRAMES]; */ VkRenderPass render_pass; uint32_t current_frame; }; #endif