Skip to content

Commit d7a9e13

Browse files
author
devsh
committed
don't compile HLSL assert without NBL_DEBUG
1 parent 987a5de commit d7a9e13

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

include/nbl/builtin/hlsl/macros.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,26 @@
55
#define _NBL_BUILTIN_HLSL_MACROS_INCLUDED_
66

77
#ifdef __HLSL_VERSION
8+
// TODO: DXC doesn't get this, we need our own
89
#define static_assert(...) _Static_assert(__VA_ARGS__)
10+
911
// TODO: switch between enabled and disabled depending on Nabla build config
10-
#define assert(expr) \
12+
#ifdef _NBL_DEBUG
13+
#define assert(...) \
1114
{ \
12-
bool con = (expr); \
15+
bool con = (__VA_ARGS__); \
1316
do { \
1417
[branch] if (!con) \
1518
vk::RawBufferStore<uint32_t>(0xdeadbeefBADC0FFbull,0x45u,4u); \
1619
} while(!con); \
1720
}
21+
#else
22+
#define assert(...)
23+
#endif
24+
1825
#else
1926

27+
// TODO: this is kinda useless, remove
2028
#define NBL_ALIAS_TEMPLATE_FUNCTION(origFunctionName, functionAlias) \
2129
template<typename... Args> \
2230
inline auto functionAlias(Args&&... args) -> decltype(origFunctionName(std::forward<Args>(args)...)) \

0 commit comments

Comments
 (0)