CompileTimeSettings.hh 2.65 KB
Newer Older
Robert Menzel's avatar
Robert Menzel committed
1
2
3
4
////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2011, Computer Graphics Group RWTH Aachen University         //
// All rights reserved.                                                       //
////////////////////////////////////////////////////////////////////////////////
Robert Menzel's avatar
Robert Menzel committed
5

6
7
#ifndef ACGL_BASE_COMPILETIMESETTINGS_HH
#define ACGL_BASE_COMPILETIMESETTINGS_HH
Robert Menzel's avatar
Robert Menzel committed
8
9

/*
10
 * OpenGL error checking defines
Robert Menzel's avatar
Robert Menzel committed
11
12
13
14
15
 *
 * By default, only critical errors will get checked in release build
 * and critical&common in debug build.
 *
 * This can get overwritten with a compile flag define:
16
 *  -DACGL_ERROR_LEVEL_EC0
Robert Menzel's avatar
Robert Menzel committed
17
 *    No error checking at all
18
 *  -DACGL_ERROR_LEVEL_EC1
Robert Menzel's avatar
Robert Menzel committed
19
20
21
22
 *    Places will get checked where errors like out of memory can occur.
 *    This will detect runtime errors which can happen even if the program
 *    is bug free.
 *    Switching this on shouldn't be a performance hit.
23
 *  -DACGL_ERROR_LEVEL_EC2
Robert Menzel's avatar
Robert Menzel committed
24
25
 *    Problems that happen more often while developing like typos in uniform
 *    names. All placed where strings are used to call OpenGL objects etc.
26
 *  -DACGL_ERROR_LEVEL_EC3
Robert Menzel's avatar
Robert Menzel committed
27
28
29
30
31
32
33
 *    Most likely bugs in ACGL itself or wrong usage. If there are strange errors
 *    switch this on to find the reason more quickly. Even normal development
 *    should work without this. Results in a lot of glGetError!
 *
 * Note that all error levels also include the higher ones (COMMON also adds CRITICAL).
 */

34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
 * Map CMake generated error-level defines to internally used, more readable defines
 */
#ifdef ACGL_ERROR_LEVEL_EC0
#   define ACGL_CHECK_NO_GL_ERRORS
#endif
#ifdef ACGL_ERROR_LEVEL_EC1
#   define ACGL_CHECK_CRITICAL_GL_ERRORS
#endif
#ifdef ACGL_ERROR_LEVEL_EC2
#   define ACGL_CHECK_COMMON_GL_ERRORS
#endif
#ifdef ACGL_ERROR_LEVEL_EC3
#   define ACGL_CHECK_RARE_GL_ERRORS
#endif

Robert Menzel's avatar
Robert Menzel committed
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89

#ifndef ACGL_CHECK_NO_GL_ERRORS
# ifndef ACGL_CHECK_CRITICAL_GL_ERRORS
#  ifndef ACGL_CHECK_COMMON_GL_ERRORS
#   ifndef ACGL_CHECK_RARE_GL_ERRORS
//   if nothing is defined, use defaults:
#    ifdef DEBUG
#     define ACGL_CHECK_COMMON_GL_ERRORS
#    else
#     define ACGL_CHECK_CRITICAL_GL_ERRORS
#    endif
#   endif
#  endif
# endif
#endif


// if rare is set, set also common:
#ifdef ACGL_CHECK_RARE_GL_ERRORS
# ifndef ACGL_CHECK_COMMON_GL_ERRORS
#  define ACGL_CHECK_COMMON_GL_ERRORS
# endif
#endif

// if common is set, set also critical:
#ifdef ACGL_CHECK_COMMON_GL_ERRORS
# ifndef ACGL_CHECK_CRITICAL_GL_ERRORS
#  define ACGL_CHECK_CRITICAL_GL_ERRORS
# endif
#endif

// if critical is set, NO must not be set:
#ifdef ACGL_CHECK_CRITICAL_GL_ERRORS
# ifdef ACGL_CHECK_NO_GL_ERRORS
#  undef ACGL_CHECK_NO_GL_ERRORS
# endif
#endif



90
#endif // ACGL_BASE_COMPILETIMESETTINGS_HH
Robert Menzel's avatar
Robert Menzel committed
91