53 lines
1.4 KiB
C
53 lines
1.4 KiB
C
#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 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;
|
|
|
|
struct RectBuffer {
|
|
VkBuffer vertex;
|
|
VkBuffer index;
|
|
|
|
VmaAllocation vertex_memory;
|
|
VmaAllocation index_memory;
|
|
};
|
|
|
|
VkResult create_ui_colored_rect_pipeline(VkDevice device, VkRenderPass render_pass, VkDescriptorSetLayout descriptor_layout, GraphicsPipeline* pipeline);
|
|
|
|
|
|
VkResult create_ui_descriptor_set(VkDevice device, VmaAllocator allocator, VkExtent2D swapchain_extent, VkDescriptorSetLayout* ui_descriptor_layout, VkDescriptorPool* ui_descriptor_pool, VkDescriptorSet* ui_descriptor_set, VmaAllocation* ui_descriptor_memory, VkBuffer* ui_descriptor_buffer);
|
|
|
|
VkResult create_ui_rect_buffer(VkDevice device, Queue transfer_queue, VkCommandPool transfer_pool, VmaAllocator allocator, struct RectBuffer* buf);
|
|
|
|
#endif
|