[waffle] [PATCH 13/18] api: make dl_can_open() dl_sym() display dependent

Emil Velikov emil.l.velikov at gmail.com
Tue Jul 22 20:31:39 PDT 2014


This will allow us to correctly work around waffle design which
allows the a library to be dl_open'ed if we support the corresponding
WAFFLE_CONTEXT (via waffle_display_supports_context_api).

This is required by WGL which (as implemented in this patch) can
support ES contexts via EXT_create_context_es*_profile yet provides
all the symbols via a single library. We should check if ES context
can be create prior rather than blindly trying to retrieve the symbols.

Once waffle has GL dispatch we can remove all the dl functions from
the waffle API, as we'll provide every function that the user needs.

Note that this breaks the API in a non-backwards compatible way.

TODO:
 - Add a note in the release notes.

Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
 examples/gl_basic.c                   | 10 +++++-----
 examples/simple-x11-egl.c             |  6 +++---
 include/waffle/waffle.h               |  4 ++--
 man/waffle_dl.3.xml                   |  2 ++
 src/utils/wflinfo.c                   |  6 +++---
 src/waffle/android/droid_platform.c   |  2 ++
 src/waffle/api/waffle_dl.c            | 23 +++++++++++++++++------
 src/waffle/cgl/cgl_dl.h               |  6 ++++--
 src/waffle/cgl/cgl_dl.m               |  7 +++++--
 src/waffle/core/wcore_platform.h      |  2 ++
 src/waffle/egl/wegl_config.c          |  9 +++++----
 src/waffle/egl/wegl_display.c         |  2 +-
 src/waffle/gbm/wgbm_platform.c        |  2 ++
 src/waffle/glx/glx_platform.c         |  2 ++
 src/waffle/wayland/wayland_platform.c |  8 +++++---
 src/waffle/wgl/wgl_display.c          |  4 +++-
 src/waffle/wgl/wgl_dl.c               | 24 +++++++++++++++++++-----
 src/waffle/wgl/wgl_dl.h               |  7 +++++--
 src/waffle/xegl/xegl_platform.c       |  2 ++
 tests/functional/gl_basic_test.c      | 10 +++++-----
 20 files changed, 94 insertions(+), 44 deletions(-)

diff --git a/examples/gl_basic.c b/examples/gl_basic.c
index 2c87711..5ce7438 100644
--- a/examples/gl_basic.c
+++ b/examples/gl_basic.c
@@ -523,23 +523,23 @@ main(int argc, char **argv)
                      waffle_enum_to_string(opts.context_api));
     }
 
-    glClear = waffle_dl_sym(opts.dl, "glClear");
+    glClear = waffle_dl_sym(dpy, opts.dl, "glClear");
     if (!glClear)
         error_get_gl_symbol("glClear");
 
-    glClearColor = waffle_dl_sym(opts.dl, "glClearColor");
+    glClearColor = waffle_dl_sym(dpy, opts.dl, "glClearColor");
     if (!glClearColor)
         error_get_gl_symbol("glClearColor");
 
-    glGetIntegerv = waffle_dl_sym(opts.dl, "glGetIntegerv");
+    glGetIntegerv = waffle_dl_sym(dpy, opts.dl, "glGetIntegerv");
     if (!glGetIntegerv)
         error_get_gl_symbol("glGetIntegerv");
 
-    glReadPixels = waffle_dl_sym(opts.dl, "glReadPixels");
+    glReadPixels = waffle_dl_sym(dpy, opts.dl, "glReadPixels");
     if (!glReadPixels)
         error_get_gl_symbol("glReadPixels");
 
-    glViewport = waffle_dl_sym(opts.dl, "glViewport");
+    glViewport = waffle_dl_sym(dpy, opts.dl, "glViewport");
     if (!glViewport)
         error_get_gl_symbol("glViewport");
 
diff --git a/examples/simple-x11-egl.c b/examples/simple-x11-egl.c
index ed26eaa..247dbce 100644
--- a/examples/simple-x11-egl.c
+++ b/examples/simple-x11-egl.c
@@ -85,14 +85,14 @@ main()
 
     // Exit if OpenGL ES2 is unsupported.
     if (!waffle_display_supports_context_api(dpy, WAFFLE_CONTEXT_OPENGL_ES2)
-        || !waffle_dl_can_open(WAFFLE_DL_OPENGL_ES2))
+        || !waffle_dl_can_open(dpy, WAFFLE_DL_OPENGL_ES2))
     {
         exit(EXIT_FAILURE);
     }
 
     // Get OpenGL functions.
-    glClearColor = waffle_dl_sym(WAFFLE_DL_OPENGL_ES2, "glClearColor");
-    glClear = waffle_dl_sym(WAFFLE_DL_OPENGL_ES2, "glClear");
+    glClearColor = waffle_dl_sym(dpy, WAFFLE_DL_OPENGL_ES2, "glClearColor");
+    glClear = waffle_dl_sym(dpy, WAFFLE_DL_OPENGL_ES2, "glClear");
 
     config = waffle_config_choose(dpy, config_attrs);
     window = waffle_window_create(config, window_width, window_height);
diff --git a/include/waffle/waffle.h b/include/waffle/waffle.h
index 170b56c..ac01af0 100644
--- a/include/waffle/waffle.h
+++ b/include/waffle/waffle.h
@@ -253,10 +253,10 @@ waffle_window_resize(
 // ---------------------------------------------------------------------------
 
 bool
-waffle_dl_can_open(int32_t dl);
+waffle_dl_can_open(struct waffle_display *dpy, int32_t dl);
 
 void*
-waffle_dl_sym(int32_t dl, const char *name);
+waffle_dl_sym(struct waffle_display *dpy, int32_t dl, const char *name);
 
 // ---------------------------------------------------------------------------
 // waffle_native
diff --git a/man/waffle_dl.3.xml b/man/waffle_dl.3.xml
index b089b93..576031d 100644
--- a/man/waffle_dl.3.xml
+++ b/man/waffle_dl.3.xml
@@ -43,11 +43,13 @@
 
       <funcprototype>
         <funcdef>bool <function>waffle_dl_can_open</function></funcdef>
+        <paramdef>struct waffle_display *<parameter>display</parameter></paramdef>
         <paramdef>int32_t <parameter>dl</parameter></paramdef>
       </funcprototype>
 
       <funcprototype>
         <funcdef>void* <function>waffle_dl_sym</function></funcdef>
+        <paramdef>struct waffle_display *<parameter>display</parameter></paramdef>
         <paramdef>int32_t <parameter>dl</parameter></paramdef>
         <paramdef>const char* <parameter>symbol</parameter></paramdef>
       </funcprototype>
diff --git a/src/utils/wflinfo.c b/src/utils/wflinfo.c
index e38b1e6..0651b5f 100644
--- a/src/utils/wflinfo.c
+++ b/src/utils/wflinfo.c
@@ -1026,15 +1026,15 @@ main(int argc, char **argv)
                      waffle_enum_to_string(opts.context_api));
     }
 
-    glGetError = waffle_dl_sym(opts.dl, "glGetError");
+    glGetError = waffle_dl_sym(dpy, opts.dl, "glGetError");
     if (!glGetError)
         error_get_gl_symbol("glGetError");
 
-    glGetIntegerv = waffle_dl_sym(opts.dl, "glGetIntegerv");
+    glGetIntegerv = waffle_dl_sym(dpy, opts.dl, "glGetIntegerv");
     if (!glGetIntegerv)
         error_get_gl_symbol("glGetIntegerv");
 
-    glGetString = waffle_dl_sym(opts.dl, "glGetString");
+    glGetString = waffle_dl_sym(dpy, opts.dl, "glGetString");
     if (!glGetString)
         error_get_gl_symbol("glGetString");
 
diff --git a/src/waffle/android/droid_platform.c b/src/waffle/android/droid_platform.c
index bbf2b14..9e7b9cb 100644
--- a/src/waffle/android/droid_platform.c
+++ b/src/waffle/android/droid_platform.c
@@ -86,6 +86,7 @@ error:
 static bool
 droid_dl_can_open(
         struct wcore_platform *wc_self,
+        struct wcore_display *wc_dpy,
         int32_t waffle_dl)
 {
     return linux_platform_dl_can_open(droid_platform(wc_self)->linux,
@@ -95,6 +96,7 @@ droid_dl_can_open(
 static void*
 droid_dl_sym(
         struct wcore_platform *wc_self,
+        struct wcore_display *wc_dpy,
         int32_t waffle_dl,
         const char *name)
 {
diff --git a/src/waffle/api/waffle_dl.c b/src/waffle/api/waffle_dl.c
index b94c4c7..4e7af59 100644
--- a/src/waffle/api/waffle_dl.c
+++ b/src/waffle/api/waffle_dl.c
@@ -25,6 +25,7 @@
 
 #include "api_priv.h"
 
+#include "wcore_display.h"
 #include "wcore_error.h"
 #include "wcore_platform.h"
 
@@ -44,25 +45,35 @@ waffle_dl_check_enum(int32_t dl)
 }
 
 WAFFLE_API bool
-waffle_dl_can_open(int32_t dl)
+waffle_dl_can_open(struct waffle_display *dpy, int32_t dl)
 {
-    if (!api_check_entry(NULL, 0))
+    struct wcore_display *wc_dpy = wcore_display(dpy);
+    const struct api_object *obj_list[] = {
+        wc_dpy ? &wc_dpy->api : NULL,
+    };
+
+    if (!api_check_entry(obj_list, 1))
          return false;
 
      if (!waffle_dl_check_enum(dl))
          return false;
 
-     return api_platform->vtbl->dl_can_open(api_platform, dl);
+     return api_platform->vtbl->dl_can_open(api_platform, wc_dpy, dl);
 }
 
 WAFFLE_API void*
-waffle_dl_sym(int32_t dl, const char *name)
+waffle_dl_sym(struct waffle_display *dpy, int32_t dl, const char *name)
 {
-    if (!api_check_entry(NULL, 0))
+    struct wcore_display *wc_dpy = wcore_display(dpy);
+    const struct api_object *obj_list[] = {
+        wc_dpy ? &wc_dpy->api : NULL,
+    };
+
+    if (!api_check_entry(obj_list, 1))
         return NULL;
 
     if (!waffle_dl_check_enum(dl))
         return NULL;
 
-    return api_platform->vtbl->dl_sym(api_platform, dl, name);
+    return api_platform->vtbl->dl_sym(api_platform, wc_dpy, dl, name);
 }
diff --git a/src/waffle/cgl/cgl_dl.h b/src/waffle/cgl/cgl_dl.h
index a0df71a..df9aafa 100644
--- a/src/waffle/cgl/cgl_dl.h
+++ b/src/waffle/cgl/cgl_dl.h
@@ -32,12 +32,14 @@ struct wcore_platform;
 
 bool
 cgl_dl_can_open(struct wcore_platform *wc_plat,
+                struct wcore_display *wc_dpy,
                 int32_t waffle_dl);
 
 void*
 cgl_dl_sym(struct wcore_platform *wc_plat,
-          int32_t waffle_dl,
-          const char *name);
+           struct wcore_display *wc_dpy,
+           int32_t waffle_dl,
+           const char *name);
 
 bool
 cgl_dl_close(struct wcore_platform *wc_plat);
diff --git a/src/waffle/cgl/cgl_dl.m b/src/waffle/cgl/cgl_dl.m
index 2d13067..d37928d 100644
--- a/src/waffle/cgl/cgl_dl.m
+++ b/src/waffle/cgl/cgl_dl.m
@@ -26,6 +26,7 @@
 #include <assert.h>
 #include <dlfcn.h>
 
+#include "wcore_display.h"
 #include "wcore_error.h"
 
 #include "cgl_dl.h"
@@ -74,6 +75,7 @@ cgl_dl_open(struct cgl_platform *plat)
 
 bool
 cgl_dl_can_open(struct wcore_platform *wc_plat,
+                struct wcore_display *wc_dpy,
                 int32_t waffle_dl)
 {
     struct cgl_platform *plat = cgl_platform(wc_plat);
@@ -93,8 +95,9 @@ cgl_dl_can_open(struct wcore_platform *wc_plat,
 
 void*
 cgl_dl_sym(struct wcore_platform *wc_plat,
-          int32_t waffle_dl,
-          const char *name)
+           struct wcore_display *wc_dpy,
+           int32_t waffle_dl,
+           const char *name)
 {
     struct cgl_platform *plat = cgl_platform(wc_plat);
 
diff --git a/src/waffle/core/wcore_platform.h b/src/waffle/core/wcore_platform.h
index 67c327c..f897c3c 100644
--- a/src/waffle/core/wcore_platform.h
+++ b/src/waffle/core/wcore_platform.h
@@ -57,11 +57,13 @@ struct wcore_platform_vtbl {
     bool
     (*dl_can_open)(
             struct wcore_platform *self,
+            struct wcore_display *dpy,
             int32_t waffle_dl);
 
     void*
     (*dl_sym)(
             struct wcore_platform *self,
+            struct wcore_display *dpy,
             int32_t waffle_dl,
             const char *symbol);
 
diff --git a/src/waffle/egl/wegl_config.c b/src/waffle/egl/wegl_config.c
index 5dbe1b6..750ab29 100644
--- a/src/waffle/egl/wegl_config.c
+++ b/src/waffle/egl/wegl_config.c
@@ -41,6 +41,7 @@ check_context_attrs(struct wegl_display *dpy,
                     const struct wcore_config_attrs *attrs)
 {
     struct wcore_platform *plat = dpy->wcore.platform;
+    struct wcore_display *wc_dpy = &dpy->wcore;
 
     if (attrs->context_forward_compatible) {
         assert(attrs->context_api == WAFFLE_CONTEXT_OPENGL);
@@ -76,7 +77,7 @@ check_context_attrs(struct wegl_display *dpy,
                 return false;
             }
 
-            if (!plat->vtbl->dl_can_open(plat, WAFFLE_DL_OPENGL)) {
+            if (!plat->vtbl->dl_can_open(plat, wc_dpy, WAFFLE_DL_OPENGL)) {
                 wcore_errorf(WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM,
                              "failed to open the OpenGL library");
                 return false;
@@ -85,7 +86,7 @@ check_context_attrs(struct wegl_display *dpy,
             return true;
 
         case WAFFLE_CONTEXT_OPENGL_ES1:
-            if (!plat->vtbl->dl_can_open(plat, WAFFLE_DL_OPENGL_ES1)) {
+            if (!plat->vtbl->dl_can_open(plat, wc_dpy, WAFFLE_DL_OPENGL_ES1)) {
                 wcore_errorf(WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM,
                              "failed to open the OpenGL ES1 library");
                 return false;
@@ -94,7 +95,7 @@ check_context_attrs(struct wegl_display *dpy,
             return true;
 
         case WAFFLE_CONTEXT_OPENGL_ES2:
-            if (!plat->vtbl->dl_can_open(plat, WAFFLE_DL_OPENGL_ES2)) {
+            if (!plat->vtbl->dl_can_open(plat, wc_dpy, WAFFLE_DL_OPENGL_ES2)) {
                 wcore_errorf(WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM,
                              "failed to open the OpenGL ES2 library");
                 return false;
@@ -110,7 +111,7 @@ check_context_attrs(struct wegl_display *dpy,
                 return false;
             }
 
-            if (!plat->vtbl->dl_can_open(plat, WAFFLE_DL_OPENGL_ES3)) {
+            if (!plat->vtbl->dl_can_open(plat, wc_dpy, WAFFLE_DL_OPENGL_ES3)) {
                 wcore_errorf(WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM,
                              "failed to open the OpenGL ES3 library");
                 return false;
diff --git a/src/waffle/egl/wegl_display.c b/src/waffle/egl/wegl_display.c
index 0716a32..79224a9 100644
--- a/src/waffle/egl/wegl_display.c
+++ b/src/waffle/egl/wegl_display.c
@@ -133,5 +133,5 @@ wegl_display_supports_context_api(struct wcore_display *wc_dpy,
             return false;
     }
 
-    return wc_plat->vtbl->dl_can_open(wc_plat, waffle_dl);
+    return wc_plat->vtbl->dl_can_open(wc_plat, wc_dpy, waffle_dl);
 }
diff --git a/src/waffle/gbm/wgbm_platform.c b/src/waffle/gbm/wgbm_platform.c
index 5624660..338db7d 100644
--- a/src/waffle/gbm/wgbm_platform.c
+++ b/src/waffle/gbm/wgbm_platform.c
@@ -92,6 +92,7 @@ error:
 
 static bool
 wgbm_dl_can_open(struct wcore_platform *wc_self,
+                 struct wcore_display *wc_dpy,
                  int32_t waffle_dl)
 {
     return linux_platform_dl_can_open(wgbm_platform(wc_self)->linux,
@@ -100,6 +101,7 @@ wgbm_dl_can_open(struct wcore_platform *wc_self,
 
 static void*
 wgbm_dl_sym(struct wcore_platform *wc_self,
+            struct wcore_display *wc_dpy,
             int32_t waffle_dl,
             const char *name)
 {
diff --git a/src/waffle/glx/glx_platform.c b/src/waffle/glx/glx_platform.c
index e8fb584..1e99380 100644
--- a/src/waffle/glx/glx_platform.c
+++ b/src/waffle/glx/glx_platform.c
@@ -112,6 +112,7 @@ glx_platform_get_proc_address(struct wcore_platform *wc_self,
 
 static bool
 glx_platform_dl_can_open(struct wcore_platform *wc_self,
+                         struct wcore_display *wc_dpy,
                          int32_t waffle_dl)
 {
     return linux_platform_dl_can_open(glx_platform(wc_self)->linux,
@@ -120,6 +121,7 @@ glx_platform_dl_can_open(struct wcore_platform *wc_self,
 
 static void*
 glx_platform_dl_sym(struct wcore_platform *wc_self,
+                    struct wcore_display *wc_dpy,
                     int32_t waffle_dl,
                     const char *name)
 {
diff --git a/src/waffle/wayland/wayland_platform.c b/src/waffle/wayland/wayland_platform.c
index 8ca30d4..4ef7b05 100644
--- a/src/waffle/wayland/wayland_platform.c
+++ b/src/waffle/wayland/wayland_platform.c
@@ -93,7 +93,8 @@ error:
 
 static bool
 wayland_dl_can_open(struct wcore_platform *wc_self,
-                             int32_t waffle_dl)
+                    struct wcore_display *wc_dpy,
+                    int32_t waffle_dl)
 {
     return linux_platform_dl_can_open(wayland_platform(wc_self)->linux,
                                       waffle_dl);
@@ -101,8 +102,9 @@ wayland_dl_can_open(struct wcore_platform *wc_self,
 
 static void*
 wayland_dl_sym(struct wcore_platform *wc_self,
-                        int32_t waffle_dl,
-                        const char *name)
+               struct wcore_display *wc_dpy,
+               int32_t waffle_dl,
+               const char *name)
 {
     return linux_platform_dl_sym(wayland_platform(wc_self)->linux,
                                                   waffle_dl,
diff --git a/src/waffle/wgl/wgl_display.c b/src/waffle/wgl/wgl_display.c
index 13125e9..9fd342d 100644
--- a/src/waffle/wgl/wgl_display.c
+++ b/src/waffle/wgl/wgl_display.c
@@ -122,10 +122,12 @@ wgl_display_hardware_render(struct wgl_display *dpy)
     typedef unsigned char GLubyte;
     typedef const GLubyte * (__stdcall *PFNGLGETSTRINGPROC)(GLenum name);
 
+    struct wcore_platform *plat = dpy->wcore.platform;
+    struct wcore_display *wc_dpy = &dpy->wcore;
     PFNGLGETSTRINGPROC glGetString_func;
     const GLubyte *gl_renderer;
 
-    glGetString_func = wgl_dl_sym(dpy->wcore.platform, WAFFLE_DL_OPENGL, "glGetString");
+    glGetString_func = wgl_dl_sym(plat, wc_dpy, WAFFLE_DL_OPENGL, "glGetString");
     if (!glGetString_func)
         return false;
 
diff --git a/src/waffle/wgl/wgl_dl.c b/src/waffle/wgl/wgl_dl.c
index eb9ef46..24ee898 100644
--- a/src/waffle/wgl/wgl_dl.c
+++ b/src/waffle/wgl/wgl_dl.c
@@ -29,26 +29,36 @@
 
 #include "wcore_error.h"
 
+#include "wgl_display.h"
 #include "wgl_dl.h"
 #include "wgl_platform.h"
 
 static const char *wgl_gl_path = "OPENGL32";
 
 static bool
-wgl_dl_check_enum(int32_t waffle_dl)
+wgl_dl_check_enum(struct wgl_display *dpy, int32_t waffle_dl)
 {
     switch (waffle_dl) {
         case WAFFLE_DL_OPENGL:
             return true;
         case WAFFLE_DL_OPENGL_ES1:
+            if (dpy->EXT_create_context_es_profile)
+                return true;
+
             wcore_errorf(WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM,
                          "WGL does not support OpenGL ES1");
             return false;
         case WAFFLE_DL_OPENGL_ES2:
+            if (dpy->EXT_create_context_es2_profile)
+                return true;
+
             wcore_errorf(WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM,
                          "WGL does not support OpenGL ES2");
             return false;
         case WAFFLE_DL_OPENGL_ES3:
+            if (dpy->EXT_create_context_es_profile)
+                return true;
+
             wcore_errorf(WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM,
                          "WGL does not support OpenGL ES3");
             return false;
@@ -79,11 +89,13 @@ wgl_dl_open(struct wgl_platform *plat)
 
 bool
 wgl_dl_can_open(struct wcore_platform *wc_plat,
+                struct wcore_display *wc_dpy,
                 int32_t waffle_dl)
 {
     struct wgl_platform *plat = wgl_platform(wc_plat);
+    struct wgl_display *dpy = wgl_display(wc_dpy);
 
-    if (!wgl_dl_check_enum(waffle_dl))
+    if (!wgl_dl_check_enum(dpy, waffle_dl))
         return false;
 
     if (plat->dl_gl)
@@ -98,12 +110,14 @@ wgl_dl_can_open(struct wcore_platform *wc_plat,
 
 void*
 wgl_dl_sym(struct wcore_platform *wc_plat,
-          int32_t waffle_dl,
-          const char *name)
+           struct wcore_display *wc_dpy,
+           int32_t waffle_dl,
+           const char *name)
 {
     struct wgl_platform *plat = wgl_platform(wc_plat);
+    struct wgl_display *dpy = wgl_display(wc_dpy);
 
-    if (!wgl_dl_check_enum(waffle_dl))
+    if (!wgl_dl_check_enum(dpy, waffle_dl))
         return NULL;
 
     if (!plat->dl_gl)
diff --git a/src/waffle/wgl/wgl_dl.h b/src/waffle/wgl/wgl_dl.h
index 6ccd170..ebc475a 100644
--- a/src/waffle/wgl/wgl_dl.h
+++ b/src/waffle/wgl/wgl_dl.h
@@ -28,16 +28,19 @@
 #include <stdbool.h>
 #include <stdint.h>
 
+struct wcore_display;
 struct wcore_platform;
 
 bool
 wgl_dl_can_open(struct wcore_platform *wc_plat,
+                struct wcore_display *wc_dpy,
                 int32_t waffle_dl);
 
 void*
 wgl_dl_sym(struct wcore_platform *wc_plat,
-          int32_t waffle_dl,
-          const char *name);
+           struct wcore_display *wc_dpy,
+           int32_t waffle_dl,
+           const char *name);
 
 bool
 wgl_dl_close(struct wcore_platform *wc_plat);
diff --git a/src/waffle/xegl/xegl_platform.c b/src/waffle/xegl/xegl_platform.c
index 71bf23c..800dd2f 100644
--- a/src/waffle/xegl/xegl_platform.c
+++ b/src/waffle/xegl/xegl_platform.c
@@ -90,6 +90,7 @@ error:
 
 static bool
 xegl_dl_can_open(struct wcore_platform *wc_self,
+                 struct wcore_display *wc_dpy,
                  int32_t waffle_dl)
 {
     return linux_platform_dl_can_open(xegl_platform(wc_self)->linux,
@@ -98,6 +99,7 @@ xegl_dl_can_open(struct wcore_platform *wc_self,
 
 static void*
 xegl_dl_sym(struct wcore_platform *wc_self,
+            struct wcore_display *wc_dpy,
             int32_t waffle_dl,
             const char *name)
 {
diff --git a/tests/functional/gl_basic_test.c b/tests/functional/gl_basic_test.c
index 1f1ef8f..3fa3a0e 100644
--- a/tests/functional/gl_basic_test.c
+++ b/tests/functional/gl_basic_test.c
@@ -289,11 +289,11 @@ gl_basic_draw__(struct gl_basic_draw_args__ args)
     }
 
     // Get OpenGL functions.
-    ASSERT_TRUE(glClear         = waffle_dl_sym(libgl, "glClear"));
-    ASSERT_TRUE(glClearColor    = waffle_dl_sym(libgl, "glClearColor"));
-    ASSERT_TRUE(glGetError      = waffle_dl_sym(libgl, "glGetError"));
-    ASSERT_TRUE(glGetIntegerv   = waffle_dl_sym(libgl, "glGetIntegerv"));
-    ASSERT_TRUE(glReadPixels    = waffle_dl_sym(libgl, "glReadPixels"));
+    ASSERT_TRUE(glClear         = waffle_dl_sym(dpy, libgl, "glClear"));
+    ASSERT_TRUE(glClearColor    = waffle_dl_sym(dpy, libgl, "glClearColor"));
+    ASSERT_TRUE(glGetError      = waffle_dl_sym(dpy, libgl, "glGetError"));
+    ASSERT_TRUE(glGetIntegerv   = waffle_dl_sym(dpy, libgl, "glGetIntegerv"));
+    ASSERT_TRUE(glReadPixels    = waffle_dl_sym(dpy, libgl, "glReadPixels"));
 
     ASSERT_TRUE(waffle_make_current(dpy, window, ctx));
 
-- 
2.0.2



More information about the waffle mailing list