From e8c7d7598fb48237508f566204c71ba8f74d544f Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sun, 26 Dec 2010 18:24:13 +0800 Subject: 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 --- src/gallium/targets/egl/Makefile | 6 +++++- src/gallium/targets/libgl-xlib/Makefile | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'src/gallium/targets') diff --git a/src/gallium/targets/egl/Makefile b/src/gallium/targets/egl/Makefile index 017c1952141..92d971bab01 100644 --- a/src/gallium/targets/egl/Makefile +++ b/src/gallium/targets/egl/Makefile @@ -123,8 +123,12 @@ endif # OpenGL state tracker GL_CPPFLAGS := -I$(TOP)/src/mesa $(API_DEFINES) -# cannot not link to $(GL_LIB) as the app might want GLES +ifeq ($(SHARED_GLAPI),1) +GL_SYS := $(DRI_LIB_DEPS) -l$(GLAPI_LIB) +else +# cannot link to $(GL_LIB) as the app might want GL or GLES GL_SYS := $(DRI_LIB_DEPS) +endif GL_LIBS := $(TOP)/src/mesa/libmesagallium.a # OpenVG state tracker diff --git a/src/gallium/targets/libgl-xlib/Makefile b/src/gallium/targets/libgl-xlib/Makefile index fb537c31556..53a6c33ed82 100644 --- a/src/gallium/targets/libgl-xlib/Makefile +++ b/src/gallium/targets/libgl-xlib/Makefile @@ -60,6 +60,10 @@ GL_LIB_DEPS += $(LLVM_LIBS) LDFLAGS += $(LLVM_LDFLAGS) endif +ifeq ($(SHARED_GLAPI),1) +GL_LIB_DEPS := -L$(TOP)/$(LIB_DIR) -l$(GLAPI_LIB) $(GL_LIB_DEPS) +endif + .SUFFIXES : .cpp -- cgit v1.2.3