Changeset b794178 in opengl-game for graphics-pipeline_vulkan.hpp


Ignore:
Timestamp:
Oct 17, 2019, 9:30:18 PM (5 years ago)
Author:
Dmitry Portnoy <dmitry.portnoy@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
e83b155
Parents:
771b33a
Message:

In vulkangame, add the ability to create vulkan resoirces and descriptor sets for shader uniforms (images and ubos)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • graphics-pipeline_vulkan.hpp

    r771b33a rb794178  
    88#include <vulkan/vulkan.h>
    99
     10// TODO: Maybe change the name of this struct so I can call the list something other than descriptorInfoList
     11struct 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
    1020class GraphicsPipeline_Vulkan : public GraphicsPipeline {
    1121   public:
    12       GraphicsPipeline_Vulkan(VkDevice device, Viewport viewport, int vertexSize);
     22      GraphicsPipeline_Vulkan(VkDevice device, VkRenderPass renderPass, Viewport viewport, int vertexSize);
    1323      ~GraphicsPipeline_Vulkan();
    1424
     25      // Maybe I should rename these to addVertexAttribute (addVaryingAttribute) and addUniformAttribute
     26
    1527      void addAttribute(VkFormat format, size_t offset);
     28
     29      void addDescriptorInfo(VkDescriptorType type, VkShaderStageFlags stageFlags, vector<VkDescriptorBufferInfo>* bufferData);
     30      void addDescriptorInfo(VkDescriptorType type, VkShaderStageFlags stageFlags, VkDescriptorImageInfo* imageData);
     31
    1632      void createPipeline(string vertShaderFile, string fragShaderFile);
     33      void createDescriptorSetLayout();
     34      void createDescriptorPool(vector<VkImage>& swapChainImages);
     35      void createDescriptorSets(vector<VkImage>& swapChainImages);
     36
     37      void cleanup();
     38      void cleanupBuffers();
    1739   
    1840   private:
    19       VkDevice device;
    20       VkVertexInputBindingDescription bindingDescription;
    21       vector<VkVertexInputAttributeDescription> attributeDescriptions;
    22 
    2341      VkShaderModule createShaderModule(const vector<char>& code);
    2442      vector<char> readFile(const string& filename);
     43
     44      VkDevice device;
     45      VkRenderPass renderPass;
     46
     47      VkPipeline pipeline;
     48      VkPipelineLayout pipelineLayout;
     49
     50      VkVertexInputBindingDescription bindingDescription;
     51
     52      vector<VkVertexInputAttributeDescription> attributeDescriptions;
     53      vector<DescriptorInfo> descriptorInfoList;
     54
     55      VkDescriptorSetLayout descriptorSetLayout;
     56      VkDescriptorPool descriptorPool;
     57      vector<VkDescriptorSet> descriptorSets;
    2558};
    2659
Note: See TracChangeset for help on using the changeset viewer.