From 7153b56abc18f1a305cc368eaaace20b6df80766 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Wed, 10 Jun 2015 21:03:50 -0700 Subject: [PATCH] vk/private: Add a non-fatal assert --- src/vulkan/private.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/vulkan/private.h b/src/vulkan/private.h index 095f8f0f86e..9f1345fd8ed 100644 --- a/src/vulkan/private.h +++ b/src/vulkan/private.h @@ -107,6 +107,16 @@ void __anv_finishme(const char *file, int line, const char *format, ...) #define anv_finishme(format, ...) \ __anv_finishme(__FILE__, __LINE__, format, ##__VA_ARGS__); +/* A non-fatal assert. Useful for debugging. */ +#ifdef DEBUG +#define anv_assert(x) ({ \ + if (unlikely(!(x))) \ + fprintf(stderr, "%s:%d ASSERT: %s\n", __FILE__, __LINE__, #x); \ +}) +#else +#define anv_assert(x) +#endif + void anv_abortf(const char *format, ...) anv_noreturn anv_printflike(1, 2); void anv_abortfv(const char *format, va_list va) anv_noreturn; -- 2.30.2