From 7c2d6db2e71f2f031edb86a6addc63afc838e3cc Mon Sep 17 00:00:00 2001 From: Riley King-Saunders Date: Tue, 24 Jun 2025 15:35:45 +1000 Subject: [PATCH] Added VK_ASSERT macro to save some boilerplate when checking 'VkResult err;' sections --- include/core/basalt_logger.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/core/basalt_logger.h b/include/core/basalt_logger.h index b70365d..0a493e4 100644 --- a/include/core/basalt_logger.h +++ b/include/core/basalt_logger.h @@ -60,6 +60,14 @@ void basalt_write(const LOG_LEVEL level, const char* msg, ...); #define BDEBUG(msg, ...) basalt_log(LOG_DEBUG, msg, ##__VA_ARGS__); #define BTRACE(msg, ...) basalt_log(LOG_TRACE, msg, ##__VA_ARGS__); +#define VK_ASSERT(call, msg, ...) \ + if ((err = (call)) == VK_SUCCESS) {} \ + else { \ + BFATAL(msg, __FILE__, __LINE__, string_VkResult(err), ##__VA_ARGS__); \ + debug_break(); \ + exit(-1); \ + } + #define BASSERT_FATAL(cond, msg, ...) \ if (cond){} \ else { \