|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <glm/mat4x4.hpp>
|
|
|
|
#include <vulkan/vulkan.h>
|
|
|
|
|
|
|
|
class Instance;
|
|
|
|
class Buffer;
|
|
|
|
|
|
|
|
struct UniformBufferObject {
|
|
|
|
alignas(16) glm::mat4 model;
|
|
|
|
glm::mat4 view;
|
|
|
|
glm::mat4 projection;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class Pipeline {
|
|
|
|
public:
|
|
|
|
explicit Pipeline();
|
|
|
|
explicit Pipeline(VkRenderPass renderPass);
|
|
|
|
~Pipeline();
|
|
|
|
VkPipeline handle = VK_NULL_HANDLE;
|
|
|
|
VkPipelineLayout layout = VK_NULL_HANDLE;
|
|
|
|
VkDescriptorSet descriptorSet = VK_NULL_HANDLE;
|
|
|
|
|
|
|
|
void updateDescriptor(uint32_t binding, Buffer* buffer, VkDescriptorType type);
|
|
|
|
protected:
|
|
|
|
|
|
|
|
VkShaderModule createShaderModule(const std::vector<char> &code);
|
|
|
|
|
|
|
|
VkDescriptorPool descriptorPool = VK_NULL_HANDLE;
|
|
|
|
VkDescriptorSetLayout descriptorSetLayout = VK_NULL_HANDLE;
|
|
|
|
|
|
|
|
void createDescriptorSetLayout();
|
|
|
|
void createDescriptorPool(VkDescriptorType type);
|
|
|
|
void allocateDescriptorSet();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
class ComputePipeline : public Pipeline {
|
|
|
|
public:
|
|
|
|
explicit ComputePipeline();
|
|
|
|
void updateDescriptor(uint32_t binding, Buffer* buffer);
|
|
|
|
};
|