Basilisk CFD
Adaptive Cartesian mesh PDE framework
Loading...
Searching...
No Matches
debug.h
Go to the documentation of this file.
1/** @file debug.h
2 */
3// This is free and unencumbered software released into the public domain.
4//
5// Anyone is free to copy, modify, publish, use, compile, sell, or distribute
6// this software, either in source code form or as a compiled binary, for any
7// purpose, commercial or non-commercial, and by any means.
8//
9// In jurisdictions that recognize copyright laws, the author or authors of this
10// software dedicate any and all copyright interest in the software to the
11// public domain. We make this dedication for the benefit of the public at large
12// and to the detriment of our heirs and successors. We intend this dedication
13// to be an overt act of relinquishment in perpetuity of all present and future
14// rights to this software under copyright law.
15//
16// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22//
23// For more information, please refer to <http://unlicense.org/>
24
25// REQUIREMENTS: OpenGL version with the KHR_debug extension available.
26
27// Callback function for printing debug statements
30 const GLchar *msg, const void *data)
31{
32 char* _source;
33 char* _type;
34 char* _severity;
35
36 switch (source) {
38 _source = "API";
39 break;
40
42 _source = "WINDOW SYSTEM";
43 break;
44
46 _source = "SHADER COMPILER";
47 break;
48
50 _source = "THIRD PARTY";
51 break;
52
54 _source = "APPLICATION";
55 break;
56
58 _source = "UNKNOWN";
59 break;
60
61 default:
62 _source = "UNKNOWN";
63 break;
64 }
65
66 switch (type) {
68 _type = "ERROR";
69 break;
70
72 _type = "DEPRECATED BEHAVIOR";
73 break;
74
76 _type = "UDEFINED BEHAVIOR";
77 break;
78
80 _type = "PORTABILITY";
81 break;
82
84 _type = "PERFORMANCE";
85 break;
86
88 _type = "OTHER";
89 break;
90
92 _type = "MARKER";
93 break;
94
95 default:
96 _type = "UNKNOWN";
97 break;
98 }
99
100 switch (severity) {
102 _severity = "HIGH";
103 break;
104
106 _severity = "MEDIUM";
107 break;
108
110 _severity = "LOW";
111 break;
112
114 _severity = "NOTIFICATION";
115 break;
116
117 default:
118 _severity = "UNKNOWN";
119 break;
120 }
121
122 fprintf (stderr, "%d: %s of %s severity, raised from %s: %s\n",
123 id, _type, _severity, _source, msg);
124}
int x
Definition common.h:76
define sysmalloc malloc define syscalloc calloc define sysrealloc realloc define sysfree free define systrdup strdup define line line line line type
Definition config.h:571
void APIENTRY GLDebugMessageCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *msg, const void *data)
Definition debug.h:28
#define GL_DEBUG_TYPE_MARKER
Definition glad.h:1667
#define GL_DEBUG_SEVERITY_LOW
Definition glad.h:1666
#define GL_DEBUG_SOURCE_THIRD_PARTY
Definition glad.h:1652
#define GL_DEBUG_TYPE_PORTABILITY
Definition glad.h:1658
#define GL_DEBUG_TYPE_OTHER
Definition glad.h:1660
#define APIENTRY
Definition glad.h:38
#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR
Definition glad.h:1656
#define GL_DEBUG_SOURCE_APPLICATION
Definition glad.h:1653
#define GL_DEBUG_SOURCE_OTHER
Definition glad.h:1654
#define GL_DEBUG_SEVERITY_MEDIUM
Definition glad.h:1665
#define GL_DEBUG_SOURCE_SHADER_COMPILER
Definition glad.h:1651
unsigned int GLenum
Definition glad.h:92
#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR
Definition glad.h:1657
int GLsizei
Definition glad.h:103
#define GL_DEBUG_SEVERITY_NOTIFICATION
Definition glad.h:1670
#define GL_DEBUG_SOURCE_WINDOW_SYSTEM
Definition glad.h:1650
unsigned int GLuint
Definition glad.h:101
#define GL_DEBUG_SOURCE_API
Definition glad.h:1649
#define GL_DEBUG_TYPE_ERROR
Definition glad.h:1655
#define GL_DEBUG_SEVERITY_HIGH
Definition glad.h:1664
#define GL_DEBUG_TYPE_PERFORMANCE
Definition glad.h:1659
char GLchar
Definition glad.h:110
static float length(const KdtRect rect)
Definition kdt.c:444
#define data(k, l)
Definition linear.h:26
int source
Definition qcc.c:67