summaryrefslogtreecommitdiffstats
path: root/src/glx/indirect.c
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2010-12-26 18:24:13 +0800
committerChia-I Wu <[email protected]>2011-01-20 17:15:50 +0800
commite8c7d7598fb48237508f566204c71ba8f74d544f (patch)
tree7265601e9bddd2d5afd6e55637ae9efcf42b7fa2 /src/glx/indirect.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/indirect.c')
-rw-r--r--src/glx/indirect.c64
1 files changed, 62 insertions, 2 deletions
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