Index: vulkan-game.cpp
===================================================================
--- vulkan-game.cpp	(revision 9067efc6d42c8653176e1f616d6e0f7c8bb9cf09)
+++ vulkan-game.cpp	(revision 9c0a614cccc4e71b75dbd749218b1adb7fa608b8)
@@ -219,5 +219,5 @@
    createRenderPass();
    createResourceCommandPool();
-   createCommandPool();
+   createCommandPools();
 
    createImageResources();
@@ -1229,5 +1229,4 @@
 
    vkDestroyCommandPool(device, resourceCommandPool, nullptr);
-   vkDestroyCommandPool(device, commandPool, nullptr);
 
    vkDestroyDevice(device, nullptr);
@@ -1632,14 +1631,17 @@
 }
 
-void VulkanGame::createCommandPool() {
-   QueueFamilyIndices queueFamilyIndices = VulkanUtils::findQueueFamilies(physicalDevice, surface);
-
-   VkCommandPoolCreateInfo poolInfo = {};
-   poolInfo.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO;
-   poolInfo.queueFamilyIndex = queueFamilyIndices.graphicsFamily.value();
-   poolInfo.flags = 0;
-
-   if (vkCreateCommandPool(device, &poolInfo, nullptr, &commandPool) != VK_SUCCESS) {
-      throw runtime_error("failed to create graphics command pool!");
+void VulkanGame::createCommandPools() {
+   commandPools.resize(swapChainImageCount);
+
+   QueueFamilyIndices indices = VulkanUtils::findQueueFamilies(physicalDevice, surface);
+
+   for (size_t i = 0; i < swapChainImageCount; i++) {
+      VkCommandPoolCreateInfo poolInfo = {};
+      poolInfo.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO;
+      poolInfo.queueFamilyIndex = indices.graphicsFamily.value();
+      poolInfo.flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT;
+
+      VKUTIL_CHECK_RESULT(vkCreateCommandPool(device, &poolInfo, nullptr, &commandPools[i]),
+         "failed to create graphics command pool!");
    }
 }
@@ -1731,12 +1733,14 @@
    commandBuffers.resize(swapChainImageCount);
 
-   VkCommandBufferAllocateInfo allocInfo = {};
-   allocInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO;
-   allocInfo.commandPool = commandPool;
-   allocInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY;
-   allocInfo.commandBufferCount = (uint32_t) commandBuffers.size();
-
-   if (vkAllocateCommandBuffers(device, &allocInfo, commandBuffers.data()) != VK_SUCCESS) {
-      throw runtime_error("failed to allocate command buffers!");
+   for (size_t i = 0; i < swapChainImageCount; i++) {
+      VkCommandBufferAllocateInfo allocInfo = {};
+      allocInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO;
+      allocInfo.commandPool = commandPools[i];
+      allocInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY;
+      allocInfo.commandBufferCount = 1;
+
+      if (vkAllocateCommandBuffers(device, &allocInfo, &commandBuffers[i]) != VK_SUCCESS) {
+         throw runtime_error("failed to allocate command buffer!");
+      }
    }
 
@@ -2140,4 +2144,8 @@
    createRenderPass();
 
+   createCommandPools();
+
+   // The depth buffer does need to be recreated with the swap chain since its dimensions depend on the window size
+   // and resizing the window is a common reason to recreate the swapchain
    VulkanUtils::createDepthImage(device, physicalDevice, resourceCommandPool, findDepthFormat(), swapChainExtent,
       depthImage, graphicsQueue);
@@ -2205,5 +2213,8 @@
    }
 
-   vkFreeCommandBuffers(device, commandPool, static_cast<uint32_t>(commandBuffers.size()), commandBuffers.data());
+   for (uint32_t i = 0; i < swapChainImageCount; i++) {
+      vkFreeCommandBuffers(device, commandPools[i], 1, &commandBuffers[i]);
+      vkDestroyCommandPool(device, commandPools[i], nullptr);
+   }
 
    overlayPipeline.cleanup();
Index: vulkan-game.hpp
===================================================================
--- vulkan-game.hpp	(revision 9067efc6d42c8653176e1f616d6e0f7c8bb9cf09)
+++ vulkan-game.hpp	(revision 9c0a614cccc4e71b75dbd749218b1adb7fa608b8)
@@ -278,6 +278,5 @@
       VkCommandPool resourceCommandPool;
 
-      VkCommandPool commandPool;
-      vector<VkCommandPool> commandPools; // This is not used yet, but will be once 
+      vector<VkCommandPool> commandPools;
       vector<VkCommandBuffer> commandBuffers;
 
@@ -404,5 +403,5 @@
       VkFormat findDepthFormat(); // TODO: Declare/define (in the cpp file) this function in some util functions section
       void createResourceCommandPool();
-      void createCommandPool();
+      void createCommandPools();
       void createImageResources();
       void createFramebuffers();
@@ -501,5 +500,8 @@
    if (pipelinesCreated) {
       vkDeviceWaitIdle(device);
-      vkFreeCommandBuffers(device, commandPool, static_cast<uint32_t>(commandBuffers.size()), commandBuffers.data());
+
+      for (uint32_t i = 0; i < swapChainImageCount; i++) {
+         vkFreeCommandBuffers(device, commandPools[i], 1, &commandBuffers[i]);
+      }
 
       // TODO: The pipeline recreation only has to be done once per frame where at least
