Add an internal ASSERT macro
This macro has some advantages over the standard library one:
- It prints the place where the macro was triggered
- It "references" the condition even in Release to avoid warnings
- In release, if possible, it gives compiler hints
It is basically is stripped down version of the ASSERT macros I wrote
for the Daemon engine in src/common/Assert.h
This commit also removes the stray "backend" namespaces for common/
code.
diff --git a/src/backend/Buffer.cpp b/src/backend/Buffer.cpp
index 5299f69..98781da 100644
--- a/src/backend/Buffer.cpp
+++ b/src/backend/Buffer.cpp
@@ -15,6 +15,7 @@
#include "backend/Buffer.h"
#include "backend/Device.h"
+#include "common/Assert.h"
#include <utility>
#include <cstdio>
@@ -146,7 +147,7 @@
}
void BufferBase::UpdateUsageInternal(nxt::BufferUsageBit usage) {
- assert(IsTransitionPossible(usage));
+ ASSERT(IsTransitionPossible(usage));
currentUsage = usage;
}