summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2010-06-18 12:17:36 +0200
committerBenjamin Otte <otte@redhat.com>2010-06-18 16:31:52 +0200
commit0f9a8cd18f14b1f23aaefe14db3b5ad07c84cff7 (patch)
treeeb40e0b51f3efc7df7ede7f676285203070e69c9
parent8048d3aa0a11ab1c054887682b8b2a899a87da0e (diff)
gl: Add a custom glGetError() function
This function clears all errors and returns the first one that happened.
-rw-r--r--src/cairo-gl-private.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/cairo-gl-private.h b/src/cairo-gl-private.h
index daba72a3..2cb1425d 100644
--- a/src/cairo-gl-private.h
+++ b/src/cairo-gl-private.h
@@ -223,15 +223,28 @@ typedef struct _cairo_gl_composite {
cairo_private extern const cairo_surface_backend_t _cairo_gl_surface_backend;
+static cairo_always_inline GLenum
+_cairo_gl_get_error (void)
+{
+ GLenum err = glGetError();
+
+ if (unlikely (err))
+ while (glGetError ());
+
+ return err;
+}
+
static cairo_always_inline cairo_status_t
_cairo_gl_check_error (void)
{
- cairo_status_t status = CAIRO_STATUS_SUCCESS;
+ cairo_status_t status;
GLenum err;
- while (unlikely ((err = glGetError ()))) {
+ err = _cairo_gl_get_error ();
+ if (unlikely (err))
status = _cairo_error (CAIRO_STATUS_DEVICE_ERROR);
- }
+ else
+ status = CAIRO_STATUS_SUCCESS;
return status;
}