From 035a5ab5603cbfabd3a2207bd26a1d59e9e57c7e Mon Sep 17 00:00:00 2001 From: saschawillems Date: Sun, 8 May 2016 11:18:39 +0200 Subject: [PATCH] Macro for checking and displaying Vulkan results --- base/vulkantools.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/base/vulkantools.h b/base/vulkantools.h index 6f56e2dd..98a3808d 100644 --- a/base/vulkantools.h +++ b/base/vulkantools.h @@ -34,6 +34,17 @@ // Default fence timeout in nanoseconds #define DEFAULT_FENCE_TIMEOUT 100000000000 +// Macro to check and display Vulkan return results +#define VK_CHECK_RESULT(f) \ +{ \ + VkResult res = (f); \ + if (res != VK_SUCCESS) \ + { \ + std::cout << "Fatal : VkResult is \"" << vkTools::errorString(res) << "\" in " << __FILE__ << " at line " << __LINE__ << std::endl; \ + assert(res == VK_SUCCESS); \ + } \ +} \ + namespace vkTools { // Check if extension is globally available