From: Damien Lespiau Date: Mon, 11 Jan 2010 00:15:25 +0000 (+0000) Subject: cogl: Introduce the GE_RET() debug macro X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c0f65212baee25dd4e66f4366a54bd847c782eb3;p=profile%2Fivi%2Fclutter.git 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. --- diff --git a/clutter/cogl/cogl/cogl-internal.h b/clutter/cogl/cogl/cogl-internal.h index f38107e..2645f7e 100644 --- a/clutter/cogl/cogl/cogl-internal.h +++ b/clutter/cogl/cogl/cogl-internal.h @@ -62,7 +62,7 @@ typedef struct _CoglBoxedValue const gchar *cogl_gl_error_to_string (GLenum error_code); -#define GE(x...) G_STMT_START { \ +#define GE(x) G_STMT_START { \ GLenum __err; \ (x); \ 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)); \ } } 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 */ #define GE(x) (x) +#define GE_RET(ret, x) (ret = (x)) #endif /* COGL_GL_DEBUG */