Index: vulkan-game.cpp
===================================================================
--- vulkan-game.cpp	(revision 9d21aac42227b516c5df135b6ff2266349c321e4)
+++ vulkan-game.cpp	(revision 996dd3efcf576a5eaf4f04878167c007d853dbac)
@@ -126,5 +126,5 @@
       VK_SHADER_STAGE_VERTEX_BIT, &uniformBufferInfoList_modelPipeline);
    modelPipeline.addDescriptorInfo(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
-      VK_SHADER_STAGE_VERTEX_BIT, &modelPipeline.storageBufferSet.infoSet);
+      VK_SHADER_STAGE_VERTEX_BIT, &storageBuffers_modelPipeline.infoSet);
    modelPipeline.addDescriptorInfo(VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
       VK_SHADER_STAGE_FRAGMENT_BIT, &floorTextureImageDescriptor);
@@ -145,5 +145,7 @@
          }, {
             mat4(1.0f)
-         }, false);
+         }, storageBuffers_modelPipeline, false);
+
+   updateStorageBuffer(storageBuffers_modelPipeline, modelPipeline.numObjects - 1, texturedSquare->ssbo);
 
    texturedSquare->model_base =
@@ -164,5 +166,7 @@
          }, {
             mat4(1.0f)
-         }, false);
+         }, storageBuffers_modelPipeline, false);
+
+   updateStorageBuffer(storageBuffers_modelPipeline, modelPipeline.numObjects - 1, texturedSquare->ssbo);
 
    texturedSquare->model_base =
@@ -189,5 +193,5 @@
       VK_SHADER_STAGE_VERTEX_BIT, &uniformBufferInfoList_shipPipeline);
    shipPipeline.addDescriptorInfo(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
-      VK_SHADER_STAGE_VERTEX_BIT, &shipPipeline.storageBufferSet.infoSet);
+      VK_SHADER_STAGE_VERTEX_BIT, &storageBuffers_shipPipeline.infoSet);
 
    // TODO: With the normals, indexing basically becomes pointless since no vertices will have exactly
@@ -424,5 +428,7 @@
       }, {
          mat4(1.0f)
-      }, false);
+      }, storageBuffers_shipPipeline, false);
+
+   updateStorageBuffer(storageBuffers_shipPipeline, shipPipeline.numObjects - 1, ship.ssbo);
 
    ship.model_base =
@@ -449,5 +455,5 @@
       VK_SHADER_STAGE_VERTEX_BIT, &uniformBufferInfoList_asteroidPipeline);
    asteroidPipeline.addDescriptorInfo(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
-      VK_SHADER_STAGE_VERTEX_BIT, &asteroidPipeline.storageBufferSet.infoSet);
+      VK_SHADER_STAGE_VERTEX_BIT, &storageBuffers_asteroidPipeline.infoSet);
 
    asteroidPipeline.createDescriptorSetLayout();
@@ -467,5 +473,5 @@
       VK_SHADER_STAGE_VERTEX_BIT, &uniformBufferInfoList_laserPipeline);
    laserPipeline.addDescriptorInfo(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
-      VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT, &laserPipeline.storageBufferSet.infoSet);
+      VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT, &storageBuffers_laserPipeline.infoSet);
    laserPipeline.addDescriptorInfo(VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
       VK_SHADER_STAGE_FRAGMENT_BIT, &laserTextureImageDescriptor);
@@ -487,5 +493,5 @@
       VK_SHADER_STAGE_VERTEX_BIT, &uniformBufferInfoList_explosionPipeline);
    explosionPipeline.addDescriptorInfo(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
-      VK_SHADER_STAGE_VERTEX_BIT, &explosionPipeline.storageBufferSet.infoSet);
+      VK_SHADER_STAGE_VERTEX_BIT, &storageBuffers_explosionPipeline.infoSet);
 
    explosionPipeline.createDescriptorSetLayout();
@@ -599,6 +605,6 @@
       VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT,
       VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
-      modelPipeline.storageBufferSet.buffers, modelPipeline.storageBufferSet.memory,
-      modelPipeline.storageBufferSet.infoSet);
+      storageBuffers_modelPipeline.buffers, storageBuffers_modelPipeline.memory,
+      storageBuffers_modelPipeline.infoSet);
 
    shipPipeline = GraphicsPipeline_Vulkan<ModelVertex>(
@@ -609,6 +615,6 @@
       VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT,
       VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
-      shipPipeline.storageBufferSet.buffers, shipPipeline.storageBufferSet.memory,
-      shipPipeline.storageBufferSet.infoSet);
+      storageBuffers_shipPipeline.buffers, storageBuffers_shipPipeline.memory,
+      storageBuffers_shipPipeline.infoSet);
 
    asteroidPipeline = GraphicsPipeline_Vulkan<ModelVertex>(
@@ -619,6 +625,6 @@
       VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT,
       VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
-      asteroidPipeline.storageBufferSet.buffers, asteroidPipeline.storageBufferSet.memory,
-      asteroidPipeline.storageBufferSet.infoSet);
+      storageBuffers_asteroidPipeline.buffers, storageBuffers_asteroidPipeline.memory,
+      storageBuffers_asteroidPipeline.infoSet);
 
    laserPipeline = GraphicsPipeline_Vulkan<LaserVertex>(
@@ -629,6 +635,6 @@
       VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT,
       VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
-      laserPipeline.storageBufferSet.buffers, laserPipeline.storageBufferSet.memory,
-      laserPipeline.storageBufferSet.infoSet);
+      storageBuffers_laserPipeline.buffers, storageBuffers_laserPipeline.memory,
+      storageBuffers_laserPipeline.infoSet);
 
    explosionPipeline = GraphicsPipeline_Vulkan<ExplosionVertex>(
@@ -640,6 +646,6 @@
       VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT,
       VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
-      explosionPipeline.storageBufferSet.buffers, explosionPipeline.storageBufferSet.memory,
-      explosionPipeline.storageBufferSet.infoSet);
+      storageBuffers_explosionPipeline.buffers, storageBuffers_explosionPipeline.memory,
+      storageBuffers_explosionPipeline.infoSet);
 }
 
@@ -762,5 +768,7 @@
                            }, {
                               mat4(1.0f)
-                           }, true);
+                           }, storageBuffers_modelPipeline, true);
+
+                  updateStorageBuffer(storageBuffers_modelPipeline, modelPipeline.numObjects - 1, texturedSquare.ssbo);
 
                   texturedSquare.model_base =
@@ -1042,5 +1050,7 @@
                   10.0f,
                   false
-               }, true);
+               }, storageBuffers_asteroidPipeline, true);
+
+      updateStorageBuffer(storageBuffers_asteroidPipeline, asteroidPipeline.numObjects - 1, asteroid.ssbo);
 
       // This accounts for the scaling in model_base.
@@ -1070,4 +1080,5 @@
       if (shipObjects[i].modified) {
          updateObject(shipObjects, shipPipeline, i);
+         updateStorageBuffer(storageBuffers_shipPipeline, i, shipObjects[i].ssbo);
       }
    }
@@ -1076,4 +1087,5 @@
       if (modelObjects[i].modified) {
          updateObject(modelObjects, modelPipeline, i);
+         updateStorageBuffer(storageBuffers_modelPipeline, i, modelObjects[i].ssbo);
       }
    }
@@ -1082,4 +1094,5 @@
       if (asteroidObjects[i].modified) {
          updateObject(asteroidObjects, asteroidPipeline, i);
+         updateStorageBuffer(storageBuffers_asteroidPipeline, i, asteroidObjects[i].ssbo);
       }
    }
@@ -1088,4 +1101,5 @@
       if (laserObjects[i].modified) {
          updateObject(laserObjects, laserPipeline, i);
+         updateStorageBuffer(storageBuffers_laserPipeline, i, laserObjects[i].ssbo);
       }
    }
@@ -1094,4 +1108,5 @@
       if (explosionObjects[i].modified) {
          updateObject(explosionObjects, explosionPipeline, i);
+         updateStorageBuffer(storageBuffers_explosionPipeline, i, explosionObjects[i].ssbo);
       }
    }
@@ -1131,27 +1146,27 @@
    explosionPipeline.cleanupBuffers();
 
-   for (size_t i = 0; i < modelPipeline.storageBufferSet.buffers.size(); i++) {
-      vkDestroyBuffer(device, modelPipeline.storageBufferSet.buffers[i], nullptr);
-      vkFreeMemory(device, modelPipeline.storageBufferSet.memory[i], nullptr);
-   }
-
-   for (size_t i = 0; i < shipPipeline.storageBufferSet.buffers.size(); i++) {
-      vkDestroyBuffer(device, shipPipeline.storageBufferSet.buffers[i], nullptr);
-      vkFreeMemory(device, shipPipeline.storageBufferSet.memory[i], nullptr);
-   }
-
-   for (size_t i = 0; i < asteroidPipeline.storageBufferSet.buffers.size(); i++) {
-      vkDestroyBuffer(device, asteroidPipeline.storageBufferSet.buffers[i], nullptr);
-      vkFreeMemory(device, asteroidPipeline.storageBufferSet.memory[i], nullptr);
-   }
-
-   for (size_t i = 0; i < laserPipeline.storageBufferSet.buffers.size(); i++) {
-      vkDestroyBuffer(device, laserPipeline.storageBufferSet.buffers[i], nullptr);
-      vkFreeMemory(device, laserPipeline.storageBufferSet.memory[i], nullptr);
-   }
-
-   for (size_t i = 0; i < explosionPipeline.storageBufferSet.buffers.size(); i++) {
-      vkDestroyBuffer(device, explosionPipeline.storageBufferSet.buffers[i], nullptr);
-      vkFreeMemory(device, explosionPipeline.storageBufferSet.memory[i], nullptr);
+   for (size_t i = 0; i < storageBuffers_modelPipeline.buffers.size(); i++) {
+      vkDestroyBuffer(device, storageBuffers_modelPipeline.buffers[i], nullptr);
+      vkFreeMemory(device, storageBuffers_modelPipeline.memory[i], nullptr);
+   }
+
+   for (size_t i = 0; i < storageBuffers_shipPipeline.buffers.size(); i++) {
+      vkDestroyBuffer(device, storageBuffers_shipPipeline.buffers[i], nullptr);
+      vkFreeMemory(device, storageBuffers_shipPipeline.memory[i], nullptr);
+   }
+
+   for (size_t i = 0; i < storageBuffers_asteroidPipeline.buffers.size(); i++) {
+      vkDestroyBuffer(device, storageBuffers_asteroidPipeline.buffers[i], nullptr);
+      vkFreeMemory(device, storageBuffers_asteroidPipeline.memory[i], nullptr);
+   }
+
+   for (size_t i = 0; i < storageBuffers_laserPipeline.buffers.size(); i++) {
+      vkDestroyBuffer(device, storageBuffers_laserPipeline.buffers[i], nullptr);
+      vkFreeMemory(device, storageBuffers_laserPipeline.memory[i], nullptr);
+   }
+
+   for (size_t i = 0; i < storageBuffers_explosionPipeline.buffers.size(); i++) {
+      vkDestroyBuffer(device, storageBuffers_explosionPipeline.buffers[i], nullptr);
+      vkFreeMemory(device, storageBuffers_explosionPipeline.memory[i], nullptr);
    }
 
@@ -1914,5 +1929,7 @@
          color,
          false
-      }, true);
+      }, storageBuffers_laserPipeline, true);
+
+   updateStorageBuffer(storageBuffers_laserPipeline, laserPipeline.numObjects - 1, laser.ssbo);
 
    float xAxisRotation = asin(ray.y / length);
@@ -2124,5 +2141,7 @@
          duration,
          false
-      }, true);
+      }, storageBuffers_explosionPipeline, true);
+
+   updateStorageBuffer(storageBuffers_explosionPipeline, explosionPipeline.numObjects - 1, explosion.ssbo);
 
    explosion.model_base = model_mat;
