summaryrefslogtreecommitdiff
path: root/cogl/driver/gl/cogl-gl.c
diff options
context:
space:
mode:
authorNeil Roberts <neil@linux.intel.com>2011-07-27 12:30:02 +0100
committerNeil Roberts <neil@linux.intel.com>2011-07-27 16:10:02 +0100
commitd259a87602516f6882138e6bc031d0647cb15140 (patch)
treebf7b9e0ebfe3dd08edad62c8fa27e44b81e776b6 /cogl/driver/gl/cogl-gl.c
parent76c88958b72dccc98586f00b2ac43d4377fa71b1 (diff)
downloadcogl-d259a87602516f6882138e6bc031d0647cb15140.tar.gz
Don't use the 'NULL' GModule to resolve GL symbols
Previously, _cogl_get_proc_address had a fallback to resolve the symbol using g_module_open(NULL) to get the symbol from anywhere in the address space. The EGL backend ends up using this on some drivers because eglGetProcAddress isn't meant to return a pointer for core functions. This causes problems if something in the process is linking against a different GL library, for example Cairo may be linking against libGL itself. In this case it may end up resolving symbols from the GL library even if GLES is being used. This patch removes the fallback. The EGL version now has its own fallback instead which passes the existing libgl_module from the renderer to g_module_symbol so that it should only get symbols from that library or its dependency chain. The GLX and WGL winsys only call glXGetProcAddress and wglGetProcAddress. The stub winsys does however continue using the global symbol lookup. The internal _cogl_get_proc_address function has been renamed to _cogl_renderer_get_proc_address because it needs a connected renderer to work so it could be considered to be a renderer method. The pointer to the renderer is passed down to the winsys backends so that it can use the data attached to the renderer to get the module pointers. https://bugzilla.gnome.org/show_bug.cgi?id=655412 Reviewed-by: Robert Bragg <robert@linux.intel.com>
Diffstat (limited to 'cogl/driver/gl/cogl-gl.c')
-rw-r--r--cogl/driver/gl/cogl-gl.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/cogl/driver/gl/cogl-gl.c b/cogl/driver/gl/cogl-gl.c
index 3ed4b04b..589d3da1 100644
--- a/cogl/driver/gl/cogl-gl.c
+++ b/cogl/driver/gl/cogl-gl.c
@@ -33,6 +33,7 @@
#include "cogl-internal.h"
#include "cogl-context-private.h"
#include "cogl-feature-private.h"
+#include "cogl-renderer-private.h"
static gboolean
_cogl_get_gl_version (int *major_out, int *minor_out)
@@ -137,8 +138,8 @@ _cogl_gl_update_features (CoglContext *context,
function because we need to use it to determine what functions we
can expect */
context->glGetString =
- (void *) _cogl_get_proc_address (_cogl_context_get_winsys (context),
- "glGetString");
+ (void *) _cogl_renderer_get_proc_address (context->display->renderer,
+ "glGetString");
if (!check_gl_version (context, error))
return FALSE;