You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.0 KiB
43 lines
1.0 KiB
#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, uint32_t descriptorCount);
|
|
void allocateDescriptorSet();
|
|
|
|
};
|
|
|
|
class ComputePipeline : public Pipeline {
|
|
public:
|
|
explicit ComputePipeline(const std::string& shaderFile, uint32_t bindings);
|
|
void updateDescriptor(uint32_t binding, Buffer* buffer);
|
|
}; |