#ifndef PIPELINE_H #define PIPELINE_H #include "vulkan/vulkan_core.h" #include "cglm/types.h" #include "vk_mem_alloc.h" #include "command.h" typedef struct GraphicsPipelineStruct { VkPipelineLayout layout; VkPipeline pipeline; } GraphicsPipeline; typedef struct ColoredRectStruct { vec3 pos; vec2 size; vec4 color; } ColoredRect; typedef struct UIUniformStruct { mat4 screen; } UIUniform; typedef struct TextStruct { vec3 pos; vec2 size; vec4 color; uint32_t code; } Text; typedef struct FontUniformStruct { vec2 size; uint32_t columns; uint32_t start; } FontUniform; typedef struct UILayerStruct { VkBuffer colored_rects; uint32_t colored_rect_count; VkBuffer textured_rects; uint32_t textured_rect_count; VkDescriptorSet textured_rect_descriptor; VkBuffer texts; uint32_t text_count; VkDescriptorSet text_descriptor; } UILayer; typedef struct FontDataStruct { FontUniform info; uint32_t rows; vec4* data; } FontData; struct RectBuffer { VkBuffer vertex; VkBuffer index; VmaAllocation vertex_memory; VmaAllocation index_memory; }; typedef struct UIContextStruct { VkBuffer ui_descriptor_buffer; VmaAllocation ui_descriptor_memory; VkDescriptorSetLayout ui_descriptor_layout; VkDescriptorPool ui_descriptor_pool; VkDescriptorSet ui_descriptor_set; VkDescriptorPool font_pool; VkDescriptorSetLayout font_layout; VmaAllocation test_font_uniform_memory; VmaAllocation test_font_image_memory; VkBuffer test_font_uniform; VkImage test_font_image; VkImageView test_font_view; VkSampler test_font_sampler; VkDescriptorSet test_font_set; struct RectBuffer ui_rect; GraphicsPipeline ui_pipeline_rect; GraphicsPipeline ui_pipeline_text; } UIContext; VkResult init_pipelines(VkDevice device, VmaAllocator allocator, VkExtent2D swapchain_extent, VkRenderPass render_pass, Queue transfer_queue, VkCommandPool transfer_pool, UIContext* context); #endif