Changeset bb76950 in opengl-game for vulkan-game.hpp
- Timestamp:
- Jun 9, 2021, 6:41:48 PM (4 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
-
vulkan-game.hpp
r6bac215 rbb76950 124 124 vec3 center; // currently only matters for asteroids 125 125 float radius; // currently only matters for asteroids 126 127 // Move the targetAsteroid stuff out of this class since it is very specific to lasers 128 // and makes moving SceneObject into its own header file more problematic 126 129 SceneObject<ModelVertex, SSBO_Asteroid>* targetAsteroid; // currently only used for lasers 127 130 }; … … 432 435 BufferSet& set); 433 436 434 template<class VertexType, class SSBOType> 435 void resizeBufferSet(BufferSet& set, VulkanBuffer<SSBOType>& buffer, 436 GraphicsPipeline_Vulkan<VertexType>& pipeline, VkCommandPool commandPool, 437 VkQueue graphicsQueue); 437 void resizeBufferSet(BufferSet& set, VkDeviceSize newSize, VkCommandPool commandPool, VkQueue graphicsQueue, 438 bool copyData); 438 439 439 440 template<class SSBOType> … … 498 499 499 500 // End of specialized no-op functions 500 501 template<class VertexType, class SSBOType>502 void VulkanGame::resizeBufferSet(BufferSet& set, VulkanBuffer<SSBOType>& buffer,503 GraphicsPipeline_Vulkan<VertexType>& pipeline, VkCommandPool commandPool,504 VkQueue graphicsQueue) {505 VkDeviceSize newSize = buffer.capacity * sizeof(SSBOType);506 507 for (size_t i = 0; i < set.buffers.size(); i++) {508 VkBuffer newBuffer;509 VkDeviceMemory newMemory;510 511 VulkanUtils::createBuffer(device, physicalDevice, newSize, set.usages, set.properties, newBuffer, newMemory);512 513 VulkanUtils::copyBuffer(device, commandPool, set.buffers[i], newBuffer, 0, 0, set.infoSet[i].range,514 graphicsQueue);515 516 vkDestroyBuffer(device, set.buffers[i], nullptr);517 vkFreeMemory(device, set.memory[i], nullptr);518 519 set.buffers[i] = newBuffer;520 set.memory[i] = newMemory;521 522 set.infoSet[i].buffer = set.buffers[i];523 set.infoSet[i].offset = 0; // This is the offset from the start of the buffer, so always 0 for now524 set.infoSet[i].range = newSize; // Size of the update starting from offset, or VK_WHOLE_SIZE525 }526 527 // Assume the SSBO is always the 2nd binding528 // TODO: Figure out a way to make this more flexible529 pipeline.updateDescriptorInfo(1, &set.infoSet, swapChainImages.size());530 }531 501 532 502 // 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.