From: Jason Ekstrand Date: Thu, 11 Jun 2015 04:03:50 +0000 (-0700) Subject: vk/private: Add a non-fatal assert X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7153b56abc18f1a305cc368eaaace20b6df80766;p=mesa.git vk/private: Add a non-fatal assert --- 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;