diff options
author | Neil Roberts <neil@linux.intel.com> | 2012-06-20 12:42:31 +0100 |
---|---|---|
committer | Robert Bragg <robert@linux.intel.com> | 2012-08-06 14:27:45 +0100 |
commit | df77e8565e9822bfcdeb88b380f64f0f303aaef6 (patch) | |
tree | 435f6134372a26d28630ef7ea06ca4f39851cc13 /cogl/winsys/cogl-winsys-glx.c | |
parent | 7cdaaf2bd5a528ef5fe11f13cfcd1f7ff5848854 (diff) | |
download | cogl-df77e8565e9822bfcdeb88b380f64f0f303aaef6.tar.gz |
Don't use eglGetProcAddress to retrieve core functions
According to the EGL spec, eglGetProcAddress should only be used to
retrieve extension functions. It also says that returning non-NULL
does not mean the extension is available so you could interpret this
as saying that the function is allowed to return garbage for core
functions. This seems to happen at least for the Android
implementation of EGL.
To workaround this the winsys's are now passed down a flag to say
whether the function is from the core API. This information is already
in the gl-prototypes headers as the minimum core GL version and as a
pair of flags to specify whether it is available in core GLES1 and
GLES2. If the function is in core the EGL winsys will now avoid using
eglGetProcAddress and always fallback to querying the library directly
with the GModule API.
The GLX winsys is left alone because glXGetProcAddress apparently
supports querying core API and extension functions.
The WGL winsys could ideally be changed because wglGetProcAddress
should also only be used for extension functions but the situation is
slightly different because WGL considers anything from GL > 1.1 to be
an extension so it would need a bit more information to determine
whether to query the function directly from the library.
The SDL winsys is also left alone because it's not as easy to portably
determine which GL library SDL has chosen to load in order to resolve
the symbols directly.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 72089730ad06ccdd38a344279a893965ae68cec1)
Since we aren't able to break API on the 1.12 branch
cogl_get_proc_address is still supported but isn't easily able to
determine whether the given name corresponds to a core symbol or
not. For now we just assume the symbol being queried isn't part
of the core GL api and update the documentation accordingly.
Diffstat (limited to 'cogl/winsys/cogl-winsys-glx.c')
-rw-r--r-- | cogl/winsys/cogl-winsys-glx.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/cogl/winsys/cogl-winsys-glx.c b/cogl/winsys/cogl-winsys-glx.c index 66501066..c733ec40 100644 --- a/cogl/winsys/cogl-winsys-glx.c +++ b/cogl/winsys/cogl-winsys-glx.c @@ -129,10 +129,15 @@ static const CoglFeatureData winsys_feature_data[] = static CoglFuncPtr _cogl_winsys_renderer_get_proc_address (CoglRenderer *renderer, - const char *name) + const char *name, + CoglBool in_core) { CoglGLXRenderer *glx_renderer = renderer->winsys; + /* The GLX_ARB_get_proc_address extension documents that this should + * work for core functions too so we don't need to do anything + * special with in_core */ + return glx_renderer->glXGetProcAddress ((const GLubyte *) name); } |