yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

Ellie Hermaszewskaformatf65d756bf

master
1.4 KiB45 linesraw
1#ifndef RECORD_UTILITY_H
2#define RECORD_UTILITY_H
3
4// in gcc and clang, __PRETTY_FUNCTION__ is the function signature,
5// while MSVC uses __FUNCSIG__
6#ifdef _MSC_VER
7#define __PRETTY_FUNCTION__ __FUNCSIG__
8#endif
9
10namespace SlangRecord
11{
12enum LogLevel : unsigned int
13{
14    Silent = 0,
15    Error = 1,
16    Debug = 2,
17    Verbose = 3,
18};
19
20bool isRecordLayerEnabled();
21void slangRecordLog(LogLevel logLevel, const char* fmt, ...);
22void setLogLevel();
23} // namespace SlangRecord
24
25#define SLANG_RECORD_ASSERT(VALUE)                \
26    do                                            \
27    {                                             \
28        if (!(VALUE))                             \
29        {                                         \
30            SlangRecord::slangRecordLog(          \
31                SlangRecord::LogLevel::Error,     \
32                "Assertion failed: %s, %s, %d\n", \
33                #VALUE,                           \
34                __FILE__,                         \
35                __LINE__);                        \
36            std::abort();                         \
37        }                                         \
38    } while (0)
39
40#define SLANG_RECORD_CHECK(VALUE)                 \
41    do                                            \
42    {                                             \
43        SLANG_RECORD_ASSERT((VALUE) == SLANG_OK); \
44    } while (0)
45#endif // RECORD_UTILITY_H