Changeset c163d81 in opengl-game for sdl-game.cpp
- Timestamp:
- May 19, 2021, 7:16:37 PM (4 years ago)
- Branches:
- feature/imgui-sdl
- Children:
- 58453c3
- Parents:
- 1abebc1
- git-author:
- Dmitry Portnoy <dportnoy@…> (05/19/21 19:16:33)
- git-committer:
- Dmitry Portnoy <dportnoy@…> (05/19/21 19:16:37)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sdl-game.cpp
r1abebc1 rc163d81 111 111 createBufferSet(sizeof(UBO_VP_mats), 112 112 VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT, 113 uniformBuffers_modelPipeline , uniformBuffersMemory_modelPipeline, uniformBufferInfoList_modelPipeline);113 uniformBuffers_modelPipeline); 114 114 115 115 modelPipeline.addDescriptorInfo(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 116 VK_SHADER_STAGE_VERTEX_BIT, &uniformBuffer InfoList_modelPipeline);116 VK_SHADER_STAGE_VERTEX_BIT, &uniformBuffers_modelPipeline.infoSet); 117 117 modelPipeline.addDescriptorInfo(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 118 118 VK_SHADER_STAGE_VERTEX_BIT, &storageBuffers_modelPipeline.infoSet); … … 275 275 VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, 276 276 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT, 277 storageBuffers_modelPipeline.buffers, storageBuffers_modelPipeline.memory, 278 storageBuffers_modelPipeline.infoSet); 277 storageBuffers_modelPipeline); 279 278 } 280 279 … … 473 472 updateObject(modelObjects[i]); 474 473 updateBufferSet(storageBuffers_modelPipeline, i, modelObjects[i].ssbo); 475 476 } 477 } 478 479 VulkanUtils::copyDataToMemory(device, object_VP_mats, uniformBuffersMemory_modelPipeline[imageIndex], 0); 474 } 475 } 476 477 VulkanUtils::copyDataToMemory(device, object_VP_mats, uniformBuffers_modelPipeline.memory[imageIndex], 0); 480 478 } 481 479 … … 1117 1115 1118 1116 void VulkanGame::createBufferSet(VkDeviceSize bufferSize, VkBufferUsageFlags flags, VkMemoryPropertyFlags properties, 1119 vector<VkBuffer>& buffers, vector<VkDeviceMemory>& buffersMemory, 1120 vector<VkDescriptorBufferInfo>& bufferInfoList) { 1121 buffers.resize(swapChainImageCount); 1122 buffersMemory.resize(swapChainImageCount); 1123 bufferInfoList.resize(swapChainImageCount); 1117 BufferSet& set) { 1118 set.buffers.resize(swapChainImageCount); 1119 set.memory.resize(swapChainImageCount); 1120 set.infoSet.resize(swapChainImageCount); 1124 1121 1125 1122 for (size_t i = 0; i < swapChainImageCount; i++) { 1126 VulkanUtils::createBuffer(device, physicalDevice, bufferSize, flags, properties, buffers[i], buffersMemory[i]);1127 1128 bufferInfoList[i].buffer =buffers[i];1129 bufferInfoList[i].offset = 0; // This is the offset from the start of the buffer, so always 0 for now1130 bufferInfoList[i].range = bufferSize; // Size of the update starting from offset, or VK_WHOLE_SIZE1123 VulkanUtils::createBuffer(device, physicalDevice, bufferSize, flags, properties, set.buffers[i], set.memory[i]); 1124 1125 set.infoSet[i].buffer = set.buffers[i]; 1126 set.infoSet[i].offset = 0; // This is the offset from the start of the buffer, so always 0 for now 1127 set.infoSet[i].range = bufferSize; // Size of the update starting from offset, or VK_WHOLE_SIZE 1131 1128 } 1132 1129 } … … 1265 1262 createBufferSet(sizeof(UBO_VP_mats), 1266 1263 VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT, 1267 uniformBuffers_modelPipeline , uniformBuffersMemory_modelPipeline, uniformBufferInfoList_modelPipeline);1264 uniformBuffers_modelPipeline); 1268 1265 1269 1266 modelPipeline.updateRenderPass(renderPass); … … 1289 1286 modelPipeline.cleanup(); 1290 1287 1291 for (size_t i = 0; i < uniformBuffers_modelPipeline. size(); i++) {1292 vkDestroyBuffer(device, uniformBuffers_modelPipeline [i], nullptr);1293 vkFreeMemory(device, uniformBuffers Memory_modelPipeline[i], nullptr);1288 for (size_t i = 0; i < uniformBuffers_modelPipeline.buffers.size(); i++) { 1289 vkDestroyBuffer(device, uniformBuffers_modelPipeline.buffers[i], nullptr); 1290 vkFreeMemory(device, uniformBuffers_modelPipeline.memory[i], nullptr); 1294 1291 } 1295 1292
Note:
See TracChangeset
for help on using the changeset viewer.