-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathegl_support.h
58 lines (53 loc) · 1.28 KB
/
egl_support.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef EGL_SUPPORT_H
#define EGL_SUPPORT_H
void egl_debug_handler(
EGLenum error, const char* cmd, EGLint msg_type,
EGLLabelKHR thr_lbl, EGLLabelKHR obj_lbl, const char* msg
) {
char* type;
switch(msg_type) {
case EGL_DEBUG_MSG_INFO_KHR:
type = "INFO";
break;
case EGL_DEBUG_MSG_WARN_KHR:
type = "WARN";
break;
case EGL_DEBUG_MSG_ERROR_KHR:
type = "ERROR";
break;
case EGL_DEBUG_MSG_CRITICAL_KHR:
type = "CRITICAL";
break;
}
fprintf(
stderr,
"Debug handler (%s):\n"
" - cmd: %s\n"
" - msg: %s\n",
type, cmd, msg
);
}
static PFNEGLDEBUGMESSAGECONTROLKHRPROC eglDebugMessageControlKHR;
static PFNEGLQUERYDEBUGKHRPROC eglQueryDebugKHR;
int egl_init_extensions() {
printf("egl_init_extensions():\n");
if((eglDebugMessageControlKHR =
(PFNEGLDEBUGMESSAGECONTROLKHRPROC)eglGetProcAddress("eglDebugMessageControlKHR")
) == NULL ||
(eglQueryDebugKHR =
(PFNEGLQUERYDEBUGKHRPROC)eglGetProcAddress("eglQueryDebugKHR")
) == NULL
) {
printf(" Error: Could not get extension address!\n");
return 1;
}
printf(
" Success:\n"
" - eglDebugMessageControlKHR = %p\n"
" - eglQueryDebugKHR = %p\n",
eglDebugMessageControlKHR,
eglQueryDebugKHR
);
return 0;
}
#endif