Index: IMGUI/imgui_impl_vulkan.cpp
===================================================================
--- IMGUI/imgui_impl_vulkan.cpp	(revision 3b7d4970dceeff33d77df2de5074fb85023aa4e6)
+++ IMGUI/imgui_impl_vulkan.cpp	(revision 6493e439340a5e8c494580409ac38e03e31f7289)
@@ -103,5 +103,4 @@
 void ImGui_ImplVulkanH_DestroyFrameRenderBuffers(VkDevice device, ImGui_ImplVulkanH_FrameRenderBuffers* buffers, const VkAllocationCallbacks* allocator);
 void ImGui_ImplVulkanH_DestroyWindowRenderBuffers(VkDevice device, ImGui_ImplVulkanH_WindowRenderBuffers* buffers, const VkAllocationCallbacks* allocator);
-void ImGui_ImplVulkanH_CreateWindowSwapChain(VkPhysicalDevice physical_device, VkDevice device, ImGui_ImplVulkanH_Window* wd, const VkAllocationCallbacks* allocator, int w, int h, uint32_t min_image_count);
 void ImGui_ImplVulkanH_CreateWindowCommandBuffers(VkPhysicalDevice physical_device, VkDevice device, ImGui_ImplVulkanH_Window* wd, uint32_t queue_family, const VkAllocationCallbacks* allocator);
 
@@ -895,5 +894,4 @@
     IM_ASSERT(info->PhysicalDevice != VK_NULL_HANDLE);
     IM_ASSERT(info->Device != VK_NULL_HANDLE);
-    IM_ASSERT(info->Queue != VK_NULL_HANDLE);
     IM_ASSERT(info->DescriptorPool != VK_NULL_HANDLE);
     IM_ASSERT(info->MinImageCount >= 2);
@@ -1072,180 +1070,4 @@
 }
 
-// Also destroy old swap chain and in-flight frames data, if any.
-void ImGui_ImplVulkanH_CreateWindowSwapChain(VkPhysicalDevice physical_device, VkDevice device, ImGui_ImplVulkanH_Window* wd, const VkAllocationCallbacks* allocator, int w, int h, uint32_t min_image_count)
-{
-    VkResult err;
-    VkSwapchainKHR old_swapchain = wd->Swapchain;
-    wd->Swapchain = NULL;
-    err = vkDeviceWaitIdle(device);
-    check_vk_result(err);
-
-    // We don't use ImGui_ImplVulkanH_DestroyWindow() because we want to preserve the old swapchain to create the new one.
-    // Destroy old Framebuffer
-    for (uint32_t i = 0; i < wd->ImageCount; i++)
-    {
-        ImGui_ImplVulkanH_DestroyFrame(device, &wd->Frames[i], allocator);
-        ImGui_ImplVulkanH_DestroyFrameSemaphores(device, &wd->FrameSemaphores[i], allocator);
-    }
-    IM_FREE(wd->Frames);
-    IM_FREE(wd->FrameSemaphores);
-    wd->Frames = NULL;
-    wd->FrameSemaphores = NULL;
-    wd->ImageCount = 0;
-    if (wd->RenderPass)
-        vkDestroyRenderPass(device, wd->RenderPass, allocator);
-    if (wd->Pipeline)
-        vkDestroyPipeline(device, wd->Pipeline, allocator);
-
-    // If min image count was not specified, request different count of images dependent on selected present mode
-    if (min_image_count == 0)
-        min_image_count = ImGui_ImplVulkanH_GetMinImageCountFromPresentMode(wd->PresentMode);
-
-    // Create Swapchain
-    {
-        VkSwapchainCreateInfoKHR info = {};
-        info.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR;
-        info.surface = wd->Surface;
-        info.minImageCount = min_image_count;
-        info.imageFormat = wd->SurfaceFormat.format;
-        info.imageColorSpace = wd->SurfaceFormat.colorSpace;
-        info.imageArrayLayers = 1;
-        info.imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
-        info.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE;           // Assume that graphics family == present family
-        info.preTransform = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR;
-        info.compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
-        info.presentMode = wd->PresentMode;
-        info.clipped = VK_TRUE;
-        info.oldSwapchain = old_swapchain;
-        VkSurfaceCapabilitiesKHR cap;
-        err = vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physical_device, wd->Surface, &cap);
-        check_vk_result(err);
-        if (info.minImageCount < cap.minImageCount)
-            info.minImageCount = cap.minImageCount;
-        else if (cap.maxImageCount != 0 && info.minImageCount > cap.maxImageCount)
-            info.minImageCount = cap.maxImageCount;
-
-        if (cap.currentExtent.width == 0xffffffff)
-        {
-            info.imageExtent.width = wd->Width = w;
-            info.imageExtent.height = wd->Height = h;
-        }
-        else
-        {
-            info.imageExtent.width = wd->Width = cap.currentExtent.width;
-            info.imageExtent.height = wd->Height = cap.currentExtent.height;
-        }
-        err = vkCreateSwapchainKHR(device, &info, allocator, &wd->Swapchain);
-        check_vk_result(err);
-        err = vkGetSwapchainImagesKHR(device, wd->Swapchain, &wd->ImageCount, NULL);
-        check_vk_result(err);
-        VkImage backbuffers[16] = {};
-        IM_ASSERT(wd->ImageCount >= min_image_count);
-        IM_ASSERT(wd->ImageCount < IM_ARRAYSIZE(backbuffers));
-        err = vkGetSwapchainImagesKHR(device, wd->Swapchain, &wd->ImageCount, backbuffers);
-        check_vk_result(err);
-
-        IM_ASSERT(wd->Frames == NULL);
-        wd->Frames = (ImGui_ImplVulkanH_Frame*)IM_ALLOC(sizeof(ImGui_ImplVulkanH_Frame) * wd->ImageCount);
-        wd->FrameSemaphores = (ImGui_ImplVulkanH_FrameSemaphores*)IM_ALLOC(sizeof(ImGui_ImplVulkanH_FrameSemaphores) * wd->ImageCount);
-        memset(wd->Frames, 0, sizeof(wd->Frames[0]) * wd->ImageCount);
-        memset(wd->FrameSemaphores, 0, sizeof(wd->FrameSemaphores[0]) * wd->ImageCount);
-        for (uint32_t i = 0; i < wd->ImageCount; i++)
-            wd->Frames[i].Backbuffer = backbuffers[i];
-    }
-    if (old_swapchain)
-        vkDestroySwapchainKHR(device, old_swapchain, allocator);
-
-    // Create the Render Pass
-    {
-        VkAttachmentDescription attachment = {};
-        attachment.format = wd->SurfaceFormat.format;
-        attachment.samples = VK_SAMPLE_COUNT_1_BIT;
-        attachment.loadOp = wd->ClearEnable ? VK_ATTACHMENT_LOAD_OP_CLEAR : VK_ATTACHMENT_LOAD_OP_DONT_CARE;
-        attachment.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
-        attachment.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
-        attachment.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
-        attachment.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
-        attachment.finalLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR;
-        VkAttachmentReference color_attachment = {};
-        color_attachment.attachment = 0;
-        color_attachment.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
-        VkSubpassDescription subpass = {};
-        subpass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
-        subpass.colorAttachmentCount = 1;
-        subpass.pColorAttachments = &color_attachment;
-        VkSubpassDependency dependency = {};
-        dependency.srcSubpass = VK_SUBPASS_EXTERNAL;
-        dependency.dstSubpass = 0;
-        dependency.srcStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
-        dependency.dstStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
-        dependency.srcAccessMask = 0;
-        dependency.dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT;
-        VkRenderPassCreateInfo info = {};
-        info.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
-        info.attachmentCount = 1;
-        info.pAttachments = &attachment;
-        info.subpassCount = 1;
-        info.pSubpasses = &subpass;
-        info.dependencyCount = 1;
-        info.pDependencies = &dependency;
-        err = vkCreateRenderPass(device, &info, allocator, &wd->RenderPass);
-        check_vk_result(err);
-
-        // We do not create a pipeline by default as this is also used by examples' main.cpp,
-        // but secondary viewport in multi-viewport mode may want to create one with:
-        //ImGui_ImplVulkan_CreatePipeline(device, allocator, VK_NULL_HANDLE, wd->RenderPass, VK_SAMPLE_COUNT_1_BIT, &wd->Pipeline);
-    }
-
-    // Create The Image Views
-    {
-        VkImageViewCreateInfo info = {};
-        info.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
-        info.viewType = VK_IMAGE_VIEW_TYPE_2D;
-        info.format = wd->SurfaceFormat.format;
-        info.components.r = VK_COMPONENT_SWIZZLE_R;
-        info.components.g = VK_COMPONENT_SWIZZLE_G;
-        info.components.b = VK_COMPONENT_SWIZZLE_B;
-        info.components.a = VK_COMPONENT_SWIZZLE_A;
-        VkImageSubresourceRange image_range = { VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1 };
-        info.subresourceRange = image_range;
-        for (uint32_t i = 0; i < wd->ImageCount; i++)
-        {
-            ImGui_ImplVulkanH_Frame* fd = &wd->Frames[i];
-            info.image = fd->Backbuffer;
-            err = vkCreateImageView(device, &info, allocator, &fd->BackbufferView);
-            check_vk_result(err);
-        }
-    }
-
-    // Create Framebuffer
-    {
-        VkImageView attachment[1];
-        VkFramebufferCreateInfo info = {};
-        info.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO;
-        info.renderPass = wd->RenderPass;
-        info.attachmentCount = 1;
-        info.pAttachments = attachment;
-        info.width = wd->Width;
-        info.height = wd->Height;
-        info.layers = 1;
-        for (uint32_t i = 0; i < wd->ImageCount; i++)
-        {
-            ImGui_ImplVulkanH_Frame* fd = &wd->Frames[i];
-            attachment[0] = fd->BackbufferView;
-            err = vkCreateFramebuffer(device, &info, allocator, &fd->Framebuffer);
-            check_vk_result(err);
-        }
-    }
-}
-
-// Create or resize window
-void ImGui_ImplVulkanH_CreateOrResizeWindow(VkInstance instance, VkPhysicalDevice physical_device, VkDevice device, ImGui_ImplVulkanH_Window* wd, uint32_t queue_family, const VkAllocationCallbacks* allocator, int width, int height, uint32_t min_image_count)
-{
-    (void)instance;
-    ImGui_ImplVulkanH_CreateWindowSwapChain(physical_device, device, wd, allocator, width, height, min_image_count);
-    ImGui_ImplVulkanH_CreateWindowCommandBuffers(physical_device, device, wd, queue_family, allocator);
-}
-
 void ImGui_ImplVulkanH_DestroyWindow(VkInstance instance, VkDevice device, ImGui_ImplVulkanH_Window* wd, const VkAllocationCallbacks* allocator)
 {
Index: IMGUI/imgui_impl_vulkan.h
===================================================================
--- IMGUI/imgui_impl_vulkan.h	(revision 3b7d4970dceeff33d77df2de5074fb85023aa4e6)
+++ IMGUI/imgui_impl_vulkan.h	(revision 6493e439340a5e8c494580409ac38e03e31f7289)
@@ -32,6 +32,4 @@
     VkPhysicalDevice    PhysicalDevice;
     VkDevice            Device;
-    uint32_t            QueueFamily;
-    VkQueue             Queue;
     VkPipelineCache     PipelineCache;
     VkDescriptorPool    DescriptorPool;
@@ -73,5 +71,4 @@
 
 // Helpers
-IMGUI_IMPL_API void                 ImGui_ImplVulkanH_CreateOrResizeWindow(VkInstance instance, VkPhysicalDevice physical_device, VkDevice device, ImGui_ImplVulkanH_Window* wnd, uint32_t queue_family, const VkAllocationCallbacks* allocator, int w, int h, uint32_t min_image_count);
 IMGUI_IMPL_API void                 ImGui_ImplVulkanH_DestroyWindow(VkInstance instance, VkDevice device, ImGui_ImplVulkanH_Window* wnd, const VkAllocationCallbacks* allocator);
 IMGUI_IMPL_API VkSurfaceFormatKHR   ImGui_ImplVulkanH_SelectSurfaceFormat(VkPhysicalDevice physical_device, VkSurfaceKHR surface, const VkFormat* request_formats, int request_formats_count, VkColorSpaceKHR request_color_space);
Index: sdl-game.cpp
===================================================================
--- sdl-game.cpp	(revision 3b7d4970dceeff33d77df2de5074fb85023aa4e6)
+++ sdl-game.cpp	(revision 6493e439340a5e8c494580409ac38e03e31f7289)
@@ -4,4 +4,9 @@
 #include <set>
 #include <stdexcept>
+
+#include "IMGUI/imgui_impl_sdl.h"
+
+#include <stdio.h>          // printf, fprintf
+#include <stdlib.h>         // abort
 
 // dear imgui: standalone example application for SDL2 + Vulkan
@@ -15,10 +20,4 @@
 // Read comments in imgui_impl_vulkan.h.
 
-#include "IMGUI/imgui.h"
-#include "IMGUI/imgui_impl_sdl.h"
-#include "IMGUI/imgui_impl_vulkan.h"
-#include <stdio.h>          // printf, fprintf
-#include <stdlib.h>         // abort
-
 #include <SDL2/SDL_vulkan.h>
 
@@ -35,8 +34,7 @@
 static VkPhysicalDevice         g_PhysicalDevice = VK_NULL_HANDLE;
 static VkDevice                 g_Device = VK_NULL_HANDLE;
-static uint32_t                 g_QueueFamily = (uint32_t)-1;
-static VkQueue                  g_Queue = VK_NULL_HANDLE;
+static VkQueue                  g_GraphicsQueue = VK_NULL_HANDLE;
+static VkQueue                  g_PresentQueue = VK_NULL_HANDLE;
 static VkPipelineCache          g_PipelineCache = VK_NULL_HANDLE;
-static VkDescriptorPool         g_DescriptorPool = VK_NULL_HANDLE;
 
 static ImGui_ImplVulkanH_Window g_MainWindowData;
@@ -55,16 +53,11 @@
 // All the ImGui_ImplVulkanH_XXX structures/functions are optional helpers used by the demo.
 // Your real engine/app may not use them.
-static void SetupVulkanWindow(ImGui_ImplVulkanH_Window* wd, VkSurfaceKHR surface, int width, int height)
-{
+
+static void SetupVulkanWindow(ImGui_ImplVulkanH_Window* wd, VkSurfaceKHR surface, SDL_Window* window) {
+   // TODO: SetupVulkanWIndow calls vkGetPhysicalDeviceSurfaceSupportKHR to get the present queue. In vulkan-game, I do this in findQueueFamilies.
+   int width, height;
+   SDL_GetWindowSize(window, &width, &height);
+
    wd->Surface = surface;
-
-   // Check for WSI support
-   VkBool32 res;
-   vkGetPhysicalDeviceSurfaceSupportKHR(g_PhysicalDevice, g_QueueFamily, wd->Surface, &res);
-   if (res != VK_TRUE)
-   {
-      fprintf(stderr, "Error no WSI support on physical device 0\n");
-      exit(-1);
-   }
 
    // Select Surface Format
@@ -84,5 +77,9 @@
    // Create SwapChain, RenderPass, Framebuffer, etc.
    IM_ASSERT(g_MinImageCount >= 2);
-   ImGui_ImplVulkanH_CreateOrResizeWindow(g_Instance, g_PhysicalDevice, g_Device, wd, g_QueueFamily, g_Allocator, width, height, g_MinImageCount);
+
+   QueueFamilyIndices indices = VulkanUtils::findQueueFamilies(g_PhysicalDevice, surface);
+
+   ImGui_ImplVulkanH_CreateOrResizeWindow(g_Instance, g_PhysicalDevice, g_Device, wd, indices.graphicsFamily.value(),
+      g_Allocator, width, height, g_MinImageCount);
 }
 
@@ -154,5 +151,5 @@
       err = vkEndCommandBuffer(fd->CommandBuffer);
       check_vk_result(err);
-      err = vkQueueSubmit(g_Queue, 1, &info, fd->Fence);
+      err = vkQueueSubmit(g_GraphicsQueue, 1, &info, fd->Fence);
       check_vk_result(err);
    }
@@ -171,5 +168,5 @@
    info.pSwapchains = &wd->Swapchain;
    info.pImageIndices = &wd->FrameIndex;
-   VkResult err = vkQueuePresentKHR(g_Queue, &info);
+   VkResult err = vkQueuePresentKHR(g_PresentQueue, &info);
    if (err == VK_ERROR_OUT_OF_DATE_KHR)
    {
@@ -212,255 +209,9 @@
    initVulkan();
 
+   VkResult err;
+
    // Create Framebuffers
-   int w, h;
-   SDL_GetWindowSize(window, &w, &h);
    ImGui_ImplVulkanH_Window* wd = &g_MainWindowData;
-   // TODO: SetupVulkanWIndow calls vkGetPhysicalDeviceSurfaceSupportKHR to get the present queue. In vulkan-game, I do this in findQueueFamilies.
-   SetupVulkanWindow(wd, surface, w, h);
-
-   // TODO: Start from here. I've already reviewed everything before this
-
-   // Setup Dear ImGui context
-   IMGUI_CHECKVERSION();
-   ImGui::CreateContext();
-   ImGuiIO& io = ImGui::GetIO(); (void)io;
-   //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;     // Enable Keyboard Controls
-   //io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad;      // Enable Gamepad Controls
-
-   // Setup Dear ImGui style
-   ImGui::StyleColorsDark();
-   //ImGui::StyleColorsClassic();
-
-   // Setup Platform/Renderer bindings
-   ImGui_ImplSDL2_InitForVulkan(window);
-   ImGui_ImplVulkan_InitInfo init_info = {};
-   init_info.Instance = g_Instance;
-   init_info.PhysicalDevice = g_PhysicalDevice;
-   init_info.Device = g_Device;
-   init_info.QueueFamily = g_QueueFamily;
-   init_info.Queue = g_Queue;
-   init_info.PipelineCache = g_PipelineCache;
-   init_info.DescriptorPool = g_DescriptorPool;
-   init_info.Allocator = g_Allocator;
-   init_info.MinImageCount = g_MinImageCount;
-   init_info.ImageCount = wd->ImageCount;
-   init_info.CheckVkResultFn = check_vk_result;
-   ImGui_ImplVulkan_Init(&init_info, wd->RenderPass);
-
-   // Load Fonts
-   // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them.
-   // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple.
-   // - If the file cannot be loaded, the function will return NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit).
-   // - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call.
-   // - Read 'docs/FONTS.md' for more instructions and details.
-   // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ !
-   //io.Fonts->AddFontDefault();
-   //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f);
-   //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f);
-   //io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f);
-   //io.Fonts->AddFontFromFileTTF("../../misc/fonts/ProggyTiny.ttf", 10.0f);
-   //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
-   //IM_ASSERT(font != NULL);
-
-   VkResult err;
-
-   // Upload Fonts
-   {
-      // Use any command queue
-      VkCommandPool command_pool = wd->Frames[wd->FrameIndex].CommandPool;
-      VkCommandBuffer command_buffer = wd->Frames[wd->FrameIndex].CommandBuffer;
-
-      err = vkResetCommandPool(g_Device, command_pool, 0);
-      check_vk_result(err);
-      VkCommandBufferBeginInfo begin_info = {};
-      begin_info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
-      begin_info.flags |= VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
-      err = vkBeginCommandBuffer(command_buffer, &begin_info);
-      check_vk_result(err);
-
-      ImGui_ImplVulkan_CreateFontsTexture(command_buffer);
-
-      VkSubmitInfo end_info = {};
-      end_info.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
-      end_info.commandBufferCount = 1;
-      end_info.pCommandBuffers = &command_buffer;
-      err = vkEndCommandBuffer(command_buffer);
-      check_vk_result(err);
-      err = vkQueueSubmit(g_Queue, 1, &end_info, VK_NULL_HANDLE);
-      check_vk_result(err);
-
-      err = vkDeviceWaitIdle(g_Device);
-      check_vk_result(err);
-      ImGui_ImplVulkan_DestroyFontUploadObjects();
-   }
-
-   // Our state
-   bool show_demo_window = true;
-   bool show_another_window = false;
-   ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
-
-   // Main loop
-   bool done = false;
-   while (!done) {
-      // Poll and handle events (inputs, window resize, etc.)
-      // You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.
-      // - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application.
-      // - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application.
-      // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
-      SDL_Event event;
-      while (SDL_PollEvent(&event)) {
-         ImGui_ImplSDL2_ProcessEvent(&event);
-         if (event.type == SDL_QUIT)
-            done = true;
-         if (event.type == SDL_WINDOWEVENT && event.window.event == SDL_WINDOWEVENT_CLOSE && event.window.windowID == SDL_GetWindowID(window))
-            done = true;
-      }
-
-      // Resize swap chain?
-      if (g_SwapChainRebuild) {
-         int width, height;
-         SDL_GetWindowSize(window, &width, &height);
-         if (width > 0 && height > 0)
-         {
-            ImGui_ImplVulkan_SetMinImageCount(g_MinImageCount);
-            ImGui_ImplVulkanH_CreateOrResizeWindow(g_Instance, g_PhysicalDevice, g_Device, &g_MainWindowData, g_QueueFamily, g_Allocator, width, height, g_MinImageCount);
-            g_MainWindowData.FrameIndex = 0;
-            g_SwapChainRebuild = false;
-         }
-      }
-
-      // Start the Dear ImGui frame
-      ImGui_ImplVulkan_NewFrame();
-      ImGui_ImplSDL2_NewFrame(window);
-      ImGui::NewFrame();
-
-      // 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
-      if (show_demo_window)
-         ImGui::ShowDemoWindow(&show_demo_window);
-
-      // 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
-      {
-         static float f = 0.0f;
-         static int counter = 0;
-
-         ImGui::Begin("Hello, world!");                          // Create a window called "Hello, world!" and append into it.
-
-         ImGui::Text("This is some useful text.");               // Display some text (you can use a format strings too)
-         ImGui::Checkbox("Demo Window", &show_demo_window);      // Edit bools storing our window open/close state
-         ImGui::Checkbox("Another Window", &show_another_window);
-
-         ImGui::SliderFloat("float", &f, 0.0f, 1.0f);            // Edit 1 float using a slider from 0.0f to 1.0f
-         ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
-
-         if (ImGui::Button("Button"))                            // Buttons return true when clicked (most widgets return true when edited/activated)
-            counter++;
-         ImGui::SameLine();
-         ImGui::Text("counter = %d", counter);
-
-         ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
-         ImGui::End();
-      }
-
-      // 3. Show another simple window.
-      if (show_another_window)
-      {
-         ImGui::Begin("Another Window", &show_another_window);   // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
-         ImGui::Text("Hello from another window!");
-         if (ImGui::Button("Close Me"))
-            show_another_window = false;
-         ImGui::End();
-      }
-
-      // Rendering
-      ImGui::Render();
-      ImDrawData* draw_data = ImGui::GetDrawData();
-      const bool is_minimized = (draw_data->DisplaySize.x <= 0.0f || draw_data->DisplaySize.y <= 0.0f);
-      if (!is_minimized)
-      {
-         memcpy(&wd->ClearValue.color.float32[0], &clear_color, 4 * sizeof(float));
-         FrameRender(wd, draw_data);
-         FramePresent(wd);
-      }
-   }
-
-   // Cleanup
-   err = vkDeviceWaitIdle(g_Device);
-   check_vk_result(err);
-   ImGui_ImplVulkan_Shutdown();
-   ImGui_ImplSDL2_Shutdown();
-   ImGui::DestroyContext();
-
-   CleanupVulkanWindow();
-   cleanup();
-
-   close_log();
-}
-
-bool VulkanGame::initUI(int width, int height, unsigned char guiFlags) {
-   // TODO: Create a game-gui function to get the gui version and retrieve it that way
-
-   SDL_VERSION(&sdlVersion); // This gets the compile-time version
-   SDL_GetVersion(&sdlVersion); // This gets the runtime version
-
-   cout << "SDL " <<
-      to_string(sdlVersion.major) << "." <<
-      to_string(sdlVersion.minor) << "." <<
-      to_string(sdlVersion.patch) << endl;
-
-   // TODO: Refactor the logger api to be more flexible,
-   // esp. since gl_log() and gl_log_err() have issues printing anything besides strings
-   restart_gl_log();
-   gl_log("starting SDL\n%s.%s.%s",
-      to_string(sdlVersion.major).c_str(),
-      to_string(sdlVersion.minor).c_str(),
-      to_string(sdlVersion.patch).c_str());
-
-   // TODO: Use open_Log() and related functions instead of gl_log ones
-   // TODO: In addition, delete the gl_log functions
-   open_log();
-   get_log() << "starting SDL" << endl;
-   get_log() <<
-      (int)sdlVersion.major << "." <<
-      (int)sdlVersion.minor << "." <<
-      (int)sdlVersion.patch << endl;
-
-   // TODO: Put all fonts, textures, and images in the assets folder
-   gui = new GameGui_SDL();
-
-   if (gui->init() == RTWO_ERROR) {
-      // TODO: Also print these sorts of errors to the log
-      cout << "UI library could not be initialized!" << endl;
-      cout << gui->getError() << endl;
-      return RTWO_ERROR;
-   }
-
-   window = (SDL_Window*)gui->createWindow("Vulkan Game", width, height, guiFlags & GUI_FLAGS_WINDOW_FULLSCREEN);
-   if (window == nullptr) {
-      cout << "Window could not be created!" << endl;
-      cout << gui->getError() << endl;
-      return RTWO_ERROR;
-   }
-
-   cout << "Target window size: (" << width << ", " << height << ")" << endl;
-   cout << "Actual window size: (" << gui->getWindowWidth() << ", " << gui->getWindowHeight() << ")" << endl;
-
-   return RTWO_SUCCESS;
-}
-
-void VulkanGame::initVulkan() {
-   const vector<const char*> validationLayers = {
-      "VK_LAYER_KHRONOS_validation"
-   };
-   const vector<const char*> deviceExtensions = {
-      VK_KHR_SWAPCHAIN_EXTENSION_NAME
-   };
-
-   createVulkanInstance(validationLayers);
-   setupDebugMessenger();
-   createVulkanSurface();
-   pickPhysicalDevice(deviceExtensions);
-   createLogicalDevice(validationLayers, deviceExtensions);
-
-   VkResult err;
+   SetupVulkanWindow(wd, surface, window);
 
    // Create Descriptor Pool
@@ -486,11 +237,252 @@
       pool_info.poolSizeCount = (uint32_t)IM_ARRAYSIZE(pool_sizes);
       pool_info.pPoolSizes = pool_sizes;
-      err = vkCreateDescriptorPool(g_Device, &pool_info, g_Allocator, &g_DescriptorPool);
-      check_vk_result(err);
-   }
+      err = vkCreateDescriptorPool(g_Device, &pool_info, g_Allocator, &descriptorPool);
+      check_vk_result(err);
+   }
+
+   // Setup Dear ImGui context
+   IMGUI_CHECKVERSION();
+   ImGui::CreateContext();
+   ImGuiIO& io = ImGui::GetIO(); (void)io;
+   //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;     // Enable Keyboard Controls
+   //io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad;      // Enable Gamepad Controls
+
+   // Setup Dear ImGui style
+   ImGui::StyleColorsDark();
+   //ImGui::StyleColorsClassic();
+
+   // Setup Platform/Renderer bindings
+   ImGui_ImplSDL2_InitForVulkan(window);
+   ImGui_ImplVulkan_InitInfo init_info = {};
+   init_info.Instance = g_Instance;
+   init_info.PhysicalDevice = g_PhysicalDevice;
+   init_info.Device = g_Device;
+   init_info.PipelineCache = g_PipelineCache;
+   init_info.DescriptorPool = descriptorPool;
+   init_info.Allocator = g_Allocator;
+   init_info.MinImageCount = g_MinImageCount;
+   init_info.ImageCount = wd->ImageCount;
+   init_info.CheckVkResultFn = check_vk_result;
+   ImGui_ImplVulkan_Init(&init_info, wd->RenderPass);
+
+   // Load Fonts
+   // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them.
+   // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple.
+   // - If the file cannot be loaded, the function will return NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit).
+   // - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call.
+   // - Read 'docs/FONTS.md' for more instructions and details.
+   // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ !
+   //io.Fonts->AddFontDefault();
+   //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f);
+   //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f);
+   //io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f);
+   //io.Fonts->AddFontFromFileTTF("../../misc/fonts/ProggyTiny.ttf", 10.0f);
+   //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
+   //IM_ASSERT(font != NULL);
+
+   // Upload Fonts
+   {
+      // Use any command queue
+      VkCommandPool command_pool = wd->Frames[wd->FrameIndex].CommandPool;
+      VkCommandBuffer command_buffer = wd->Frames[wd->FrameIndex].CommandBuffer;
+
+      err = vkResetCommandPool(g_Device, command_pool, 0);
+      check_vk_result(err);
+      VkCommandBufferBeginInfo begin_info = {};
+      begin_info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
+      begin_info.flags |= VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
+      err = vkBeginCommandBuffer(command_buffer, &begin_info);
+      check_vk_result(err);
+
+      ImGui_ImplVulkan_CreateFontsTexture(command_buffer);
+
+      VkSubmitInfo end_info = {};
+      end_info.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
+      end_info.commandBufferCount = 1;
+      end_info.pCommandBuffers = &command_buffer;
+      err = vkEndCommandBuffer(command_buffer);
+      check_vk_result(err);
+      err = vkQueueSubmit(graphicsQueue, 1, &end_info, VK_NULL_HANDLE);
+      check_vk_result(err);
+
+      err = vkDeviceWaitIdle(g_Device);
+      check_vk_result(err);
+      ImGui_ImplVulkan_DestroyFontUploadObjects();
+   }
+
+   // Our state
+   bool show_demo_window = true;
+   bool show_another_window = false;
+   ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
+
+   // Main loop
+   bool done = false;
+   while (!done) {
+      // Poll and handle events (inputs, window resize, etc.)
+      // You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.
+      // - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application.
+      // - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application.
+      // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
+      SDL_Event event;
+      while (SDL_PollEvent(&event)) {
+         ImGui_ImplSDL2_ProcessEvent(&event);
+         if (event.type == SDL_QUIT)
+            done = true;
+         if (event.type == SDL_WINDOWEVENT && event.window.event == SDL_WINDOWEVENT_CLOSE && event.window.windowID == SDL_GetWindowID(window))
+            done = true;
+      }
+
+      // Resize swap chain?
+      if (g_SwapChainRebuild) {
+         int width, height;
+         SDL_GetWindowSize(window, &width, &height);
+         if (width > 0 && height > 0)
+         {
+            ImGui_ImplVulkan_SetMinImageCount(g_MinImageCount);
+
+            QueueFamilyIndices indices = VulkanUtils::findQueueFamilies(g_PhysicalDevice, surface);
+
+            ImGui_ImplVulkanH_CreateOrResizeWindow(g_Instance, g_PhysicalDevice, g_Device, &g_MainWindowData,
+               indices.graphicsFamily.value(), g_Allocator, width, height, g_MinImageCount);
+            g_MainWindowData.FrameIndex = 0;
+            g_SwapChainRebuild = false;
+         }
+      }
+
+      // Start the Dear ImGui frame
+      ImGui_ImplVulkan_NewFrame();
+      ImGui_ImplSDL2_NewFrame(window);
+      ImGui::NewFrame();
+
+      // 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
+      if (show_demo_window)
+         ImGui::ShowDemoWindow(&show_demo_window);
+
+      // 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
+      {
+         static float f = 0.0f;
+         static int counter = 0;
+
+         ImGui::Begin("Hello, world!");                          // Create a window called "Hello, world!" and append into it.
+
+         ImGui::Text("This is some useful text.");               // Display some text (you can use a format strings too)
+         ImGui::Checkbox("Demo Window", &show_demo_window);      // Edit bools storing our window open/close state
+         ImGui::Checkbox("Another Window", &show_another_window);
+
+         ImGui::SliderFloat("float", &f, 0.0f, 1.0f);            // Edit 1 float using a slider from 0.0f to 1.0f
+         ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
+
+         if (ImGui::Button("Button"))                            // Buttons return true when clicked (most widgets return true when edited/activated)
+            counter++;
+         ImGui::SameLine();
+         ImGui::Text("counter = %d", counter);
+
+         ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
+         ImGui::End();
+      }
+
+      // 3. Show another simple window.
+      if (show_another_window)
+      {
+         ImGui::Begin("Another Window", &show_another_window);   // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
+         ImGui::Text("Hello from another window!");
+         if (ImGui::Button("Close Me"))
+            show_another_window = false;
+         ImGui::End();
+      }
+
+      // Rendering
+      ImGui::Render();
+      ImDrawData* draw_data = ImGui::GetDrawData();
+      const bool is_minimized = (draw_data->DisplaySize.x <= 0.0f || draw_data->DisplaySize.y <= 0.0f);
+      if (!is_minimized)
+      {
+         memcpy(&wd->ClearValue.color.float32[0], &clear_color, 4 * sizeof(float));
+         FrameRender(wd, draw_data);
+         FramePresent(wd);
+      }
+   }
+
+   // Cleanup
+   err = vkDeviceWaitIdle(g_Device);
+   check_vk_result(err);
+   ImGui_ImplVulkan_Shutdown();
+   ImGui_ImplSDL2_Shutdown();
+   ImGui::DestroyContext();
+
+   CleanupVulkanWindow();
+   cleanup();
+
+   close_log();
+}
+
+bool VulkanGame::initUI(int width, int height, unsigned char guiFlags) {
+   // TODO: Create a game-gui function to get the gui version and retrieve it that way
+
+   SDL_VERSION(&sdlVersion); // This gets the compile-time version
+   SDL_GetVersion(&sdlVersion); // This gets the runtime version
+
+   cout << "SDL " <<
+      to_string(sdlVersion.major) << "." <<
+      to_string(sdlVersion.minor) << "." <<
+      to_string(sdlVersion.patch) << endl;
+
+   // TODO: Refactor the logger api to be more flexible,
+   // esp. since gl_log() and gl_log_err() have issues printing anything besides strings
+   restart_gl_log();
+   gl_log("starting SDL\n%s.%s.%s",
+      to_string(sdlVersion.major).c_str(),
+      to_string(sdlVersion.minor).c_str(),
+      to_string(sdlVersion.patch).c_str());
+
+   // TODO: Use open_Log() and related functions instead of gl_log ones
+   // TODO: In addition, delete the gl_log functions
+   open_log();
+   get_log() << "starting SDL" << endl;
+   get_log() <<
+      (int)sdlVersion.major << "." <<
+      (int)sdlVersion.minor << "." <<
+      (int)sdlVersion.patch << endl;
+
+   // TODO: Put all fonts, textures, and images in the assets folder
+   gui = new GameGui_SDL();
+
+   if (gui->init() == RTWO_ERROR) {
+      // TODO: Also print these sorts of errors to the log
+      cout << "UI library could not be initialized!" << endl;
+      cout << gui->getError() << endl;
+      return RTWO_ERROR;
+   }
+
+   window = (SDL_Window*)gui->createWindow("Vulkan Game", width, height, guiFlags & GUI_FLAGS_WINDOW_FULLSCREEN);
+   if (window == nullptr) {
+      cout << "Window could not be created!" << endl;
+      cout << gui->getError() << endl;
+      return RTWO_ERROR;
+   }
+
+   cout << "Target window size: (" << width << ", " << height << ")" << endl;
+   cout << "Actual window size: (" << gui->getWindowWidth() << ", " << gui->getWindowHeight() << ")" << endl;
+
+   return RTWO_SUCCESS;
+}
+
+void VulkanGame::initVulkan() {
+   const vector<const char*> validationLayers = {
+      "VK_LAYER_KHRONOS_validation"
+   };
+   const vector<const char*> deviceExtensions = {
+      VK_KHR_SWAPCHAIN_EXTENSION_NAME
+   };
+
+   createVulkanInstance(validationLayers);
+   setupDebugMessenger();
+   createVulkanSurface();
+   pickPhysicalDevice(deviceExtensions);
+   createLogicalDevice(validationLayers, deviceExtensions);
 }
 
 void VulkanGame::cleanup() {
-   vkDestroyDescriptorPool(g_Device, g_DescriptorPool, g_Allocator);
+   vkDestroyDescriptorPool(g_Device, descriptorPool, g_Allocator);
 
    if (ENABLE_VALIDATION_LAYERS) {
@@ -633,8 +625,14 @@
       const vector<const char*>& deviceExtensions) {
    QueueFamilyIndices indices = VulkanUtils::findQueueFamilies(g_PhysicalDevice, surface);
-   g_QueueFamily = indices.graphicsFamily.value();
+
+   if (!indices.isComplete()) {
+      throw runtime_error("failed to find required queue families!");
+   }
+
+   // TODO: Using separate graphics and present queues currently works, but I should verify that I'm
+   // using them correctly to get the most benefit out of separate queues
 
    vector<VkDeviceQueueCreateInfo> queueCreateInfoList;
-   set<uint32_t> uniqueQueueFamilies = { indices.graphicsFamily.value() };
+   set<uint32_t> uniqueQueueFamilies = { indices.graphicsFamily.value(), indices.presentFamily.value() };
 
    float queuePriority = 1.0f;
@@ -668,6 +666,5 @@
       createInfo.enabledLayerCount = static_cast<uint32_t>(validationLayers.size());
       createInfo.ppEnabledLayerNames = validationLayers.data();
-   }
-   else {
+   } else {
       createInfo.enabledLayerCount = 0;
    }
@@ -677,8 +674,199 @@
    }
 
-   vkGetDeviceQueue(g_Device, g_QueueFamily, 0, &g_Queue);
-   //vkGetDeviceQueue(device, indices.graphicsFamily.value(), 0, &graphicsQueue);
-   //vkGetDeviceQueue(device, indices.presentFamily.value(), 0, &presentQueue);
+   vkGetDeviceQueue(g_Device, indices.graphicsFamily.value(), 0, &graphicsQueue);
+   vkGetDeviceQueue(g_Device, indices.presentFamily.value(), 0, &presentQueue);
+
+   g_GraphicsQueue = graphicsQueue;
+   g_PresentQueue = presentQueue;
 }
 
 /********************************************** END OF NEW CODE **********************************************/
+
+/********************************************** START TEMP HELPER GUNVTIONS **********************************/
+
+// Forward Declarations
+void ImGui_ImplVulkanH_DestroyFrame(VkDevice device, ImGui_ImplVulkanH_Frame* fd,
+   const VkAllocationCallbacks* allocator);
+void ImGui_ImplVulkanH_DestroyFrameSemaphores(VkDevice device, ImGui_ImplVulkanH_FrameSemaphores* fsd,
+   const VkAllocationCallbacks* allocator);
+void ImGui_ImplVulkanH_CreateWindowCommandBuffers(VkPhysicalDevice physical_device, VkDevice device,
+   ImGui_ImplVulkanH_Window* wd, uint32_t queue_family, const VkAllocationCallbacks* allocator);
+
+// Create or resize window
+void ImGui_ImplVulkanH_CreateOrResizeWindow(VkInstance instance, VkPhysicalDevice physical_device, VkDevice device,
+      ImGui_ImplVulkanH_Window* wd, uint32_t queue_family, const VkAllocationCallbacks* allocator, int width,
+      int height, uint32_t min_image_count) {
+   (void)instance;
+   ImGui_ImplVulkanH_CreateWindowSwapChain(physical_device, device, wd, allocator, width, height, min_image_count);
+   ImGui_ImplVulkanH_CreateWindowCommandBuffers(physical_device, device, wd, queue_family, allocator);
+}
+
+// Also destroy old swap chain and in-flight frames data, if any.
+void ImGui_ImplVulkanH_CreateWindowSwapChain(VkPhysicalDevice physical_device, VkDevice device,
+      ImGui_ImplVulkanH_Window* wd, const VkAllocationCallbacks* allocator, int w, int h, uint32_t min_image_count) {
+   VkResult err;
+   VkSwapchainKHR old_swapchain = wd->Swapchain;
+   wd->Swapchain = NULL;
+   err = vkDeviceWaitIdle(device);
+   check_vk_result(err);
+
+   // We don't use ImGui_ImplVulkanH_DestroyWindow() because we want to preserve the old swapchain to create the new one.
+   // Destroy old Framebuffer
+   for (uint32_t i = 0; i < wd->ImageCount; i++) {
+      ImGui_ImplVulkanH_DestroyFrame(device, &wd->Frames[i], allocator);
+      ImGui_ImplVulkanH_DestroyFrameSemaphores(device, &wd->FrameSemaphores[i], allocator);
+   }
+   IM_FREE(wd->Frames);
+   IM_FREE(wd->FrameSemaphores);
+   wd->Frames = NULL;
+   wd->FrameSemaphores = NULL;
+   wd->ImageCount = 0;
+   if (wd->RenderPass) {
+      vkDestroyRenderPass(device, wd->RenderPass, allocator);
+   }
+   if (wd->Pipeline) {
+      vkDestroyPipeline(device, wd->Pipeline, allocator);
+   }
+
+   // If min image count was not specified, request different count of images dependent on selected present mode
+   if (min_image_count == 0) {
+      min_image_count = ImGui_ImplVulkanH_GetMinImageCountFromPresentMode(wd->PresentMode);
+   }
+
+   // Create Swapchain
+   {
+      VkSwapchainCreateInfoKHR info = {};
+      info.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR;
+      info.surface = wd->Surface;
+      info.minImageCount = min_image_count;
+      info.imageFormat = wd->SurfaceFormat.format;
+      info.imageColorSpace = wd->SurfaceFormat.colorSpace;
+      info.imageArrayLayers = 1;
+      info.imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
+      info.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE;           // Assume that graphics family == present family
+      info.preTransform = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR;
+      info.compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
+      info.presentMode = wd->PresentMode;
+      info.clipped = VK_TRUE;
+      info.oldSwapchain = old_swapchain;
+      VkSurfaceCapabilitiesKHR cap;
+      err = vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physical_device, wd->Surface, &cap);
+      check_vk_result(err);
+      if (info.minImageCount < cap.minImageCount) {
+         info.minImageCount = cap.minImageCount;
+      } else if (cap.maxImageCount != 0 && info.minImageCount > cap.maxImageCount) {
+         info.minImageCount = cap.maxImageCount;
+      }
+
+      if (cap.currentExtent.width == 0xffffffff) {
+         info.imageExtent.width = wd->Width = w;
+         info.imageExtent.height = wd->Height = h;
+      } else {
+         info.imageExtent.width = wd->Width = cap.currentExtent.width;
+         info.imageExtent.height = wd->Height = cap.currentExtent.height;
+      }
+      err = vkCreateSwapchainKHR(device, &info, allocator, &wd->Swapchain);
+      check_vk_result(err);
+      err = vkGetSwapchainImagesKHR(device, wd->Swapchain, &wd->ImageCount, NULL);
+      check_vk_result(err);
+      VkImage backbuffers[16] = {};
+      IM_ASSERT(wd->ImageCount >= min_image_count);
+      IM_ASSERT(wd->ImageCount < IM_ARRAYSIZE(backbuffers));
+      err = vkGetSwapchainImagesKHR(device, wd->Swapchain, &wd->ImageCount, backbuffers);
+      check_vk_result(err);
+
+      IM_ASSERT(wd->Frames == NULL);
+      wd->Frames = (ImGui_ImplVulkanH_Frame*)IM_ALLOC(sizeof(ImGui_ImplVulkanH_Frame) * wd->ImageCount);
+      wd->FrameSemaphores = (ImGui_ImplVulkanH_FrameSemaphores*)IM_ALLOC(sizeof(ImGui_ImplVulkanH_FrameSemaphores) * wd->ImageCount);
+      memset(wd->Frames, 0, sizeof(wd->Frames[0]) * wd->ImageCount);
+      memset(wd->FrameSemaphores, 0, sizeof(wd->FrameSemaphores[0]) * wd->ImageCount);
+      for (uint32_t i = 0; i < wd->ImageCount; i++) {
+         wd->Frames[i].Backbuffer = backbuffers[i];
+      }
+   }
+   if (old_swapchain) {
+      vkDestroySwapchainKHR(device, old_swapchain, allocator);
+   }
+
+   // Create the Render Pass
+   {
+      VkAttachmentDescription attachment = {};
+      attachment.format = wd->SurfaceFormat.format;
+      attachment.samples = VK_SAMPLE_COUNT_1_BIT;
+      attachment.loadOp = wd->ClearEnable ? VK_ATTACHMENT_LOAD_OP_CLEAR : VK_ATTACHMENT_LOAD_OP_DONT_CARE;
+      attachment.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
+      attachment.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
+      attachment.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
+      attachment.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
+      attachment.finalLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR;
+      VkAttachmentReference color_attachment = {};
+      color_attachment.attachment = 0;
+      color_attachment.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
+      VkSubpassDescription subpass = {};
+      subpass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
+      subpass.colorAttachmentCount = 1;
+      subpass.pColorAttachments = &color_attachment;
+      VkSubpassDependency dependency = {};
+      dependency.srcSubpass = VK_SUBPASS_EXTERNAL;
+      dependency.dstSubpass = 0;
+      dependency.srcStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
+      dependency.dstStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
+      dependency.srcAccessMask = 0;
+      dependency.dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT;
+      VkRenderPassCreateInfo info = {};
+      info.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
+      info.attachmentCount = 1;
+      info.pAttachments = &attachment;
+      info.subpassCount = 1;
+      info.pSubpasses = &subpass;
+      info.dependencyCount = 1;
+      info.pDependencies = &dependency;
+      err = vkCreateRenderPass(device, &info, allocator, &wd->RenderPass);
+      check_vk_result(err);
+
+      // We do not create a pipeline by default as this is also used by examples' main.cpp,
+      // but secondary viewport in multi-viewport mode may want to create one with:
+      //ImGui_ImplVulkan_CreatePipeline(device, allocator, VK_NULL_HANDLE, wd->RenderPass, VK_SAMPLE_COUNT_1_BIT, &wd->Pipeline);
+   }
+
+   // Create The Image Views
+   {
+      VkImageViewCreateInfo info = {};
+      info.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
+      info.viewType = VK_IMAGE_VIEW_TYPE_2D;
+      info.format = wd->SurfaceFormat.format;
+      info.components.r = VK_COMPONENT_SWIZZLE_R;
+      info.components.g = VK_COMPONENT_SWIZZLE_G;
+      info.components.b = VK_COMPONENT_SWIZZLE_B;
+      info.components.a = VK_COMPONENT_SWIZZLE_A;
+      VkImageSubresourceRange image_range = { VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1 };
+      info.subresourceRange = image_range;
+      for (uint32_t i = 0; i < wd->ImageCount; i++) {
+         ImGui_ImplVulkanH_Frame* fd = &wd->Frames[i];
+         info.image = fd->Backbuffer;
+         err = vkCreateImageView(device, &info, allocator, &fd->BackbufferView);
+         check_vk_result(err);
+      }
+   }
+
+   // Create Framebuffer
+   {
+      VkImageView attachment[1];
+      VkFramebufferCreateInfo info = {};
+      info.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO;
+      info.renderPass = wd->RenderPass;
+      info.attachmentCount = 1;
+      info.pAttachments = attachment;
+      info.width = wd->Width;
+      info.height = wd->Height;
+      info.layers = 1;
+      for (uint32_t i = 0; i < wd->ImageCount; i++) {
+         ImGui_ImplVulkanH_Frame* fd = &wd->Frames[i];
+         attachment[0] = fd->BackbufferView;
+         err = vkCreateFramebuffer(device, &info, allocator, &fd->Framebuffer);
+         check_vk_result(err);
+      }
+   }
+}
+
+/*********************************************** END TEMP HELPER GUNVTIONS ***********************************/
Index: sdl-game.hpp
===================================================================
--- sdl-game.hpp	(revision 3b7d4970dceeff33d77df2de5074fb85023aa4e6)
+++ sdl-game.hpp	(revision 6493e439340a5e8c494580409ac38e03e31f7289)
@@ -7,4 +7,6 @@
 
 #include <SDL2/SDL.h>
+
+#include "IMGUI/imgui_impl_vulkan.h"
 
 #include "consts.hpp"
@@ -49,4 +51,7 @@
       VkDebugUtilsMessengerEXT debugMessenger = VK_NULL_HANDLE;
       VkSurfaceKHR surface; // TODO: Change the variable name to vulkanSurface
+
+      VkQueue graphicsQueue;
+      VkQueue presentQueue;
       
       // My code, but not complete. Skips creating the SDL renderer, probably because it doesn't use hardware acceleration.
@@ -64,5 +69,20 @@
       void createLogicalDevice(const vector<const char*>& validationLayers,
          const vector<const char*>& deviceExtensions); // Only creates the graphics queue. Later, checks that this queue also supports presenting, but this codebase does not seem to support a separate present queue
+
+      // Pipeline variables. Hopefully, I can eventually use the GraphicsPipeline_Vulkan class for the imgui pipeline
+      VkDescriptorPool descriptorPool;
+
 };
 
+// These functions are helper functions that were used in the ImGui Vulkan+SDL example
+
+void ImGui_ImplVulkanH_CreateOrResizeWindow(VkInstance instance, VkPhysicalDevice physical_device, VkDevice device,
+   ImGui_ImplVulkanH_Window* wnd, uint32_t queue_family, const VkAllocationCallbacks* allocator, int w, int h,
+   uint32_t min_image_count);
+
+void ImGui_ImplVulkanH_CreateWindowSwapChain(VkPhysicalDevice physical_device, VkDevice device,
+   ImGui_ImplVulkanH_Window* wd, const VkAllocationCallbacks* allocator, int w, int h, uint32_t min_image_count);
+
+// End helper functions
+
 #endif // _SDL_GAME_H
Index: vulkan-game.cpp
===================================================================
--- vulkan-game.cpp	(revision 3b7d4970dceeff33d77df2de5074fb85023aa4e6)
+++ vulkan-game.cpp	(revision 6493e439340a5e8c494580409ac38e03e31f7289)
@@ -234,6 +234,4 @@
    init_info.PhysicalDevice = this->physicalDevice;
    init_info.Device = this->device;
-   init_info.QueueFamily = indices.graphicsFamily.value();
-   init_info.Queue = this->graphicsQueue;
    init_info.PipelineCache = VK_NULL_HANDLE;
    init_info.DescriptorPool = this->imguiDescriptorPool; // TODO: Create a descriptor pool for IMGUI
