summaryrefslogtreecommitdiff
path: root/src/glx
diff options
context:
space:
mode:
Diffstat (limited to 'src/glx')
-rw-r--r--src/glx/Makefile6
-rw-r--r--src/glx/glxcmds.c7
-rw-r--r--src/glx/indirect.c64
-rw-r--r--src/glx/indirect.h4
4 files changed, 78 insertions, 3 deletions
diff --git a/src/glx/Makefile b/src/glx/Makefile
index 2c94ef1cd4f..3d92ebbe038 100644
--- a/src/glx/Makefile
+++ b/src/glx/Makefile
@@ -46,6 +46,12 @@ SOURCES = \
applegl_glx.c
+ifeq ($(SHARED_GLAPI),1)
+GL_LIB_DEPS := -L$(TOP)/$(LIB_DIR) -l$(GLAPI_LIB) $(GL_LIB_DEPS)
+EXTRA_DEFINES += -DGLX_SHARED_GLAPI
+endif
+
+# override GLAPI_LIB
GLAPI_LIB = $(TOP)/src/mapi/glapi/libglapi.a
OBJECTS = $(SOURCES:.c=.o)
diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
index 4f7e84ef5f9..d12ff9684e2 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;
diff --git a/src/glx/indirect.c b/src/glx/indirect.c
index 49938a167a5..f79175b760d 100644
--- a/src/glx/indirect.c
+++ b/src/glx/indirect.c
@@ -10657,5 +10657,65 @@ __indirect_glFramebufferTextureLayerEXT(GLenum target, GLenum attachment,
}
-# undef FASTCALL
-# undef NOINLINE
+#ifdef GLX_SHARED_GLAPI
+
+static const struct proc_pair {
+ const char *name;
+ _glapi_proc proc;
+} proc_pairs[20] = {
+ {
+ "AreTexturesResidentEXT", (_glapi_proc) glAreTexturesResidentEXT}, {
+ "DeleteTexturesEXT", (_glapi_proc) glDeleteTexturesEXT}, {
+ "GenTexturesEXT", (_glapi_proc) glGenTexturesEXT}, {
+ "GetColorTableEXT", (_glapi_proc) glGetColorTableEXT}, {
+ "GetColorTableParameterfvEXT",
+ (_glapi_proc) glGetColorTableParameterfvEXT}, {
+ "GetColorTableParameterfvSGI",
+ (_glapi_proc) glGetColorTableParameterfvEXT}, {
+ "GetColorTableParameterivEXT",
+ (_glapi_proc) glGetColorTableParameterivEXT}, {
+ "GetColorTableParameterivSGI",
+ (_glapi_proc) glGetColorTableParameterivEXT}, {
+ "GetColorTableSGI", (_glapi_proc) glGetColorTableEXT}, {
+ "GetConvolutionFilterEXT", (_glapi_proc) gl_dispatch_stub_356}, {
+ "GetConvolutionParameterfvEXT", (_glapi_proc) gl_dispatch_stub_357}, {
+ "GetConvolutionParameterivEXT", (_glapi_proc) gl_dispatch_stub_358}, {
+ "GetHistogramEXT", (_glapi_proc) gl_dispatch_stub_361}, {
+ "GetHistogramParameterfvEXT", (_glapi_proc) gl_dispatch_stub_362}, {
+ "GetHistogramParameterivEXT", (_glapi_proc) gl_dispatch_stub_363}, {
+ "GetMinmaxEXT", (_glapi_proc) gl_dispatch_stub_364}, {
+ "GetMinmaxParameterfvEXT", (_glapi_proc) gl_dispatch_stub_365}, {
+ "GetMinmaxParameterivEXT", (_glapi_proc) gl_dispatch_stub_366}, {
+ "GetSeparableFilterEXT", (_glapi_proc) gl_dispatch_stub_359}, {
+ "IsTextureEXT", (_glapi_proc) glIsTextureEXT}
+};
+
+static int
+__indirect_get_proc_compare(const void *key, const void *memb)
+{
+ const struct proc_pair *pair = (const struct proc_pair *) memb;
+ return strcmp((const char *) key, pair->name);
+}
+
+_glapi_proc
+__indirect_get_proc_address(const char *name)
+{
+ const struct proc_pair *pair;
+
+ /* skip "gl" */
+ name += 2;
+
+ pair = (const struct proc_pair *) bsearch((const void *) name,
+ (const void *) proc_pairs,
+ ARRAY_SIZE(proc_pairs),
+ sizeof(proc_pairs[0]),
+ __indirect_get_proc_compare);
+
+ return (pair) ? pair->proc : NULL;
+}
+
+#endif /* GLX_SHARED_GLAPI */
+
+
+#undef FASTCALL
+#undef NOINLINE
diff --git a/src/glx/indirect.h b/src/glx/indirect.h
index f3222077bf5..b610cc20279 100644
--- a/src/glx/indirect.h
+++ b/src/glx/indirect.h
@@ -715,6 +715,10 @@ extern HIDDEN void __indirect_glRenderbufferStorageEXT(GLenum target, GLenum int
extern HIDDEN void __indirect_glBlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
extern HIDDEN void __indirect_glFramebufferTextureLayerEXT(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
+#ifdef GLX_SHARED_GLAPI
+extern HIDDEN void (*__indirect_get_proc_address(const char *name))(void);
+#endif
+
# undef HIDDEN
# undef FASTCALL
# undef NOINLINE