Changeset 6bac215 in opengl-game for sdl-game.hpp
- Timestamp:
- Jun 9, 2021, 12:38:14 AM (3 years ago)
- Branches:
- feature/imgui-sdl
- Children:
- bb76950
- Parents:
- 8dcbf62
- git-author:
- Dmitry Portnoy <dportnoy@…> (06/09/21 00:38:09)
- git-committer:
- Dmitry Portnoy <dportnoy@…> (06/09/21 00:38:14)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sdl-game.hpp
r8dcbf62 r6bac215 348 348 GraphicsPipeline_Vulkan<VertexType>& pipeline, VkCommandPool commandPool, 349 349 VkQueue graphicsQueue) { 350 size_t numObjects = buffer.numObjects < buffer.capacity ? buffer.numObjects : buffer.capacity; 351 352 do { 353 buffer.capacity *= 2; 354 } while (buffer.capacity < buffer.numObjects); 355 356 VkDeviceSize bufferSize = buffer.capacity * sizeof(SSBOType); 350 VkDeviceSize newSize = buffer.capacity * sizeof(SSBOType); 357 351 358 352 for (size_t i = 0; i < set.buffers.size(); i++) { 359 VkBuffer newStorageBuffer; 360 VkDeviceMemory newStorageBufferMemory; 361 362 VulkanUtils::createBuffer(device, physicalDevice, bufferSize, 363 VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, 364 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT, 365 newStorageBuffer, newStorageBufferMemory); 366 367 VulkanUtils::copyBuffer(device, commandPool, set.buffers[i], newStorageBuffer, 368 0, 0, numObjects * sizeof(SSBOType), graphicsQueue); 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); 369 360 370 361 vkDestroyBuffer(device, set.buffers[i], nullptr); 371 362 vkFreeMemory(device, set.memory[i], nullptr); 372 363 373 set.buffers[i] = new StorageBuffer;374 set.memory[i] = new StorageBufferMemory;364 set.buffers[i] = newBuffer; 365 set.memory[i] = newMemory; 375 366 376 367 set.infoSet[i].buffer = set.buffers[i]; 377 368 set.infoSet[i].offset = 0; // This is the offset from the start of the buffer, so always 0 for now 378 set.infoSet[i].range = bufferSize; // Size of the update starting from offset, or VK_WHOLE_SIZE369 set.infoSet[i].range = newSize; // Size of the update starting from offset, or VK_WHOLE_SIZE 379 370 } 380 371
Note:
See TracChangeset
for help on using the changeset viewer.