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