Changeset 87c8f1a in opengl-game for graphics-pipeline_vulkan.hpp
- Timestamp:
- Nov 1, 2019, 5:11:45 PM (5 years ago)
- Branches:
- feature/imgui-sdl, master, points-test
- Children:
- d2d9286
- Parents:
- 34bdf3a
- git-author:
- Dmitry Portnoy <dmitry.portnoy@…> (11/01/19 17:09:16)
- git-committer:
- Dmitry Portnoy <dmitry.portnoy@…> (11/01/19 17:11:45)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
graphics-pipeline_vulkan.hpp
r34bdf3a r87c8f1a 20 20 class GraphicsPipeline_Vulkan : public GraphicsPipeline { 21 21 public: 22 GraphicsPipeline_Vulkan(VkDevice device, VkRenderPass renderPass, Viewport viewport, int vertexSize); 22 GraphicsPipeline_Vulkan(VkPhysicalDevice physicalDevice, VkDevice device, VkRenderPass renderPass, 23 Viewport viewport, int vertexSize); 23 24 ~GraphicsPipeline_Vulkan(); 25 26 template<class VertexType, class IndexType> 27 void bindData(const vector<VertexType>& vertices, const vector<IndexType>& indices, 28 VkCommandPool commandPool, VkQueue graphicsQueue); 29 30 void createVertexBuffer(const void* bufferData, int vertexSize, VkCommandPool commandPool, 31 VkQueue graphicsQueue); 32 void createIndexBuffer(const void* bufferData, int indexSize, VkCommandPool commandPool, 33 VkQueue graphicsQueue); 24 34 25 35 // Maybe I should rename these to addVertexAttribute (addVaryingAttribute) and addUniformAttribute … … 44 54 vector<char> readFile(const string& filename); 45 55 56 VkPhysicalDevice physicalDevice; 46 57 VkDevice device; 47 58 VkRenderPass renderPass; … … 58 69 VkDescriptorPool descriptorPool; 59 70 vector<VkDescriptorSet> descriptorSets; 71 72 size_t numVertices; 73 size_t vertexCapacity; 74 VkBuffer vertexBuffer; 75 VkDeviceMemory vertexBufferMemory; 76 77 size_t numIndices; 78 size_t indexCapacity; 79 VkBuffer indexBuffer; 80 VkDeviceMemory indexBufferMemory; 60 81 }; 61 82 83 // TODO: Probably better to template the whole class and to also combine this function 84 // and the constructor since I call this right after the constructor anyway 85 template<class VertexType, class IndexType> 86 void GraphicsPipeline_Vulkan::bindData(const vector<VertexType>& vertices, const vector<IndexType>& indices, 87 VkCommandPool commandPool, VkQueue graphicsQueue) { 88 numVertices = vertices.size(); 89 vertexCapacity = numVertices * 2; 90 createVertexBuffer(vertices.data(), sizeof(VertexType), commandPool, graphicsQueue); 91 92 numIndices = indices.size(); 93 indexCapacity = numIndices * 2; 94 createIndexBuffer(indices.data(), sizeof(IndexType), commandPool, graphicsQueue); 95 } 96 62 97 #endif // _GRAPHICS_PIPELINE_VULKAN_H
Note:
See TracChangeset
for help on using the changeset viewer.