Index: sdl-game.cpp
===================================================================
--- sdl-game.cpp	(revision ce9dc9f8d30ef01e9f3c1de05482d87c6c4a1144)
+++ sdl-game.cpp	(revision d8cf709c0d0adf8142fb20befd80d09d2e505e77)
@@ -6,6 +6,4 @@
 #include <stdexcept>
 
-#include <stdlib.h>         // abort (only used in check_vk_result)
-
 #include <SDL2/SDL_vulkan.h>
 
@@ -20,11 +18,15 @@
 static bool g_SwapChainRebuild = false;
 
-static void check_vk_result(VkResult err) {
-   if (err == 0) {
+static void check_imgui_vk_result(VkResult res) {
+   if (res == VK_SUCCESS) {
       return;
    }
-   fprintf(stderr, "[vulkan] Error: VkResult = %d\n", err);
-   if (err < 0) {
-      abort();
+
+   ostringstream oss;
+   oss << "[imgui] Vulkan error! VkResult is \"" << VulkanUtils::resultString(res) << "\"" << __LINE__;
+   if (res < 0) {
+         throw runtime_error("Fatal: " + oss.str());
+   } else {
+         cerr << oss.str();
    }
 }
@@ -37,14 +39,13 @@
       g_SwapChainRebuild = true;
       return;
-   } else if (result != VK_SUCCESS) {
-      throw runtime_error("failed to acquire swap chain image!");
-   }
-
-   if (vkWaitForFences(device, 1, &inFlightFences[imageIndex], VK_TRUE, numeric_limits<uint64_t>::max()) != VK_SUCCESS) {
-      throw runtime_error("failed waiting for fence!");
-   }
-   if (vkResetFences(device, 1, &inFlightFences[imageIndex]) != VK_SUCCESS) {
-      throw runtime_error("failed to reset fence!");
-   }
+   } else {
+      VKUTIL_CHECK_RESULT(result, "failed to acquire swap chain image!");
+   }
+
+   VKUTIL_CHECK_RESULT(vkWaitForFences(device, 1, &inFlightFences[imageIndex], VK_TRUE, numeric_limits<uint64_t>::max()),
+      "failed waiting for fence!");
+
+   VKUTIL_CHECK_RESULT(vkResetFences(device, 1, &inFlightFences[imageIndex]),
+      "failed to reset fence!");
 
    // START OF NEW CODE
@@ -52,11 +53,13 @@
    // before the render loop ever starts. I should change this
 
-   result = vkResetCommandPool(device, commandPools[imageIndex], 0);
-   check_vk_result(result);
+   VKUTIL_CHECK_RESULT(vkResetCommandPool(device, commandPools[imageIndex], 0),
+      "failed to reset command pool!");
+
    VkCommandBufferBeginInfo info = {};
    info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
    info.flags |= VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
-   result = vkBeginCommandBuffer(commandBuffers[imageIndex], &info);
-   check_vk_result(result);
+
+   VKUTIL_CHECK_RESULT(vkBeginCommandBuffer(commandBuffers[imageIndex], &info),
+      "failed to begin recording command buffer!");
 
    VkRenderPassBeginInfo renderPassInfo = {};
@@ -81,7 +84,6 @@
    vkCmdEndRenderPass(commandBuffers[imageIndex]);
 
-   if (vkEndCommandBuffer(commandBuffers[imageIndex]) != VK_SUCCESS) {
-      throw runtime_error("failed to record command buffer!");
-   }
+   VKUTIL_CHECK_RESULT(vkEndCommandBuffer(commandBuffers[imageIndex]),
+      "failed to record command buffer!");
 
    // END OF NEW CODE
@@ -101,7 +103,6 @@
    submitInfo.pSignalSemaphores = signalSemaphores;
 
-   if (vkQueueSubmit(graphicsQueue, 1, &submitInfo, inFlightFences[imageIndex]) != VK_SUCCESS) {
-      throw runtime_error("failed to submit draw command buffer!");
-   }
+   VKUTIL_CHECK_RESULT(vkQueueSubmit(graphicsQueue, 1, &submitInfo, inFlightFences[imageIndex]),
+      "failed to submit draw command buffer!");
 }
 
@@ -196,5 +197,7 @@
       pool_info.poolSizeCount = (uint32_t)IM_ARRAYSIZE(pool_sizes);
       pool_info.pPoolSizes = pool_sizes;
-      check_vk_result(vkCreateDescriptorPool(device, &pool_info, nullptr, &descriptorPool));
+
+      VKUTIL_CHECK_RESULT(vkCreateDescriptorPool(device, &pool_info, nullptr, &descriptorPool),
+         "failed to create descriptor pool");
    }
 
@@ -225,5 +228,5 @@
    init_info.MinImageCount = swapChainMinImageCount;
    init_info.ImageCount = swapChainImageCount;
-   init_info.CheckVkResultFn = check_vk_result;
+   init_info.CheckVkResultFn = check_imgui_vk_result;
    ImGui_ImplVulkan_Init(&init_info, renderPass);
 
