cogl: Introduce the GE_RET() debug macro

Some GL functions have a return value that the GE() macro is not able to
handle. Let's define a new Ge_RET() macro which will be able to handle
functions such as glMapBuffer().

While at it, removed the unused variadic dots to the GE() macro.
This commit is contained in:
Damien Lespiau 2010-01-11 00:15:25 +00:00
parent 069ba6daf9
commit c0f65212ba

View File

@ -62,7 +62,7 @@ typedef struct _CoglBoxedValue
const gchar *cogl_gl_error_to_string (GLenum error_code); const gchar *cogl_gl_error_to_string (GLenum error_code);
#define GE(x...) G_STMT_START { \ #define GE(x) G_STMT_START { \
GLenum __err; \ GLenum __err; \
(x); \ (x); \
while ((__err = glGetError ()) != GL_NO_ERROR) \ while ((__err = glGetError ()) != GL_NO_ERROR) \
@ -73,9 +73,21 @@ const gchar *cogl_gl_error_to_string (GLenum error_code);
cogl_gl_error_to_string (__err)); \ cogl_gl_error_to_string (__err)); \
} } G_STMT_END } } G_STMT_END
#define GE_RET(ret, x) G_STMT_START { \
GLenum __err; \
ret = (x); \
while ((__err = glGetError ()) != GL_NO_ERROR) \
{ \
g_warning ("%s: GL error (%d): %s\n", \
G_STRLOC, \
__err, \
cogl_gl_error_to_string (__err)); \
} } G_STMT_END
#else /* !COGL_GL_DEBUG */ #else /* !COGL_GL_DEBUG */
#define GE(x) (x) #define GE(x) (x)
#define GE_RET(ret, x) (ret = (x))
#endif /* COGL_GL_DEBUG */ #endif /* COGL_GL_DEBUG */