diff mbox

[3/9] gl: Embed the GL dispatch table in the cairo-gl context and initialize it.

Message ID 1311602713-6182-3-git-send-email-alexandros.frantzis@linaro.org
State Accepted
Headers show

Commit Message

alexandros.frantzis@linaro.org July 25, 2011, 2:05 p.m. UTC
From: Alexandros Frantzis <alexandros.frantzis@linaro.org>

---
 src/cairo-egl-context.c |    6 ++++++
 src/cairo-gl-private.h  |    2 ++
 src/cairo-glx-context.c |    7 +++++++
 src/cairo-wgl-context.c |    7 +++++++
 4 files changed, 22 insertions(+), 0 deletions(-)
diff mbox

Patch

diff --git a/src/cairo-egl-context.c b/src/cairo-egl-context.c
index a4ec281..b4c18fc 100644
--- a/src/cairo-egl-context.c
+++ b/src/cairo-egl-context.c
@@ -179,6 +179,12 @@  cairo_egl_device_create (EGLDisplay dpy, EGLContext egl)
 	}
     }
 
+    status = _cairo_gl_dispatch_init (&ctx->base.dispatch, eglGetProcAddress);
+    if (unlikely (status)) {
+	free (ctx);
+	return _cairo_gl_context_create_in_error (status);
+    }
+
     status = _cairo_gl_context_init (&ctx->base);
     if (unlikely (status)) {
 	if (ctx->dummy_surface != EGL_NO_SURFACE)
diff --git a/src/cairo-gl-private.h b/src/cairo-gl-private.h
index a050e18..be16ede 100644
--- a/src/cairo-gl-private.h
+++ b/src/cairo-gl-private.h
@@ -262,6 +262,8 @@  struct _cairo_gl_context {
     unsigned int vertex_size;
     cairo_region_t *clip_region;
 
+    cairo_gl_dispatch_t dispatch;
+
     void (*acquire) (void *ctx);
     void (*release) (void *ctx);
 
diff --git a/src/cairo-glx-context.c b/src/cairo-glx-context.c
index fa9d8be..83963fb 100644
--- a/src/cairo-glx-context.c
+++ b/src/cairo-glx-context.c
@@ -193,6 +193,13 @@  cairo_glx_device_create (Display *dpy, GLXContext gl_ctx)
     ctx->base.swap_buffers = _glx_swap_buffers;
     ctx->base.destroy = _glx_destroy;
 
+    status = _cairo_gl_dispatch_init (&ctx->base.dispatch,
+				      (cairo_gl_get_proc_addr_func_t) glXGetProcAddress);
+    if (unlikely (status)) {
+	free (ctx);
+	return _cairo_gl_context_create_in_error (status);
+    }
+
     status = _cairo_gl_context_init (&ctx->base);
     if (unlikely (status)) {
 	free (ctx);
diff --git a/src/cairo-wgl-context.c b/src/cairo-wgl-context.c
index 308d57a..82f1211 100644
--- a/src/cairo-wgl-context.c
+++ b/src/cairo-wgl-context.c
@@ -199,6 +199,13 @@  cairo_wgl_device_create (HGLRC rc)
     ctx->base.swap_buffers = _wgl_swap_buffers;
     ctx->base.destroy = _wgl_destroy;
 
+    status = _cairo_gl_dispatch_init (&ctx->base.dispatch,
+				      (cairo_gl_get_proc_addr_func_t) wglGetProcAddress);
+    if (unlikely (status)) {
+	free (ctx);
+	return _cairo_gl_context_create_in_error (status);
+    }
+
     status = _cairo_gl_context_init (&ctx->base);
     if (unlikely (status)) {
         free (ctx);