mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
synced 2024-11-26 16:34:35 +00:00
Improved macros TEST, ERR_GUARD_VULKAN
This commit is contained in:
parent
4b047fde54
commit
48e3d88114
24
src/Common.h
24
src/Common.h
@ -48,21 +48,17 @@
|
|||||||
typedef std::chrono::high_resolution_clock::time_point time_point;
|
typedef std::chrono::high_resolution_clock::time_point time_point;
|
||||||
typedef std::chrono::high_resolution_clock::duration duration;
|
typedef std::chrono::high_resolution_clock::duration duration;
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#define STRINGIZE(x) STRINGIZE2(x)
|
||||||
#define TEST(expr) do { \
|
#define STRINGIZE2(x) #x
|
||||||
if(!(expr)) { \
|
#define LINE_STRING STRINGIZE(__LINE__)
|
||||||
|
#define TEST(expr) do { if(!(expr)) { \
|
||||||
assert(0 && #expr); \
|
assert(0 && #expr); \
|
||||||
} \
|
throw std::runtime_error(__FILE__ "(" LINE_STRING "): ( " #expr " ) == false"); \
|
||||||
} while(0)
|
} } while(false)
|
||||||
#else
|
#define ERR_GUARD_VULKAN(expr) do { if((expr) < 0) { \
|
||||||
#define TEST(expr) do { \
|
assert(0 && #expr); \
|
||||||
if(!(expr)) { \
|
throw std::runtime_error(__FILE__ "(" LINE_STRING "): VkResult( " #expr " ) < 0"); \
|
||||||
throw std::runtime_error("TEST FAILED: " #expr); \
|
} } while(false)
|
||||||
} \
|
|
||||||
} while(0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define ERR_GUARD_VULKAN(expr) TEST((expr) >= 0)
|
|
||||||
|
|
||||||
static const uint32_t VENDOR_ID_AMD = 0x1002;
|
static const uint32_t VENDOR_ID_AMD = 0x1002;
|
||||||
static const uint32_t VENDOR_ID_NVIDIA = 0x10DE;
|
static const uint32_t VENDOR_ID_NVIDIA = 0x10DE;
|
||||||
|
Loading…
Reference in New Issue
Block a user