Changeset f97c5e7 in opengl-game for vulkan-game.hpp
- Timestamp:
- Nov 22, 2019, 7:58:45 PM (5 years ago)
- Branches:
- feature/imgui-sdl, master, points-test
- Children:
- aa00bf2
- Parents:
- 8e02b6b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vulkan-game.hpp
r8e02b6b rf97c5e7 88 88 VkSampler textureSampler; 89 89 90 vector<VkDescriptorBufferInfo> uniformBufferInfoList;91 92 90 // These are currently to store the MVP matrix 93 91 // I should figure out if it makes sense to use them for other uniforms in the future 94 92 // If not, I should rename them to better indicate their purpose. 95 // I should also decide if I can use these for all shaders, or if I need a separapte set of buffers for each one96 93 vector<VkBuffer> uniformBuffers; 97 94 vector<VkDeviceMemory> uniformBuffersMemory; 95 96 vector<VkDescriptorBufferInfo> uniformBufferInfoList; 98 97 99 98 VulkanImage floorTextureImage; … … 118 117 bool initWindow(int width, int height, unsigned char guiFlags); 119 118 void initVulkan(); 119 void initGraphicsPipelines(); 120 120 void initMatrices(); 121 121 void mainLoop(); … … 143 143 void createTextureSampler(); 144 144 void createFramebuffers(); 145 void createUniformBuffers();146 145 void createCommandBuffers(); 147 146 void createSyncObjects(); 147 148 template<class UniformType> 149 void createUniformBuffers(vector<VkBuffer>& buffers, vector<VkDeviceMemory>& buffersMemory, 150 vector<VkDescriptorBufferInfo>& bufferInfoList); 148 151 149 152 void recreateSwapChain(); … … 158 161 }; 159 162 163 template<class UniformType> 164 void VulkanGame::createUniformBuffers(vector<VkBuffer>& buffers, vector<VkDeviceMemory>& buffersMemory, 165 vector<VkDescriptorBufferInfo>& bufferInfoList) { 166 buffers.resize(swapChainImages.size()); 167 buffersMemory.resize(swapChainImages.size()); 168 bufferInfoList.resize(swapChainImages.size()); 169 170 for (size_t i = 0; i < swapChainImages.size(); i++) { 171 VulkanUtils::createBuffer(device, physicalDevice, sizeof(UniformType), VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, 172 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT, 173 buffers[i], buffersMemory[i]); 174 175 bufferInfoList[i].buffer = buffers[i]; 176 bufferInfoList[i].offset = 0; 177 bufferInfoList[i].range = sizeof(UniformType); 178 } 179 } 180 160 181 #endif // _VULKAN_GAME_H
Note:
See TracChangeset
for help on using the changeset viewer.