Index: vulkan-game.cpp
===================================================================
--- vulkan-game.cpp	(revision 0e093408baa407e69125906c7b875a1e1689b7d5)
+++ vulkan-game.cpp	(revision fa9fa1ce290a1ee0872d5c05323aa3737cdee04b)
@@ -104,4 +104,5 @@
    createImageViews();
    createRenderPass();
+   createCommandPool();
 }
 
@@ -167,4 +168,5 @@
    cleanupSwapChain();
 
+   vkDestroyCommandPool(device, commandPool, nullptr);
    vkDestroyDevice(device, nullptr);
    vkDestroySurfaceKHR(instance, surface, nullptr);
@@ -293,21 +295,22 @@
 }
 
-bool VulkanGame::isDeviceSuitable(VkPhysicalDevice device, const vector<const char*>& deviceExtensions) {
+bool VulkanGame::isDeviceSuitable(VkPhysicalDevice physicalDevice,
+      const vector<const char*>& deviceExtensions) {
    VkPhysicalDeviceProperties deviceProperties;
-   vkGetPhysicalDeviceProperties(device, &deviceProperties);
+   vkGetPhysicalDeviceProperties(physicalDevice, &deviceProperties);
 
    cout << "Device: " << deviceProperties.deviceName << endl;
 
-   QueueFamilyIndices indices = VulkanUtils::findQueueFamilies(device, surface);
-   bool extensionsSupported = VulkanUtils::checkDeviceExtensionSupport(device, deviceExtensions);
+   QueueFamilyIndices indices = VulkanUtils::findQueueFamilies(physicalDevice, surface);
+   bool extensionsSupported = VulkanUtils::checkDeviceExtensionSupport(physicalDevice, deviceExtensions);
    bool swapChainAdequate = false;
 
    if (extensionsSupported) {
-      SwapChainSupportDetails swapChainSupport = VulkanUtils::querySwapChainSupport(device, surface);
+      SwapChainSupportDetails swapChainSupport = VulkanUtils::querySwapChainSupport(physicalDevice, surface);
       swapChainAdequate = !swapChainSupport.formats.empty() && !swapChainSupport.presentModes.empty();
    }
 
    VkPhysicalDeviceFeatures supportedFeatures;
-   vkGetPhysicalDeviceFeatures(device, &supportedFeatures);
+   vkGetPhysicalDeviceFeatures(physicalDevice, &supportedFeatures);
 
    return indices.isComplete() && extensionsSupported && swapChainAdequate && supportedFeatures.samplerAnisotropy;
@@ -492,4 +495,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::cleanupSwapChain() {
    vkDestroyRenderPass(device, renderPass, nullptr);
Index: vulkan-game.hpp
===================================================================
--- vulkan-game.hpp	(revision 0e093408baa407e69125906c7b875a1e1689b7d5)
+++ vulkan-game.hpp	(revision fa9fa1ce290a1ee0872d5c05323aa3737cdee04b)
@@ -38,5 +38,7 @@
       VkExtent2D swapChainExtent;
       vector<VkImageView> swapChainImageViews;
+
       VkRenderPass renderPass;
+      VkCommandPool commandPool;
 
       bool framebufferResized = false;
@@ -54,5 +56,5 @@
       void createVulkanSurface();
       void pickPhysicalDevice(const vector<const char*>& deviceExtensions);
-      bool isDeviceSuitable(VkPhysicalDevice device, const vector<const char*>& deviceExtensions);
+      bool isDeviceSuitable(VkPhysicalDevice physicalDevice, const vector<const char*>& deviceExtensions);
       void createLogicalDevice(
          const vector<const char*> validationLayers,
@@ -62,4 +64,5 @@
       void createRenderPass();
       VkFormat findDepthFormat();
+      void createCommandPool();
 
       void cleanupSwapChain();
Index: vulkan-ref.cpp
===================================================================
--- vulkan-ref.cpp	(revision 0e093408baa407e69125906c7b875a1e1689b7d5)
+++ vulkan-ref.cpp	(revision fa9fa1ce290a1ee0872d5c05323aa3737cdee04b)
@@ -179,7 +179,7 @@
 /*** START OF REFACTORED CODE ***/
       VkRenderPass renderPass;
+
+      VkCommandPool commandPool;
 /*** END OF REFACTORED CODE ***/
-
-      VkCommandPool commandPool;
       vector<VkCommandBuffer> commandBuffers;
 
@@ -322,7 +322,7 @@
          createImageViews();
          createRenderPass();
+
+         createCommandPool();
 /*** END OF REFACTORED CODE ***/
-
-         createCommandPool();
 
          createImageResources("textures/texture.jpg", textureImage, textureImageMemory, textureImageView);
@@ -1025,4 +1025,5 @@
       }
 
+/*** START OF REFACTORED CODE ***/
       void createCommandPool() {
          QueueFamilyIndices queueFamilyIndices = findQueueFamilies(physicalDevice);
@@ -1038,5 +1039,4 @@
       }
 
-/*** START OF REFACTORED CODE ***/
       QueueFamilyIndices findQueueFamilies(VkPhysicalDevice device) {
          QueueFamilyIndices indices;
@@ -1893,6 +1893,6 @@
          }
 
+/*** START OF REFACTORED CODE ***/
          vkDestroyCommandPool(device, commandPool, nullptr);
-/*** START OF REFACTORED CODE ***/
          vkDestroyDevice(device, nullptr);
          vkDestroySurfaceKHR(instance, surface, nullptr);
