3 This file is part of gldbg
4 Copyright © 2010 Mikko Rasa, Mikkosoft Productions
5 Distributed under the GPL
10 #include "breakpoint.h"
11 #include "functions.h"
16 GLenum cur_error = GL_NO_ERROR;
18 static void check_error()
20 GLenum (*orig_glGetError)() = NULL;
24 orig_glGetError = glsym("glGetError");
26 code = orig_glGetError();
31 pkt = packet_begin(FUNC_GLDERROR);
32 packet_write_int(pkt, code);
33 packet_send(pkt, get_out_fd());
35 if(cur_error==GL_NO_ERROR)
40 GLenum APIENTRY glGetError()
42 GLenum ret = cur_error;
43 cur_error = GL_NO_ERROR;
46 pkt = packet_begin(FUNC_GLGETERROR);
47 packet_write_int(pkt, ret);
48 packet_send(pkt, get_out_fd());
53 void (*eglGetProcAddress(const char *procname))(void)
59 if(glsym((const char *)procname))
61 handle = dlopen(NULL, RTLD_LAZY);
62 ret = dlsym(handle, (const char *)procname);
65 pkt = packet_begin(FUNC_EGLGETPROCADDRESS);
66 packet_write_pointer(pkt, ret);
67 packet_write_string(pkt, (const char *)procname);
68 packet_send(pkt, get_out_fd());
73 #include "gensrc/glwrap.funcs"