aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlok Hota <[email protected]>2018-06-20 12:16:36 -0500
committerAlok Hota <[email protected]>2019-04-30 19:48:12 +0000
commit9d01f4d63137a87a55604409137df57fd0ca48b1 (patch)
tree3aebbd8f41e78b1d4e4bb3ad8fb74e63abbf4263
parent3851c6c9bf4c618ec6a8204a533eb606bd2f980d (diff)
swr/rast: add SWR_STATIC_ASSERT() macro
Reviewed-by: Bruce Cherniak <[email protected]>
-rw-r--r--src/gallium/drivers/swr/rasterizer/common/swr_assert.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/common/swr_assert.h b/src/gallium/drivers/swr/rasterizer/common/swr_assert.h
index d74b7981255..7e90e21e12f 100644
--- a/src/gallium/drivers/swr/rasterizer/common/swr_assert.h
+++ b/src/gallium/drivers/swr/rasterizer/common/swr_assert.h
@@ -192,7 +192,11 @@ void SwrTrace(
#define SWR_INVALID(...) \
_SWR_INVALID_CONCAT(_SWR_INVALID_, _SWR_INVALID_VARGS(_SWR_INVALID_VARGS_0 __VA_ARGS__())) \
(__VA_ARGS__)
-#endif
+
+#define SWR_STATIC_ASSERT(expression, ...) \
+ static_assert((expression), "Failed:\n " #expression "\n " __VA_ARGS__);
+
+#endif // SWR_ENABLE_REL_ASSERTS
#endif // C++
@@ -226,6 +230,9 @@ static bool SwrSizeofWorkaround(T)
#define SWR_REL_TRACE(_fmtstr, ...) \
_SWR_MACRO_START(void)(0); \
_SWR_MACRO_END
+#define SWR_STATIC_ASSERT(e, ...) \
+ _SWR_MACRO_START(void) sizeof(SwrSizeofWorkaround(e)); \
+ _SWR_MACRO_END
#endif
#if defined(_MSC_VER)