From 4ada72a397c79021a0f081a16fa3c7ee7cf17f30 Mon Sep 17 00:00:00 2001 From: Giovanni Mascellani Date: Tue, 18 Jun 2024 12:37:47 +0200 Subject: [PATCH] vkd3d: Allow aborting on ERR(). --- include/private/vkd3d_common.h | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/include/private/vkd3d_common.h b/include/private/vkd3d_common.h index 1a217044..6b6b6a14 100644 --- a/include/private/vkd3d_common.h +++ b/include/private/vkd3d_common.h @@ -161,7 +161,7 @@ const char *debugstr_w(const WCHAR *wstr, size_t wchar_size); #define VKD3D_DBG_LOG(level) \ do { \ const enum vkd3d_dbg_level vkd3d_dbg_level = VKD3D_DBG_LEVEL_##level; \ - VKD3D_DBG_PRINTF + VKD3D_DBG_PRINTF_##level #define VKD3D_DBG_LOG_ONCE(first_time_level, level) \ do { \ @@ -169,11 +169,25 @@ const char *debugstr_w(const WCHAR *wstr, size_t wchar_size); const enum vkd3d_dbg_level vkd3d_dbg_level = vkd3d_dbg_next_time \ ? VKD3D_DBG_LEVEL_##level : VKD3D_DBG_LEVEL_##first_time_level; \ vkd3d_dbg_next_time = true; \ - VKD3D_DBG_PRINTF + VKD3D_DBG_PRINTF_##level #define VKD3D_DBG_PRINTF(...) \ vkd3d_dbg_printf(vkd3d_dbg_level, __FUNCTION__, __VA_ARGS__); } while (0) +#define VKD3D_DBG_PRINTF_TRACE(...) VKD3D_DBG_PRINTF(__VA_ARGS__) +#define VKD3D_DBG_PRINTF_WARN(...) VKD3D_DBG_PRINTF(__VA_ARGS__) +#define VKD3D_DBG_PRINTF_FIXME(...) VKD3D_DBG_PRINTF(__VA_ARGS__) +#define VKD3D_DBG_PRINTF_MESSAGE(...) VKD3D_DBG_PRINTF(__VA_ARGS__) + +#ifdef VKD3D_ABORT_ON_ERR +#define VKD3D_DBG_PRINTF_ERR(...) \ + vkd3d_dbg_printf(vkd3d_dbg_level, __FUNCTION__, __VA_ARGS__); \ + abort(); \ + } while (0) +#else +#define VKD3D_DBG_PRINTF_ERR(...) VKD3D_DBG_PRINTF(__VA_ARGS__) +#endif + #ifndef TRACE #define TRACE VKD3D_DBG_LOG(TRACE) #endif