summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2015-06-10 21:03:50 -0700
committerJason Ekstrand <[email protected]>2015-06-10 21:03:50 -0700
commit7153b56abc18f1a305cc368eaaace20b6df80766 (patch)
tree00ae8fd29eac5a28e478015aebb15c05e565f495 /src
parent29d2bbb2b512dae78eb7eb29d1562c7a550806d3 (diff)
vk/private: Add a non-fatal assert
Diffstat (limited to 'src')
-rw-r--r--src/vulkan/private.h10
1 files changed, 10 insertions, 0 deletions
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;