RavEngine
Loading...
Searching...
No Matches
RGLCommon.hpp
1#pragma once
2#include <RGL/Core.hpp>
3
4#define RGL_STATIC(a) decltype(a) a
5
6namespace RGL {
7 extern API currentAPI;
8
9 void LogMessage(MessageSeverity, const std::string&);
10 void FatalError(const std::string&);
11 void FatalError(const std::wstring&);
12
13 template<typename T>
14 static void Assert(bool cond, const T& errormsg) {
15 if (!cond) {
16 FatalError(errormsg);
17 }
18 }
19
20#if defined __APPLE__ || __STDC_VERSION__ >= 199901L //check for C99
21#define stackarray(name, type, size) type name[size] //prefer C VLA on supported systems
22#else
23#define stackarray(name, type, size) type* name = (type*)alloca(sizeof(type) * size) //warning: alloca may not be supported in the future
24#endif
25}