diff options
author | Chia-I Wu <olv@lunarg.com> | 2010-12-11 19:41:59 +0800 |
---|---|---|
committer | Chia-I Wu <olv@lunarg.com> | 2010-12-12 18:33:11 +0800 |
commit | 263696c55178c12f3eed4281adae578e028e06ed (patch) | |
tree | 9df1ed0805f6adc49d153f9ef0ad3feff844b137 | |
parent | 2f01b6888a8efa0bb6c759481eff7b0d33ca9191 (diff) |
glapi: Fix OpenGL and OpenGL ES interop.esapi-rework
Add GLAPI_OWNER to autoconf, which is the library that implements
glapi.h interface. It is always $(GL_LIB) unless --disable-opengl is
given.
When GLAPI_OWNER is $(GL_LIB), $(GLESv1_CM_LIB) and $(GLESv2_LIB) will
not implement glapi.h interface. This fixes the case that an
application links to or loads more than one of libGL.so,
libGLESv1_CM.so, and libGLESv2.so. Without this change, the application
will be confused about whose copy of glapi.h to use.
An implication of this change is that libGL*.so must always be built
from the same gl_API.xml. An alternative would be to assign OpenGL ES
1.1 and 2.0 functions fixed dispatch offsets. But that is left out for
now.
-rw-r--r-- | configs/autoconf.in | 1 | ||||
-rw-r--r-- | configure.ac | 6 | ||||
-rw-r--r-- | src/gallium/targets/egl/Makefile | 7 | ||||
-rw-r--r-- | src/mapi/es1api/Makefile | 19 | ||||
-rw-r--r-- | src/mapi/glapi/gen-es/Makefile | 6 |
5 files changed, 32 insertions, 7 deletions
diff --git a/configs/autoconf.in b/configs/autoconf.in index e2d70c63a1..f70819cd5b 100644 --- a/configs/autoconf.in +++ b/configs/autoconf.in @@ -15,6 +15,7 @@ ASM_FLAGS = @ASM_FLAGS@ PIC_FLAGS = @PIC_FLAGS@ DEFINES = @DEFINES@ API_DEFINES = @API_DEFINES@ +GLAPI_OWNER = @GLAPI_OWNER@ GLES_OVERLAY = @GLES_OVERLAY@ CFLAGS = @CPPFLAGS@ @CFLAGS@ \ $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(ASM_FLAGS) $(DEFINES) diff --git a/configure.ac b/configure.ac index bd81775305..2c47a393f4 100644 --- a/configure.ac +++ b/configure.ac @@ -512,22 +512,28 @@ if test "x$enable_opengl" = xno -a \ fi API_DEFINES="" +GLAPI_OWNER="" GLES_OVERLAY=0 if test "x$enable_opengl" = xno; then API_DEFINES="$API_DEFINES -DFEATURE_GL=0" else API_DEFINES="$API_DEFINES -DFEATURE_GL=1" + GLAPI_OWNER='$(GL_LIB)' fi if test "x$enable_gles1" = xyes; then API_DEFINES="$API_DEFINES -DFEATURE_ES1=1" + test -z "$GLAPI_OWNER" && GLAPI_OWNER='$(GLESv1_CM_LIB)' fi if test "x$enable_gles2" = xyes; then API_DEFINES="$API_DEFINES -DFEATURE_ES2=1" + test -z "$GLAPI_OWNER" && GLAPI_OWNER='$(GLESv2_LIB)' fi if test "x$enable_gles_overlay" = xyes; then + test -z "$GLAPI_OWNER" && GLAPI_OWNER='$(GLESv2_LIB)' GLES_OVERLAY=1 fi AC_SUBST([API_DEFINES]) +AC_SUBST([GLAPI_OWNER]) AC_SUBST([GLES_OVERLAY]) dnl diff --git a/src/gallium/targets/egl/Makefile b/src/gallium/targets/egl/Makefile index 63e9352144..33ca555435 100644 --- a/src/gallium/targets/egl/Makefile +++ b/src/gallium/targets/egl/Makefile @@ -127,18 +127,17 @@ endif # OpenGL state tracker GL_CPPFLAGS := -I$(TOP)/src/mesa $(API_DEFINES) -# do not link to $(GL_LIB) as the it supports GLES too -GL_SYS := $(DRI_LIB_DEPS) +GL_SYS := $(DRI_LIB_DEPS) -l$(GLAPI_OWNER) GL_LIBS := $(TOP)/src/mesa/libmesagallium.a # OpenGL ES 1.x state tracker GLESv1_CM_CPPFLAGS := -I$(TOP)/src/mesa -GLESv1_CM_SYS := $(DRI_LIB_DEPS) -l$(GLESv1_CM_LIB) +GLESv1_CM_SYS := $(DRI_LIB_DEPS) -l$(GLAPI_OWNER) GLESv1_CM_LIBS := $(TOP)/src/mesa/libes1gallium.a # OpenGL ES 2.x state tracker GLESv2_CPPFLAGS := -I$(TOP)/src/mesa -GLESv2_SYS := $(DRI_LIB_DEPS) -l$(GLESv2_LIB) +GLESv2_SYS := $(DRI_LIB_DEPS) -l$(GLAPI_OWNER) GLESv2_LIBS := $(TOP)/src/mesa/libes2gallium.a # OpenVG state tracker diff --git a/src/mapi/es1api/Makefile b/src/mapi/es1api/Makefile index bec3754fe4..9445a1add9 100644 --- a/src/mapi/es1api/Makefile +++ b/src/mapi/es1api/Makefile @@ -40,14 +40,27 @@ GEN := glapi ESAPI_CPPFLAGS := \ -I$(TOP)/include \ -I$(TOP)/src/mapi/$(ESAPI) \ - -I$(TOP)/src/mapi \ - -DMAPI_MODE_GLAPI \ - -DMAPI_ABI_HEADER=\"glapi/glapi_tmp.h\" + -I$(TOP)/src/mapi include $(MAPI)/sources.mak +ifeq ($(GLAPI_OWNER),$(GLES_LIB)) +# full glapi +ESAPI_CPPFLAGS += \ + -DMAPI_MODE_GLAPI \ + -DMAPI_ABI_HEADER=\"glapi/glapi_tmp.h\" ESAPI_SOURCES := $(addprefix $(MAPI)/, $(MAPI_GLAPI_SOURCES)) ESAPI_OBJECTS := $(MAPI_GLAPI_SOURCES:.c=.o) +else +# bridge only +ESAPI_CPPFLAGS += \ + -DMAPI_MODE_BRIDGE \ + -DMAPI_ABI_HEADER=\"glapi/glapi_bridge.h\" +ESAPI_SOURCES := $(addprefix $(MAPI)/, $(MAPI_BRIDGE_SOURCES)) +ESAPI_OBJECTS := $(MAPI_BRIDGE_SOURCES:.c=.o) + +GLES_LIB_DEPS += -l$(GLAPI_OWNER) +endif .PHONY: default default: depend $(TOP)/$(LIB_DIR)/$(GLES_LIB_NAME) diff --git a/src/mapi/glapi/gen-es/Makefile b/src/mapi/glapi/gen-es/Makefile index 2259c90b5c..656f6d6c43 100644 --- a/src/mapi/glapi/gen-es/Makefile +++ b/src/mapi/glapi/gen-es/Makefile @@ -5,6 +5,7 @@ include $(TOP)/configs/current OUTPUTS := \ glapi/glapi_tmp.h \ + glapi/glapi_bridge.h \ main/glapidispatch.h \ main/remap_helper.h @@ -46,6 +47,11 @@ endef $(PYTHON2) $(PYTHON_FLAGS) $< \ --printer $(PRINTER) --mode lib $(APIXML) > $@ +%/glapi_bridge.h: $(MAPI)/mapi_abi.py $(COMMON) + @mkdir -p $(dir $@) + $(PYTHON2) $(PYTHON_FLAGS) $< \ + --printer $(PRINTER) --mode api $(GLAPI)/gl_API.xml > $@ + %/main/glapidispatch.h: $(GLAPI)/gl_table.py $(COMMON) $(call gen-glapi,-c -m remap_table) |