Index: main-vulkan.cpp
===================================================================
--- main-vulkan.cpp	(revision 6a39266776a43e2a3cce6d759bda1eb046f6de0b)
+++ main-vulkan.cpp	(revision 7f60b28d36ec26221af91af3a69b8a68d7b9b7c1)
@@ -19,9 +19,7 @@
 
 int __main(int argc, char* argv[]) {
-   const int MAX_FRAMES_IN_FLIGHT = 2;
-
    cout << "Starting Vulkan Game..." << endl;
 
-   VulkanGame game(MAX_FRAMES_IN_FLIGHT);
+   VulkanGame game;
 
    try {
Index: vulkan-utils.cpp
===================================================================
--- vulkan-utils.cpp	(revision 6a39266776a43e2a3cce6d759bda1eb046f6de0b)
+++ vulkan-utils.cpp	(revision 7f60b28d36ec26221af91af3a69b8a68d7b9b7c1)
@@ -2,4 +2,5 @@
 
 #include <algorithm>
+#include <cassert>
 #include <set>
 #include <stdexcept>
@@ -7,6 +8,4 @@
 #define STB_IMAGE_IMPLEMENTATION
 #include "stb_image.h" // TODO: Probably switch to SDL_image
-
-// TODO: Remove all instances of auto
 
 bool VulkanUtils::checkValidationLayerSupport(const vector<const char*> &validationLayers) {
@@ -20,5 +19,5 @@
       bool layerFound = false;
 
-      for (const auto& layerProperties : availableLayers) {
+      for (const VkLayerProperties& layerProperties : availableLayers) {
          if (strcmp(layerName, layerProperties.layerName) == 0) {
             layerFound = true;
@@ -61,4 +60,7 @@
 
 // TODO: Change this to prefer one queue that supports both graphics and presentation
+// Currently, if a queue family that supports only graphics and one that supports only presentation
+// occur in the list before a queue family that supports both, they will be selected rather than the
+// one that supports both
 QueueFamilyIndices VulkanUtils::findQueueFamilies(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface) {
    QueueFamilyIndices indices;
@@ -71,5 +73,5 @@
 
    int i = 0;
-   for (const auto& queueFamily : queueFamilies) {
+   for (const VkQueueFamilyProperties& queueFamily : queueFamilies) {
       if (queueFamily.queueCount > 0) {
          if (queueFamily.queueFlags & VK_QUEUE_GRAPHICS_BIT) {
@@ -104,5 +106,5 @@
    set<string> requiredExtensions(deviceExtensions.begin(), deviceExtensions.end());
 
-   for (const auto& extension : availableExtensions) {
+   for (const VkExtensionProperties& extension : availableExtensions) {
       requiredExtensions.erase(extension.extensionName);
    }
@@ -111,32 +113,55 @@
 }
 
-SwapChainSupportDetails VulkanUtils::querySwapChainSupport(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface) {
-   SwapChainSupportDetails details;
-
-   vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevice, surface, &details.capabilities);
-
+VkSurfaceCapabilitiesKHR VulkanUtils::querySwapChainCapabilities(VkPhysicalDevice physicalDevice,
+      VkSurfaceKHR surface) {
+   VkSurfaceCapabilitiesKHR capabilities;
+
+   vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevice, surface, &capabilities);
+
+   return capabilities;
+}
+
+vector<VkSurfaceFormatKHR> VulkanUtils::querySwapChainFormats(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface) {
    uint32_t formatCount;
+   vector<VkSurfaceFormatKHR> formats;
+
    vkGetPhysicalDeviceSurfaceFormatsKHR(physicalDevice, surface, &formatCount, nullptr);
 
    if (formatCount != 0) {
-      details.formats.resize(formatCount);
-      vkGetPhysicalDeviceSurfaceFormatsKHR(physicalDevice, surface, &formatCount, details.formats.data());
-   }
-
+      formats.resize(formatCount);
+      vkGetPhysicalDeviceSurfaceFormatsKHR(physicalDevice, surface, &formatCount, formats.data());
+   }
+
+   return formats;
+}
+
+vector<VkPresentModeKHR> VulkanUtils::querySwapChainPresentModes(VkPhysicalDevice physicalDevice,
+      VkSurfaceKHR surface) {
    uint32_t presentModeCount;
+   vector<VkPresentModeKHR> presentModes;
+
    vkGetPhysicalDeviceSurfacePresentModesKHR(physicalDevice, surface, &presentModeCount, nullptr);
 
    if (presentModeCount != 0) {
-      details.presentModes.resize(presentModeCount);
-      vkGetPhysicalDeviceSurfacePresentModesKHR(physicalDevice, surface, &presentModeCount, details.presentModes.data());
-   }
-
-   return details;
-}
-
-VkSurfaceFormatKHR VulkanUtils::chooseSwapSurfaceFormat(const vector<VkSurfaceFormatKHR>& availableFormats) {
-   for (const auto& availableFormat : availableFormats) {
-      if (availableFormat.format == VK_FORMAT_B8G8R8A8_UNORM && availableFormat.colorSpace == VK_COLOR_SPACE_SRGB_NONLINEAR_KHR) {
-         return availableFormat;
+      presentModes.resize(presentModeCount);
+      vkGetPhysicalDeviceSurfacePresentModesKHR(physicalDevice, surface, &presentModeCount, presentModes.data());
+   }
+
+   return presentModes;
+}
+
+VkSurfaceFormatKHR VulkanUtils::chooseSwapSurfaceFormat(const vector<VkSurfaceFormatKHR>& availableFormats,
+      const vector<VkFormat>& requestedFormats, VkColorSpaceKHR requestedColorSpace) {
+   assert(requestedFormats.size() > 0);
+
+   if (availableFormats.size() == 1 && availableFormats[0].format == VK_FORMAT_UNDEFINED) {
+      return { requestedFormats[0], requestedColorSpace };
+   }
+
+   for (const VkFormat& requestedFormat : requestedFormats) {
+      for (const VkSurfaceFormatKHR& availableFormat : availableFormats) {
+         if (availableFormat.format == requestedFormat && availableFormat.colorSpace == requestedColorSpace) {
+            return availableFormat;
+         }
       }
    }
@@ -145,31 +170,18 @@
 }
 
-VkPresentModeKHR VulkanUtils::chooseSwapPresentMode(const vector<VkPresentModeKHR>& availablePresentModes) {
-   VkPresentModeKHR bestMode = VK_PRESENT_MODE_FIFO_KHR;
-
-   /* This functions effectively selects present modes in this order, which allows for unlimited framerate:
-    * { VK_PRESENT_MODE_MAILBOX_KHR, VK_PRESENT_MODE_IMMEDIATE_KHR, VK_PRESENT_MODE_FIFO_KHR }
-    *
-    * To cap the framerate (I assume to the monitor refresh rate), just use:
-    * { VK_PRESENT_MODE_FIFO_KHR }
-    * 
-    * Would be better to make a more generic function that takes a list of prefered modes ordered by preference.
-    * Example code:
-    * 
-    * for (int request_i = 0; request_i < request_modes_count; request_i++)
-    *    for (uint32_t avail_i = 0; avail_i < avail_count; avail_i++)
-    *       if (request_modes[request_i] == avail_modes[avail_i])
-    *          return request_modes[request_i];
-    */
-
-   for (const auto& availablePresentMode : availablePresentModes) {
-      if (availablePresentMode == VK_PRESENT_MODE_MAILBOX_KHR) {
-         return availablePresentMode;
-      } else if (availablePresentMode == VK_PRESENT_MODE_IMMEDIATE_KHR) {
-         bestMode = availablePresentMode;
-      }
-   }
-
-   return bestMode;
+VkPresentModeKHR VulkanUtils::chooseSwapPresentMode(const vector<VkPresentModeKHR>& availablePresentModes,
+      const vector<VkPresentModeKHR>& requestedPresentModes) {
+   assert(requestedPresentModes.size() > 0);
+
+   for (const VkPresentModeKHR& requestedPresentMode : requestedPresentModes) {
+      for (const VkPresentModeKHR& availablePresentMode : availablePresentModes) {
+         if (requestedPresentMode == availablePresentMode) {
+            return requestedPresentMode;
+         }
+      }
+   }
+
+   // If none of the requested modes are available, use VK_PRESENT_MODE_FIFO_KHR which is always available
+   return VK_PRESENT_MODE_FIFO_KHR;
 }
 
@@ -197,8 +209,8 @@
    viewInfo.format = format;
 
-   viewInfo.components.r = VK_COMPONENT_SWIZZLE_IDENTITY;
-   viewInfo.components.g = VK_COMPONENT_SWIZZLE_IDENTITY;
-   viewInfo.components.b = VK_COMPONENT_SWIZZLE_IDENTITY;
-   viewInfo.components.a = VK_COMPONENT_SWIZZLE_IDENTITY;
+   viewInfo.components.r = VK_COMPONENT_SWIZZLE_R;
+   viewInfo.components.g = VK_COMPONENT_SWIZZLE_G;
+   viewInfo.components.b = VK_COMPONENT_SWIZZLE_B;
+   viewInfo.components.a = VK_COMPONENT_SWIZZLE_A;
 
    viewInfo.subresourceRange.aspectMask = aspectFlags;
Index: vulkan-utils.hpp
===================================================================
--- vulkan-utils.hpp	(revision 6a39266776a43e2a3cce6d759bda1eb046f6de0b)
+++ vulkan-utils.hpp	(revision 7f60b28d36ec26221af91af3a69b8a68d7b9b7c1)
@@ -8,4 +8,6 @@
 #include <vulkan/vulkan.h>
 
+// TODO: Ideally, vulkan-utils should not have things speciic to windowing apis (glfw, sdl, sfml, etc.).
+// Check what these inclydes are for and if that functionality can be moved
 #include <SDL2/SDL.h>
 #include <SDL2/SDL_vulkan.h>
@@ -20,10 +22,4 @@
       return graphicsFamily.has_value() && presentFamily.has_value();
    }
-};
-
-struct SwapChainSupportDetails {
-   VkSurfaceCapabilitiesKHR capabilities;
-   vector<VkSurfaceFormatKHR> formats;
-   vector<VkPresentModeKHR> presentModes;
 };
 
@@ -50,8 +46,13 @@
       static bool checkDeviceExtensionSupport(VkPhysicalDevice physicalDevice,
             const vector<const char*>& deviceExtensions);
-      static SwapChainSupportDetails querySwapChainSupport(VkPhysicalDevice physicalDevice,
-            VkSurfaceKHR surface);
-      static VkSurfaceFormatKHR chooseSwapSurfaceFormat(const vector<VkSurfaceFormatKHR>& availableFormats);
-      static VkPresentModeKHR chooseSwapPresentMode(const vector<VkPresentModeKHR>& availablePresentModes);
+      static VkSurfaceCapabilitiesKHR querySwapChainCapabilities(VkPhysicalDevice physicalDevice,
+         VkSurfaceKHR surface);
+      static vector<VkSurfaceFormatKHR> querySwapChainFormats(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface);
+      static vector<VkPresentModeKHR> querySwapChainPresentModes(VkPhysicalDevice physicalDevice,
+         VkSurfaceKHR surface);
+      static VkSurfaceFormatKHR chooseSwapSurfaceFormat(const vector<VkSurfaceFormatKHR>& availableFormats,
+         const vector<VkFormat>& requestedFormats, VkColorSpaceKHR requestedColorSpace);
+      static VkPresentModeKHR chooseSwapPresentMode(const vector<VkPresentModeKHR>& availablePresentModes,
+         const vector<VkPresentModeKHR>& requestedPresentModes);
       static VkExtent2D chooseSwapExtent(const VkSurfaceCapabilitiesKHR& capabilities, int width, int height);
       static VkImageView createImageView(VkDevice device, VkImage image, VkFormat format,
