Changeset b8072d3 in opengl-game for sdl-game.cpp
- Timestamp:
- May 1, 2021, 6:10:37 PM (3 years ago)
- Branches:
- feature/imgui-sdl
- Children:
- 756162f
- Parents:
- e8445f0
- git-author:
- Dmitry Portnoy <dportnoy@…> (04/22/21 02:28:49)
- git-committer:
- Dmitry Portnoy <dportnoy@…> (05/01/21 18:10:37)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sdl-game.cpp
re8445f0 rb8072d3 78 78 79 79 void VulkanGame::run(int width, int height, unsigned char guiFlags) { 80 cout << "Vulkan Game" << endl; 81 80 82 cout << "DEBUGGING IS " << (ENABLE_VALIDATION_LAYERS ? "ON" : "OFF") << endl; 81 82 cout << "Vulkan Game" << endl;83 83 84 84 if (initUI(width, height, guiFlags) == RTWO_ERROR) { … … 103 103 modelPipeline.addAttribute(VK_FORMAT_R32_UINT, offset_of(&ModelVertex::objIndex)); 104 104 105 createBufferSet(sizeof(UBO_VP_mats), VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, 106 uniformBuffers_modelPipeline, uniformBuffersMemory_modelPipeline, uniformBufferInfoList_modelPipeline); 105 createBufferSet(uniformBuffers_modelPipeline, uniformBuffersMemory_modelPipeline, sizeof(UBO_VP_mats), 106 VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT, 107 uniformBufferInfoList_modelPipeline); 107 108 108 109 modelPipeline.addDescriptorInfo(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, … … 113 114 114 115 SceneObject<ModelVertex, SSBO_ModelObject>* texturedSquare = nullptr; 116 117 // TODO: Ideally, avoid having to make the squares as modified upon creation 115 118 116 119 texturedSquare = &addObject(modelObjects, modelPipeline, … … 1080 1083 } 1081 1084 1082 void VulkanGame::createBufferSet( VkDeviceSize bufferSize, VkBufferUsageFlags flags,1083 vector<VkBuffer>& buffers, vector<VkDeviceMemory>& buffersMemory,1085 void VulkanGame::createBufferSet(vector<VkBuffer>& buffers, vector<VkDeviceMemory>& buffersMemory, 1086 VkDeviceSize bufferSize, VkBufferUsageFlags flags, VkMemoryPropertyFlags properties, 1084 1087 vector<VkDescriptorBufferInfo>& bufferInfoList) { 1085 1088 buffers.resize(swapChainImageCount); … … 1088 1091 1089 1092 for (size_t i = 0; i < swapChainImageCount; i++) { 1090 VulkanUtils::createBuffer(device, physicalDevice, bufferSize, flags, 1091 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT, 1092 buffers[i], buffersMemory[i]); 1093 VulkanUtils::createBuffer(device, physicalDevice, bufferSize, flags, properties, buffers[i], buffersMemory[i]); 1093 1094 1094 1095 bufferInfoList[i].buffer = buffers[i]; … … 1229 1230 // instead of recreated every time 1230 1231 1231 createBufferSet(sizeof(UBO_VP_mats), VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, 1232 uniformBuffers_modelPipeline, uniformBuffersMemory_modelPipeline, uniformBufferInfoList_modelPipeline); 1232 createBufferSet(uniformBuffers_modelPipeline, uniformBuffersMemory_modelPipeline, sizeof(UBO_VP_mats), 1233 VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT, 1234 uniformBufferInfoList_modelPipeline); 1233 1235 1234 1236 modelPipeline.updateRenderPass(renderPass);
Note:
See TracChangeset
for help on using the changeset viewer.