summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-07-23 05:11:07 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-07-23 05:11:07 +0000
commit9afd65cc2de12a9c2bc69d7a2a3c8d226901c53f (patch)
treee0531e3fa6fd2ae76395aafa403cf024270d8e15
parentFixed few minor issues with MAP_FLAG_DO_NOT_SYNCHRONIZE in D3D12 and Vulkan (diff)
downloadDiligentCore-9afd65cc2de12a9c2bc69d7a2a3c8d226901c53f.tar.gz
DiligentCore-9afd65cc2de12a9c2bc69d7a2a3c8d226901c53f.zip
Updated debug utilities to translate DEV_CHECK_ERR to VERIFY in debug build
-rw-r--r--Platforms/Basic/interface/DebugUtilities.h35
-rw-r--r--Primitives/interface/Errors.h14
2 files changed, 25 insertions, 24 deletions
diff --git a/Platforms/Basic/interface/DebugUtilities.h b/Platforms/Basic/interface/DebugUtilities.h
index 29a9d162..f30eef7b 100644
--- a/Platforms/Basic/interface/DebugUtilities.h
+++ b/Platforms/Basic/interface/DebugUtilities.h
@@ -24,30 +24,25 @@
#pragma once
#include "../../../Primitives/interface/FormatMessage.h"
+#include "../../../Primitives/interface/Errors.h"
#include "BasicPlatformDebug.h"
#ifdef _DEBUG
#include <typeinfo>
-// This function is only requried to ensure that Message argument passed to the macro
-// is actually string and not something else
-inline void EnsureStr( const char* ){}
-
-#define ASSERTION_FAILED(Message, ...)\
+#define ASSERTION_FAILED(...)\
do{ \
- EnsureStr(Message); \
Diligent::MsgStream ms; \
- Diligent::FormatMsg( ms, Message, ##__VA_ARGS__);\
+ Diligent::FormatMsg( ms, ##__VA_ARGS__);\
DebugAssertionFailed( ms.str().c_str(), __FUNCTION__, __FILE__, __LINE__); \
}while(false)
-# define VERIFY(Expr, Message, ...)\
+# define VERIFY(Expr, ...)\
do{ \
- EnsureStr(Message); \
if( !(Expr) ) \
{ \
- ASSERTION_FAILED(Message, ##__VA_ARGS__);\
+ ASSERTION_FAILED(##__VA_ARGS__);\
} \
}while(false)
@@ -74,3 +69,23 @@ void CheckDynamicType( SrcType *pSrcPtr )
# define VERIFY_EXPR(...)do{}while(false)
#endif
+
+#if defined(_DEBUG)
+# define DEV_CHECK_ERR(Expr, ...) VERIFY(Expr, ##__VA_ARGS__)
+#elif defined(DEVELOPMENT)
+# define DEV_CHECK_ERR(Expr, ...) CHECK_ERR(Expr, ##__VA_ARGS__)
+#else
+# define DEV_CHECK_ERR(Expr, ...) do{}while(false)
+#endif
+
+#ifdef DEVELOPMENT
+
+#define DEV_CHECK_WARN(Expr, ...) CHECK_WARN(Expr, ##__VA_ARGS__)
+#define DEV_CHECK_INFO(Expr, ...) CHECK_INFO(Expr, ##__VA_ARGS__)
+
+#else
+
+#define DEV_CHECK_WARN(Expr, ...) do{}while(false)
+#define DEV_CHECK_INFO(Expr, ...) do{}while(false)
+
+#endif
diff --git a/Primitives/interface/Errors.h b/Primitives/interface/Errors.h
index 8a4ade37..187a55ce 100644
--- a/Primitives/interface/Errors.h
+++ b/Primitives/interface/Errors.h
@@ -140,17 +140,3 @@ do{ \
} \
}while(false)
-
-#ifdef DEVELOPMENT
-
-#define DEV_CHECK_ERR(Expr, ...) CHECK_ERR (Expr, ##__VA_ARGS__)
-#define DEV_CHECK_WARN(Expr, ...) CHECK_WARN(Expr, ##__VA_ARGS__)
-#define DEV_CHECK_INFO(Expr, ...) CHECK_INFO(Expr, ##__VA_ARGS__)
-
-#else
-
-#define DEV_CHECK_ERR(Expr, ...) do{}while(false)
-#define DEV_CHECK_WARN(Expr, ...) do{}while(false)
-#define DEV_CHECK_INFO(Expr, ...) do{}while(false)
-
-#endif