aboutsummaryrefslogtreecommitdiff
path: root/src/common/assert.h
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2019-03-27 14:59:00 -0400
committerFernandoS27 <fsahmkow27@gmail.com>2019-04-07 07:52:01 -0400
commita576cd4a8c0f924fca41ef8aa809e6073f03e4a5 (patch)
tree815d65ee43f554d4dd44f65b81f3428c7bbf492d /src/common/assert.h
parente4fefa80c145af875a86fcbaddaffe066627e257 (diff)
Permit a Null Shader in case of a bad host_ptr.
Diffstat (limited to 'src/common/assert.h')
-rw-r--r--src/common/assert.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/common/assert.h b/src/common/assert.h
index 6002f7ab16..4b0e3f64ee 100644
--- a/src/common/assert.h
+++ b/src/common/assert.h
@@ -57,3 +57,21 @@ __declspec(noinline, noreturn)
#define UNIMPLEMENTED_IF(cond) ASSERT_MSG(!(cond), "Unimplemented code!")
#define UNIMPLEMENTED_IF_MSG(cond, ...) ASSERT_MSG(!(cond), __VA_ARGS__)
+
+// If the assert is ignored, execute _b_
+#define ASSERT_OR_EXECUTE(_a_, _b_) \
+ do { \
+ ASSERT(_a_); \
+ if (!(_a_)) { \
+ _b_ \
+ } \
+ } while (0)
+
+// If the assert is ignored, execute _b_
+#define ASSERT_OR_EXECUTE_MSG(_a_, _b_, ...) \
+ do { \
+ ASSERT_MSG(_a_, __VA_ARGS__); \
+ if (!(_a_)) { \
+ _b_ \
+ } \
+ } while (0)