summaryrefslogtreecommitdiff
path: root/src/glx/glxcmds.c
diff options
context:
space:
mode:
authorChia-I Wu <olv@lunarg.com>2010-12-26 18:24:13 +0800
committerChia-I Wu <olv@lunarg.com>2011-01-20 17:15:50 +0800
commite8c7d7598fb48237508f566204c71ba8f74d544f (patch)
tree7265601e9bddd2d5afd6e55637ae9efcf42b7fa2 /src/glx/glxcmds.c
parent9767d3b5ad08640737e9d8dd4feb046478ae1f4b (diff)
glapi: Fix OpenGL and OpenGL ES interop.
When --enable-shared-glapi is specified, libGL will share libglapi with OpenGL ES instead of defining its own copy of glapi. This makes sure an app will get only one copy of glapi in its address space. The new option is disabled by default. When enabled, libGL and libglapi must be built from the same source tree and distributed together. This requirement comes from the fact that the dispatch offsets used by these libraries are re-assigned whenever GLAPI XMLs are changed. For GLX, indirect rendering for has_different_protocol() functions is tricky. A has_different_protocol() function is assigned only one dispatch offset, yet each entry point needs a different protocol opcode. It cannot be supported by the shared glapi. The fix to this is to make glXGetProcAddress handle such functions specially before calling _glapi_get_proc_address. Note that these files are automatically generated/re-generated src/glx/indirect.c src/glx/indirect.h src/mapi/glapi/glapi_mapi_tmp.h
Diffstat (limited to 'src/glx/glxcmds.c')
-rw-r--r--src/glx/glxcmds.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
index 4f7e84ef5f..d12ff9684e 100644
--- a/src/glx/glxcmds.c
+++ b/src/glx/glxcmds.c
@@ -36,6 +36,7 @@
#include "glxclient.h"
#include "glapi.h"
#include "glxextensions.h"
+#include "indirect.h"
#ifdef GLX_DIRECT_RENDERING
#ifdef GLX_USE_APPLEGL
@@ -2514,7 +2515,11 @@ _X_EXPORT void (*glXGetProcAddressARB(const GLubyte * procName)) (void)
f = (gl_function) get_glx_proc_address((const char *) procName);
if ((f == NULL) && (procName[0] == 'g') && (procName[1] == 'l')
&& (procName[2] != 'X')) {
- f = (gl_function) _glapi_get_proc_address((const char *) procName);
+#ifdef GLX_SHARED_GLAPI
+ f = (gl_function) __indirect_get_proc_address((const char *) procName);
+#endif
+ if (!f)
+ f = (gl_function) _glapi_get_proc_address((const char *) procName);
}
#endif
return f;