Index: vulkan-ref.cpp
===================================================================
--- vulkan-ref.cpp	(revision 34bdf3ab3957de6744017a27609ea5f1be36d7ae)
+++ vulkan-ref.cpp	(revision 87c8f1abdf1a94f87d0f0051fbc134d1ec1fa9ee)
@@ -72,5 +72,4 @@
    glm::vec2 texCoord;
 };
-/*** END OF REFACTORED CODE ***/
 
 struct UniformBufferObject {
@@ -80,5 +79,4 @@
 };
 
-/*** START OF REFACTORED CODE ***/
 struct DescriptorInfo {
    VkDescriptorType type;
@@ -88,8 +86,6 @@
    VkDescriptorImageInfo* imageData;
 };
-/*** END OF REFACTORED CODE ***/
 
 struct GraphicsPipelineInfo {
-/*** START OF REFACTORED CODE ***/
    VkPipelineLayout pipelineLayout;
    VkPipeline pipeline;
@@ -103,7 +99,6 @@
    VkDescriptorSetLayout descriptorSetLayout;
    vector<VkDescriptorSet> descriptorSets;
-/*** END OF REFACTORED CODE ***/
-
-   size_t numVertices; // Currently unused
+
+   size_t numVertices;
    size_t vertexCapacity;
    VkBuffer vertexBuffer;
@@ -116,5 +111,4 @@
 };
 
-/*** START OF REFACTORED CODE ***/
 VkResult CreateDebugUtilsMessengerEXT(VkInstance instance,
       const VkDebugUtilsMessengerCreateInfoEXT* pCreateInfo,
@@ -223,7 +217,7 @@
       vector<VkSemaphore> renderFinishedSemaphores;
       vector<VkFence> inFlightFences;
+
+      size_t currentFrame = 0;
 /*** END OF REFACTORED CODE ***/
-
-      size_t currentFrame = 0;
 
       size_t numPlanes = 0; // temp
@@ -340,5 +334,4 @@
          overlayImageInfo.imageView = sdlOverlayImageView;
          overlayImageInfo.sampler = textureSampler;
-/*** END OF REFACTORED CODE ***/
 
          // SHADER-SPECIFIC STUFF STARTS HERE
@@ -364,5 +357,4 @@
             sceneIndices.data(), sizeof(uint16_t), sceneIndices.size());
 
-/*** START OF REFACTORED CODE ***/
          addAttributeDescription(scenePipeline, VK_FORMAT_R32G32B32_SFLOAT, offset_of(&Vertex::pos));
          addAttributeDescription(scenePipeline, VK_FORMAT_R32G32B32_SFLOAT, offset_of(&Vertex::color));
@@ -373,5 +365,4 @@
 
          createDescriptorSetLayout(scenePipeline);
-/*** END OF REFACTORED CODE ***/
 
          numPlanes = 2;
@@ -391,5 +382,4 @@
             overlayIndices.data(), sizeof(uint16_t), overlayIndices.size());
 
-/*** START OF REFACTORED CODE ***/
          addAttributeDescription(overlayPipeline, VK_FORMAT_R32G32B32_SFLOAT, offset_of(&OverlayVertex::pos));
          addAttributeDescription(overlayPipeline, VK_FORMAT_R32G32_SFLOAT, offset_of(&OverlayVertex::texCoord));
@@ -812,5 +802,4 @@
          info.bindingDescription.stride = vertexSize;
          info.bindingDescription.inputRate = VK_VERTEX_INPUT_RATE_VERTEX;
-/*** END OF REFACTORED CODE ***/
 
          info.numVertices = numVertices;
@@ -1393,5 +1382,4 @@
          }
       }
-/*** END OF REFACTORED CODE ***/
 
       void createVertexBuffer(GraphicsPipelineInfo& info, const void* vertexData, int vertexSize) {
@@ -1443,5 +1431,4 @@
       }
 
-/*** START OF REFACTORED CODE ***/
       void createUniformBuffers() {
          VkDeviceSize bufferSize = sizeof(UniformBufferObject);
@@ -1507,4 +1494,5 @@
       }
 
+/*** START OF REFACTORED CODE ***/
       void copyBuffer(VkBuffer srcBuffer, VkBuffer dstBuffer, VkDeviceSize srcOffset, VkDeviceSize dstOffset,
             VkDeviceSize size) {
@@ -1550,5 +1538,4 @@
       }
 
-/*** START OF REFACTORED CODE ***/
       uint32_t findMemoryType(uint32_t typeFilter, VkMemoryPropertyFlags properties) {
          VkPhysicalDeviceMemoryProperties memProperties;
@@ -1801,8 +1788,8 @@
 
       void drawFrame() {
+         vkWaitForFences(device, 1, &inFlightFences[currentFrame], VK_TRUE, numeric_limits<uint64_t>::max());
+
+         uint32_t imageIndex;
 /*** END OF REFACTORED CODE ***/
-         vkWaitForFences(device, 1, &inFlightFences[currentFrame], VK_TRUE, numeric_limits<uint64_t>::max());
-
-         uint32_t imageIndex;
 
          VkResult result = vkAcquireNextImageKHR(device, swapChain, numeric_limits<uint64_t>::max(),
@@ -1861,7 +1848,7 @@
          }
 
+/*** START OF REFACTORED CODE ***/
          currentFrame = (currentFrame + 1) % MAX_FRAMES_IN_FLIGHT;
          currentFrame = (currentFrame + 1) % MAX_FRAMES_IN_FLIGHT;
-/*** START OF REFACTORED CODE ***/
       }
 
@@ -2052,5 +2039,4 @@
       void cleanupPipelineBuffers(GraphicsPipelineInfo& pipeline) {
          vkDestroyDescriptorSetLayout(device, pipeline.descriptorSetLayout, nullptr);
-/*** END OF REFACTORED CODE ***/
 
          vkDestroyBuffer(device, pipeline.vertexBuffer, nullptr);
@@ -2059,4 +2045,5 @@
          vkFreeMemory(device, pipeline.indexBufferMemory, nullptr);
       }
+/*** END OF REFACTORED CODE ***/
 
       static VKAPI_ATTR VkBool32 VKAPI_CALL debugCallback(
