extern Evas_GL_Program_Source shader_tex_frag_src;
extern Evas_GL_Program_Source shader_tex_vert_src;
-void glerr(const char *file, const char *func, int line, const char *op);
+void glerr(int err, const char *file, const char *func, int line, const char *op);
Evas_GL_Context *evas_gl_common_context_new(void);
void evas_gl_common_context_free(Evas_GL_Context *gc);
#define GL_ERRORS 1
#ifdef GL_ERRORS
-# define GLERR(fn, fl, ln, op) if (glGetError()) glerr(fn, fl, ln, op)
+# define GLERR(fn, fl, ln, op) \
+ { \
+ int __gl_err = glGetError(); \
+ if (__gl_err != GL_NO_ERROR) glerr(__gl_err, fn, fl, ln, op); \
+ }
#else
# define GLERR(fn, fl, ln, op)
#endif
static Evas_GL_Shared *shared = NULL;
void
-glerr(const char *file, const char *func, int line, const char *op)
+glerr(int err, const char *file, const char *func, int line, const char *op)
{
- GLenum err = glGetError();
- if (err != GL_NO_ERROR)
+ fprintf(stderr, "GLERR: %s:%i %s(), %s: ", file, line, func, op);
+ switch (err)
{
- fprintf(stderr, "GLERR: %s:%i %s(), %s: ", file, line, func, op);
- switch (err)
- {
- case GL_INVALID_ENUM:
- fprintf(stderr, "GL_INVALID_ENUM\n");
- break;
- case GL_INVALID_VALUE:
- fprintf(stderr, "GL_INVALID_VALUE\n");
- break;
- case GL_INVALID_OPERATION:
- fprintf(stderr, "GL_INVALID_OPERATION\n");
- break;
- case GL_OUT_OF_MEMORY:
- fprintf(stderr, "GL_OUT_OF_MEMORY\n");
- break;
- default:
- fprintf(stderr, "0x%x\n", err);
- }
+ case GL_INVALID_ENUM:
+ fprintf(stderr, "GL_INVALID_ENUM\n");
+ break;
+ case GL_INVALID_VALUE:
+ fprintf(stderr, "GL_INVALID_VALUE\n");
+ break;
+ case GL_INVALID_OPERATION:
+ fprintf(stderr, "GL_INVALID_OPERATION\n");
+ break;
+ case GL_OUT_OF_MEMORY:
+ fprintf(stderr, "GL_OUT_OF_MEMORY\n");
+ break;
+ default:
+ fprintf(stderr, "0x%x\n", err);
}
}