aboutsummaryrefslogtreecommitdiff
path: root/debuggl/debuggl.h
blob: 4d8dff9801bc9101f8fd709f699a04e6932786e5 (plain)
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
#pragma once
#ifndef DEBUGGL_H
#define DEBUGGL_H

/* execute a OpenGL but check for errors only if compiled for debugging */
#ifndef NDEBUG
#define debuggl_trace(glcmd) \
	({ glcmd; debuggl_trace_call(__FILE__, __func__, __LINE__, #glcmd); })
#else
#define debuggl_trace(glcmd) glcmd
#endif

/* check for OpenGL errors */
#define debuggl_check(glcmd) \
	({ glcmd; debuggl_check_call(__FILE__, __func__, __LINE__, #glcmd); })

int debuggl_check_call(
	char const * const file,
	char const * const func,
	unsigned int const line,
	char const * const what);

int debuggl_trace_call(
	char const * const file,
	char const * const func,
	unsigned int const line,
	char const * const what);

#endif/*DEBUGGL_H*/