Blaze/MacroUtils.h

29 lines
677 B
C++

#pragma once
#include <cassert>
#include <utility>
#define G_ASSERT(COND) \
do { \
auto _result = (COND); \
if (not _result) { \
__debugbreak(); \
assert(_result && #COND); \
} \
} while(false)
#define ASSERT(COND) G_ASSERT(COND)
#define VK_CHECK(RESULT) \
do { \
auto _result = (RESULT); \
if (_result != VK_SUCCESS) { \
SDL_LogError(SDL_LOG_CATEGORY_SYSTEM, \
"" #RESULT " failed with %d at %s:%d", \
_result, __FILE__, __LINE__); \
__debugbreak(); \
assert(_result == VK_SUCCESS); \
} \
} while(false)
#define Take(OBJ) std::exchange(OBJ, {})