Changeset bb76950 in opengl-game for sdl-game.hpp
- Timestamp:
- Jun 9, 2021, 6:41:48 PM (3 years ago)
- Branches:
- feature/imgui-sdl
- Children:
- b7fc3c2
- Parents:
- 6bac215
- git-author:
- Dmitry Portnoy <dportnoy@…> (06/09/21 18:41:20)
- git-committer:
- Dmitry Portnoy <dportnoy@…> (06/09/21 18:41:48)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sdl-game.hpp
r6bac215 rbb76950 108 108 vec3 center; // currently only matters for asteroids 109 109 float radius; // currently only matters for asteroids 110 111 // Move the targetAsteroid stuff out of this class since it is very specific to lasers 112 // and makes moving SceneObject into its own header file more problematic 110 113 SceneObject<ModelVertex, SSBO_Asteroid>* targetAsteroid; // currently only used for lasers 111 114 }; … … 297 300 BufferSet& set); 298 301 299 template<class VertexType, class SSBOType> 300 void resizeBufferSet(BufferSet& set, VulkanBuffer<SSBOType>& buffer, 301 GraphicsPipeline_Vulkan<VertexType>& pipeline, VkCommandPool commandPool, 302 VkQueue graphicsQueue); 302 void resizeBufferSet(BufferSet& set, VkDeviceSize newSize, VkCommandPool commandPool, VkQueue graphicsQueue, 303 bool copyData); 303 304 304 305 template<class SSBOType> … … 343 344 void quitGame(); 344 345 }; 345 346 template<class VertexType, class SSBOType>347 void VulkanGame::resizeBufferSet(BufferSet& set, VulkanBuffer<SSBOType>& buffer,348 GraphicsPipeline_Vulkan<VertexType>& pipeline, VkCommandPool commandPool,349 VkQueue graphicsQueue) {350 VkDeviceSize newSize = buffer.capacity * sizeof(SSBOType);351 352 for (size_t i = 0; i < set.buffers.size(); i++) {353 VkBuffer newBuffer;354 VkDeviceMemory newMemory;355 356 VulkanUtils::createBuffer(device, physicalDevice, newSize, set.usages, set.properties, newBuffer, newMemory);357 358 VulkanUtils::copyBuffer(device, commandPool, set.buffers[i], newBuffer, 0, 0, set.infoSet[i].range,359 graphicsQueue);360 361 vkDestroyBuffer(device, set.buffers[i], nullptr);362 vkFreeMemory(device, set.memory[i], nullptr);363 364 set.buffers[i] = newBuffer;365 set.memory[i] = newMemory;366 367 set.infoSet[i].buffer = set.buffers[i];368 set.infoSet[i].offset = 0; // This is the offset from the start of the buffer, so always 0 for now369 set.infoSet[i].range = newSize; // Size of the update starting from offset, or VK_WHOLE_SIZE370 }371 372 // Assume the SSBO is always the 2nd binding373 // TODO: Figure out a way to make this more flexible374 pipeline.updateDescriptorInfo(1, &set.infoSet, swapChainImages.size());375 }376 346 377 347 // TODO: See if it makes sense to pass in the current swapchain index instead of updating all of them
Note:
See TracChangeset
for help on using the changeset viewer.