[7d2b0b9] | 1 | #ifndef _GRAPHICS_PIPELINE_VULKAN_H
|
---|
| 2 | #define _GRAPHICS_PIPELINE_VULKAN_H
|
---|
| 3 |
|
---|
| 4 | #include "graphics-pipeline.hpp"
|
---|
| 5 |
|
---|
| 6 | #include <vector>
|
---|
| 7 |
|
---|
[771b33a] | 8 | #include <vulkan/vulkan.h>
|
---|
| 9 |
|
---|
[b794178] | 10 | // TODO: Maybe change the name of this struct so I can call the list something other than descriptorInfoList
|
---|
| 11 | struct DescriptorInfo {
|
---|
| 12 | VkDescriptorType type;
|
---|
| 13 | VkShaderStageFlags stageFlags;
|
---|
| 14 |
|
---|
| 15 | // Only one of the below properties should be set
|
---|
| 16 | vector<VkDescriptorBufferInfo>* bufferDataList;
|
---|
| 17 | VkDescriptorImageInfo* imageData;
|
---|
| 18 | };
|
---|
| 19 |
|
---|
[7d2b0b9] | 20 | class GraphicsPipeline_Vulkan : public GraphicsPipeline {
|
---|
| 21 | public:
|
---|
[b794178] | 22 | GraphicsPipeline_Vulkan(VkDevice device, VkRenderPass renderPass, Viewport viewport, int vertexSize);
|
---|
[7d2b0b9] | 23 | ~GraphicsPipeline_Vulkan();
|
---|
| 24 |
|
---|
[b794178] | 25 | // Maybe I should rename these to addVertexAttribute (addVaryingAttribute) and addUniformAttribute
|
---|
| 26 |
|
---|
[771b33a] | 27 | void addAttribute(VkFormat format, size_t offset);
|
---|
[b794178] | 28 |
|
---|
| 29 | void addDescriptorInfo(VkDescriptorType type, VkShaderStageFlags stageFlags, vector<VkDescriptorBufferInfo>* bufferData);
|
---|
| 30 | void addDescriptorInfo(VkDescriptorType type, VkShaderStageFlags stageFlags, VkDescriptorImageInfo* imageData);
|
---|
| 31 |
|
---|
[7d2b0b9] | 32 | void createPipeline(string vertShaderFile, string fragShaderFile);
|
---|
[b794178] | 33 | void createDescriptorSetLayout();
|
---|
| 34 | void createDescriptorPool(vector<VkImage>& swapChainImages);
|
---|
| 35 | void createDescriptorSets(vector<VkImage>& swapChainImages);
|
---|
| 36 |
|
---|
[603b5bc] | 37 | void createRenderCommands(VkCommandBuffer& commandBuffer, uint32_t currentImage);
|
---|
| 38 |
|
---|
[b794178] | 39 | void cleanup();
|
---|
| 40 | void cleanupBuffers();
|
---|
[7d2b0b9] | 41 |
|
---|
| 42 | private:
|
---|
[b794178] | 43 | VkShaderModule createShaderModule(const vector<char>& code);
|
---|
| 44 | vector<char> readFile(const string& filename);
|
---|
| 45 |
|
---|
[7d2b0b9] | 46 | VkDevice device;
|
---|
[b794178] | 47 | VkRenderPass renderPass;
|
---|
| 48 |
|
---|
| 49 | VkPipeline pipeline;
|
---|
| 50 | VkPipelineLayout pipelineLayout;
|
---|
| 51 |
|
---|
[771b33a] | 52 | VkVertexInputBindingDescription bindingDescription;
|
---|
[b794178] | 53 |
|
---|
[771b33a] | 54 | vector<VkVertexInputAttributeDescription> attributeDescriptions;
|
---|
[b794178] | 55 | vector<DescriptorInfo> descriptorInfoList;
|
---|
[7d2b0b9] | 56 |
|
---|
[b794178] | 57 | VkDescriptorSetLayout descriptorSetLayout;
|
---|
| 58 | VkDescriptorPool descriptorPool;
|
---|
| 59 | vector<VkDescriptorSet> descriptorSets;
|
---|
[7d2b0b9] | 60 | };
|
---|
| 61 |
|
---|
| 62 | #endif // _GRAPHICS_PIPELINE_VULKAN_H
|
---|