Index: vulkan-ref.cpp
===================================================================
--- vulkan-ref.cpp	(revision e83b155c9ca795fd8d1ec3852877e07734355307)
+++ vulkan-ref.cpp	(revision 603b5bc69c413a1767dc42b7921374fc1c992f31)
@@ -178,22 +178,13 @@
       vector<VkImage> swapChainImages;
       VkFormat swapChainImageFormat;
-/*** END OF REFACTORED CODE ***/
-      // (This was taken out of vulkan-game for now and replaced with Viewport)
-      // It will definitely be needed when creating command buffers and I could use it in a few other places
-      // TODO: Check above ^
       VkExtent2D swapChainExtent;
-/*** START OF REFACTORED CODE ***/
       vector<VkImageView> swapChainImageViews;
-/*** END OF REFACTORED CODE ***/
       vector<VkFramebuffer> swapChainFramebuffers;
 
-/*** START OF REFACTORED CODE ***/
       VkRenderPass renderPass;
 
       VkCommandPool commandPool;
-/*** END OF REFACTORED CODE ***/
       vector<VkCommandBuffer> commandBuffers;
 
-/*** START OF REFACTORED CODE ***/
       // The images and the sampler are used to store data for specific attributes. I probably
       // want to keep them separate from the GraphicsPipelineInfo objects and start passing
@@ -203,5 +194,4 @@
       VkDeviceMemory depthImageMemory;
       VkImageView depthImageView;
-/*** END OF REFACTORED CODE ***/
 
       VkImage textureImage;
@@ -213,5 +203,4 @@
       VkImageView sdlOverlayImageView;
 
-/*** START OF REFACTORED CODE ***/
       VkSampler textureSampler;
 
@@ -222,15 +211,13 @@
       vector<VkBuffer> uniformBuffers;
       vector<VkDeviceMemory> uniformBuffersMemory;
-/*** END OF REFACTORED CODE ***/
 
       VkDescriptorImageInfo sceneImageInfo;
       VkDescriptorImageInfo overlayImageInfo;
 
-/*** START OF REFACTORED CODE ***/
       vector<VkDescriptorBufferInfo> uniformBufferInfoList;
-/*** END OF REFACTORED CODE ***/
 
       GraphicsPipelineInfo scenePipeline;
       GraphicsPipelineInfo overlayPipeline;
+/*** END OF REFACTORED CODE ***/
 
       vector<VkSemaphore> imageAvailableSemaphores;
@@ -339,8 +326,6 @@
 
          createCommandPool();
-/*** END OF REFACTORED CODE ***/
 
          createImageResources("textures/texture.jpg", textureImage, textureImageMemory, textureImageView);
-/*** START OF REFACTORED CODE ***/
          createImageResourcesFromSDLTexture(uiOverlay, sdlOverlayImage, sdlOverlayImageMemory, sdlOverlayImageView);
          createTextureSampler();
@@ -413,7 +398,7 @@
 
          createDescriptorSetLayout(overlayPipeline);
+
+         createBufferResources();
 /*** END OF REFACTORED CODE ***/
-
-         createBufferResources();
 
          createSyncObjects();
@@ -818,10 +803,8 @@
          }
       }
-/*** END OF REFACTORED CODE ***/
 
       void initGraphicsPipelineInfo(GraphicsPipelineInfo& info,
             const void* vertexData, int vertexSize, size_t numVertices,
             const void* indexData, int indexSize, size_t numIndices) {
-/*** START OF REFACTORED CODE ***/
          // Since there is only one array of vertex data, we use binding = 0
          // I'll probably do that for the foreseeable future
@@ -1015,5 +998,4 @@
          vkDestroyShaderModule(device, fragShaderModule, nullptr);
       }
-/*** END OF REFACTORED CODE ***/
 
       VkShaderModule createShaderModule(const vector<char>& code) {
@@ -1035,5 +1017,5 @@
 
          for (size_t i = 0; i < swapChainImageViews.size(); i++) {
-            array <VkImageView, 2> attachments = {
+            array<VkImageView, 2> attachments = {
                swapChainImageViews[i],
                depthImageView
@@ -1055,5 +1037,4 @@
       }
 
-/*** START OF REFACTORED CODE ***/
       void createCommandPool() {
          QueueFamilyIndices queueFamilyIndices = findQueueFamilies(physicalDevice);
@@ -1100,5 +1081,4 @@
          return indices;
       }
-/*** END OF REFACTORED CODE ***/
 
       void createDepthResources() {
@@ -1112,5 +1092,4 @@
       }
 
-/*** START OF REFACTORED CODE ***/
       VkFormat findDepthFormat() {
          return findSupportedFormat(
@@ -1239,4 +1218,5 @@
       }
 
+/*** START OF REFACTORED CODE ***/
       void createImage(uint32_t width, uint32_t height, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage,
             VkMemoryPropertyFlags properties, VkImage& image, VkDeviceMemory& imageMemory) {
@@ -1364,5 +1344,4 @@
       }
 
-/*** START OF REFACTORED CODE ***/
       VkImageView createImageView(VkImage image, VkFormat format, VkImageAspectFlags aspectFlags) {
          VkImageViewCreateInfo viewInfo = {};
@@ -1649,5 +1628,4 @@
          }
       }
-/*** END OF REFACTORED CODE ***/
 
       void createCommandBuffers() {
@@ -1690,6 +1668,8 @@
             vkCmdBeginRenderPass(commandBuffers[i], &renderPassInfo, VK_SUBPASS_CONTENTS_INLINE);
 
+/*** END OF REFACTORED CODE ***/
             createGraphicsPipelineCommands(scenePipeline, i);
             createGraphicsPipelineCommands(overlayPipeline, i);
+/*** START OF REFACTORED CODE ***/
 
             vkCmdEndRenderPass(commandBuffers[i]);
@@ -1705,4 +1685,5 @@
          vkCmdBindDescriptorSets(commandBuffers[currentImage], VK_PIPELINE_BIND_POINT_GRAPHICS, info.pipelineLayout, 0, 1,
             &info.descriptorSets[currentImage], 0, nullptr);
+/*** END OF REFACTORED CODE ***/
 
          VkBuffer vertexBuffers[] = { info.vertexBuffer };
@@ -1713,5 +1694,7 @@
 
          vkCmdDrawIndexed(commandBuffers[currentImage], static_cast<uint32_t>(info.numIndices), 1, 0, 0, 0);
-      }
+/*** START OF REFACTORED CODE ***/
+      }
+/*** END OF REFACTORED CODE ***/
 
       void createSyncObjects() {
@@ -1955,12 +1938,10 @@
       }
 
+/*** START OF REFACTORED CODE ***/
       void createBufferResources() {
-         // TODO: The three functions below will be called in vulkan-game following the
-         // pipeline creation (createDescriptorSets()), and before createCommandBuffers()
          createDepthResources();
          createFramebuffers();
          createUniformBuffers();
 
-/*** START OF REFACTORED CODE ***/
          createGraphicsPipeline("shaders/scene-vert.spv", "shaders/scene-frag.spv", scenePipeline);
          createDescriptorPool(scenePipeline);
@@ -1970,5 +1951,4 @@
          createDescriptorPool(overlayPipeline);
          createDescriptorSets(overlayPipeline);
-/*** END OF REFACTORED CODE ***/
 
          createCommandBuffers();
@@ -1976,5 +1956,4 @@
 
       void cleanup() {
-/*** START OF REFACTORED CODE ***/
          cleanupSwapChain();
 
@@ -2042,5 +2021,4 @@
 
       void cleanupSwapChain() {
-/*** END OF REFACTORED CODE ***/
          vkDestroyImageView(device, depthImageView, nullptr);
          vkDestroyImage(device, depthImage, nullptr);
@@ -2053,5 +2031,4 @@
          vkFreeCommandBuffers(device, commandPool, static_cast<uint32_t>(commandBuffers.size()), commandBuffers.data());
 
-/*** START OF REFACTORED CODE ***/
          cleanupPipeline(scenePipeline);
          cleanupPipeline(overlayPipeline);
