Changes in graphics-pipeline_vulkan.hpp [5049354:e8445f0] in opengl-game
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
graphics-pipeline_vulkan.hpp
r5049354 re8445f0 32 32 }; 33 33 34 // TODO: Use this struct for uniform buffers as well (maybe move it to VulkanUtils) 34 // TODO: Use this struct for uniform buffers as well and rename it to VulkanBuffer (maybe move it to VulkanUtils) 35 // Also, probably better to make this a vector of structs where each struct 36 // has a VkBuffer, VkDeviceMemory, and VkDescriptorBufferInfo 35 37 struct StorageBufferSet { 36 38 vector<VkBuffer> buffers; … … 64 66 void addStorageDescriptor(VkShaderStageFlags stageFlags); 65 67 66 void addDescriptorInfo(VkDescriptorType type, VkShaderStageFlags stageFlags, vector<VkDescriptorBufferInfo>* bufferData); 68 // TODO: I might be able to use a single VkDescriptorBufferInfo here and reuse it when creating the descriptor sets 69 void addDescriptorInfo(VkDescriptorType type, VkShaderStageFlags stageFlags, 70 vector<VkDescriptorBufferInfo>* bufferData); 67 71 void addDescriptorInfo(VkDescriptorType type, VkShaderStageFlags stageFlags, VkDescriptorImageInfo* imageData); 68 72 … … 75 79 76 80 bool addObject(const vector<VertexType>& vertices, vector<uint16_t> indices, SSBOType& ssbo, 77 VkCommandPool commandPool, VkQueue graphicsQueue);81 VkCommandPool commandPool, VkQueue graphicsQueue); 78 82 79 83 void updateObject(size_t objIndex, SSBOType& ssbo); 80 84 81 85 void updateObjectVertices(size_t objIndex, const vector<VertexType>& vertices, VkCommandPool commandPool, 82 VkQueue graphicsQueue);86 VkQueue graphicsQueue); 83 87 84 88 void cleanup(); … … 456 460 switch (descriptorWrites[j].descriptorType) { 457 461 case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER: 462 case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC: 458 463 case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER: 459 464 descriptorWrites[j].pBufferInfo = &(*this->descriptorInfoList[j].bufferDataList)[i]; … … 474 479 void GraphicsPipeline_Vulkan<VertexType, SSBOType>::createRenderCommands(VkCommandBuffer& commandBuffer, 475 480 uint32_t currentImage) { 481 476 482 vkCmdBindPipeline(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline); 483 477 484 vkCmdBindDescriptorSets(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayout, 0, 1, 478 485 &descriptorSets[currentImage], 0, nullptr); … … 543 550 } 544 551 552 // TODO: Allow a swapchain index to be passed in instead of updating all of them 553 // Actually, since I'm in the process of replacing SSBOs with dynamic UBOs, I can ignore that for this function 545 554 template<class VertexType, class SSBOType> 546 555 void GraphicsPipeline_Vulkan<VertexType, SSBOType>::updateObject(size_t objIndex, SSBOType& ssbo) { 547 556 if (!is_same_v<SSBOType, void*>) { 548 557 for (size_t i = 0; i < storageBufferSet.memory.size(); i++) { 549 VulkanUtils::copyDataToMemory(this->device, s torageBufferSet.memory[i], objIndex * sizeof(SSBOType), ssbo);558 VulkanUtils::copyDataToMemory(this->device, ssbo, storageBufferSet.memory[i], objIndex * sizeof(SSBOType)); 550 559 } 551 560 }
Note:
See TracChangeset
for help on using the changeset viewer.