diff options
author | Chia-I Wu <[email protected]> | 2010-12-26 18:02:59 +0800 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2011-01-20 17:15:50 +0800 |
commit | 9767d3b5ad08640737e9d8dd4feb046478ae1f4b (patch) | |
tree | 6353dc0af4284cc15350a2f43cb64c6f62872b00 /src | |
parent | 97185bf2654f7e72d8bfcc216f905492655d4c77 (diff) |
glapi: Fix OpenGL ES 1.1 and 2.0 interop.
Move _glapi_* symbols from libGLESv1_CM.so and libGLESv2.so to
libglapi.so. This makes sure an app will get only one copy of glapi in
its address space.
Note that with this change, libGLES* 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.
Diffstat (limited to 'src')
-rw-r--r-- | src/mapi/es1api/Makefile | 128 | ||||
-rw-r--r-- | src/mapi/glapi/gen-es/Makefile | 61 | ||||
-rw-r--r-- | src/mapi/shared-glapi/Makefile | 61 |
3 files changed, 150 insertions, 100 deletions
diff --git a/src/mapi/es1api/Makefile b/src/mapi/es1api/Makefile index 3659d6486a8..4fa68e5c39d 100644 --- a/src/mapi/es1api/Makefile +++ b/src/mapi/es1api/Makefile @@ -7,27 +7,27 @@ include $(TOP)/configs/current ifeq ($(ES),) ES := es1 -GLES_HEADER := GLES -GLES_PC := glesv1_cm.pc - -GLES_LIB := $(GLESv1_CM_LIB) -GLES_LIB_NAME := $(GLESv1_CM_LIB_NAME) -GLES_LIB_GLOB := $(GLESv1_CM_LIB_GLOB) -GLES_LIB_DEPS := $(GLESv1_CM_LIB_DEPS) -GLES_LIB_MAJOR := 1 -GLES_LIB_MINOR := 1 -GLES_LIB_PATCH := 0 +esapi_HEADER := GLES +esapi_PC := glesv1_cm.pc + +esapi_LIB := $(GLESv1_CM_LIB) +esapi_LIB_NAME := $(GLESv1_CM_LIB_NAME) +esapi_LIB_GLOB := $(GLESv1_CM_LIB_GLOB) +esapi_LIB_DEPS := $(GLESv1_CM_LIB_DEPS) +esapi_LIB_MAJOR := 1 +esapi_LIB_MINOR := 1 +esapi_LIB_PATCH := 0 else -GLES_HEADER := GLES2 -GLES_PC := glesv2.pc - -GLES_LIB := $(GLESv2_LIB) -GLES_LIB_NAME := $(GLESv2_LIB_NAME) -GLES_LIB_GLOB := $(GLESv2_LIB_GLOB) -GLES_LIB_DEPS := $(GLESv2_LIB_DEPS) -GLES_LIB_MAJOR := 2 -GLES_LIB_MINOR := 0 -GLES_LIB_PATCH := 0 +esapi_HEADER := GLES2 +esapi_PC := glesv2.pc + +esapi_LIB := $(GLESv2_LIB) +esapi_LIB_NAME := $(GLESv2_LIB_NAME) +esapi_LIB_GLOB := $(GLESv2_LIB_GLOB) +esapi_LIB_DEPS := $(GLESv2_LIB_DEPS) +esapi_LIB_MAJOR := 2 +esapi_LIB_MINOR := 0 +esapi_LIB_PATCH := 0 endif ESAPI = $(ES)api @@ -37,51 +37,40 @@ MAPI := $(TOP)/src/mapi/mapi # directory for generated sources/headers GEN := glapi -include $(GLAPI)/sources.mak -GLAPI_OBJECTS := $(GLAPI_SOURCES:.c=.o) -GLAPI_SOURCES := $(addprefix $(GLAPI)/, $(GLAPI_SOURCES)) -GLAPI_ASM_OBJECTS := $(GLAPI_ASM_SOURCES:.S=.o) -GLAPI_ASM_SOURCES := $(addprefix $(GEN)/, $(GLAPI_ASM_SOURCES)) +esapi_CPPFLAGS := \ + -I$(TOP)/include \ + -I$(TOP)/src/mapi \ + -DMAPI_ABI_HEADER=\"$(ESAPI)/glapi_mapi_tmp.h\" include $(MAPI)/sources.mak -MAPI_UTIL_OBJECTS := $(MAPI_UTIL_SOURCES:.c=.o) -MAPI_UTIL_SOURCES := $(addprefix $(MAPI)/, $(MAPI_UTIL_SOURCES)) +esapi_SOURCES := $(addprefix $(MAPI)/, $(MAPI_BRIDGE_SOURCES)) +esapi_OBJECTS := $(MAPI_BRIDGE_SOURCES:.c=.o) +esapi_CPPFLAGS += -DMAPI_MODE_BRIDGE -ESAPI_OBJECTS = $(GLAPI_OBJECTS) $(GLAPI_ASM_OBJECTS) $(MAPI_UTIL_OBJECTS) - -INCLUDE_DIRS = \ - -I$(TOP)/include \ - -I$(TOP)/src/mapi/$(ESAPI) \ - -I$(TOP)/src/mapi \ - -I$(TOP)/src/mesa +esapi_LIB_DEPS := -L$(TOP)/$(LIB_DIR) -l$(GLAPI_LIB) $(esapi_LIB_DEPS) .PHONY: default -default: depend $(TOP)/$(LIB_DIR)/$(GLES_LIB_NAME) - -$(TOP)/$(LIB_DIR)/$(GLES_LIB_NAME): $(ESAPI_OBJECTS) - $(MKLIB) -o $(GLES_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \ - -major $(GLES_LIB_MAJOR) \ - -minor $(GLES_LIB_MINOR) \ - -patch $(GLES_LIB_PATCH) \ - -id $(INSTALL_LIB_DIR)/lib$(GLES_LIB).$(GLES_LIB_MAJOR).dylib \ +default: depend $(TOP)/$(LIB_DIR)/$(esapi_LIB_NAME) + +$(TOP)/$(LIB_DIR)/$(esapi_LIB_NAME): $(esapi_OBJECTS) + $(MKLIB) -o $(esapi_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \ + -major $(esapi_LIB_MAJOR) \ + -minor $(esapi_LIB_MINOR) \ + -patch $(esapi_LIB_PATCH) \ + -id $(INSTALL_LIB_DIR)/lib$(esapi_LIB).$(esapi_LIB_MAJOR).dylib \ $(MKLIB_OPTIONS) -install $(TOP)/$(LIB_DIR) \ - $(ESAPI_OBJECTS) $(GLES_LIB_DEPS) + $(esapi_OBJECTS) $(esapi_LIB_DEPS) # not used, but kept for completeness -lib$(ESAPI).a: $(ESAPI_OBJECTS) - @$(MKLIB) -o $(ESAPI) -static $(ESAPI_OBJECTS) - -$(GLAPI_OBJECTS): %.o: $(GLAPI)/%.c - $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) -DMAPI_MODE_UTIL $< -o $@ +lib$(ESAPI).a: $(esapi_OBJECTS) + @$(MKLIB) -o $(ESAPI) -static $(esapi_OBJECTS) -$(GLAPI_ASM_OBJECTS): %.o: $(GEN)/%.S - $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@ +$(esapi_OBJECTS): %.o: $(MAPI)/%.c + $(CC) -c $(esapi_CPPFLAGS) $(CFLAGS) $< -o $@ -$(MAPI_UTIL_OBJECTS): %.o: $(MAPI)/%.c - $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) -DMAPI_MODE_UTIL $< -o $@ - -$(GLAPI_SOURCES) $(GLAPI_ASM_SOURCES): | glapi-stamp +$(esapi_SOURCES): | glapi-stamp +.PHONY: glapi-stamp glapi-stamp: @# generate sources/headers @$(MAKE) -C $(GLAPI)/gen-es $(ES) @@ -89,10 +78,10 @@ glapi-stamp: .PHONY: clean clean: - -rm -f $(GLES_PC) - -rm -f $(TOP)/$(LIB_DIR)/$(GLES_LIB_NAME) + -rm -f $(esapi_PC) + -rm -f $(TOP)/$(LIB_DIR)/$(esapi_LIB_NAME) -rm -f lib$(ESAPI).a - -rm -f $(ESAPI_OBJECTS) + -rm -f $(esapi_OBJECTS) -rm -f depend depend.bak -rm -f glapi-stamp @# clean generated sources/headers @@ -118,27 +107,28 @@ pcedit-es2 = \ -e 's,@GLESv2_PC_CFLAGS@,$(GLESv2_PC_CFLAGS),' \ -e 's,@GLESv2_LIB@,$(GLESv2_LIB),' -$(GLES_PC): $(GLES_PC).in +$(esapi_PC): $(esapi_PC).in @sed $(pcedit-$(ES)) $< > $@ install-headers: - $(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/$(GLES_HEADER) - $(INSTALL) -m 644 $(TOP)/include/$(GLES_HEADER)/*.h \ - $(DESTDIR)$(INSTALL_INC_DIR)/$(GLES_HEADER) + $(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/$(esapi_HEADER) + $(INSTALL) -m 644 $(TOP)/include/$(esapi_HEADER)/*.h \ + $(DESTDIR)$(INSTALL_INC_DIR)/$(esapi_HEADER) -install-pc: $(GLES_PC) +install-pc: $(esapi_PC) $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig - $(INSTALL) -m 644 $(GLES_PC) $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig + $(INSTALL) -m 644 $(esapi_PC) $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig install: default install-headers install-pc $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR) - $(MINSTALL) $(TOP)/$(LIB_DIR)/$(GLES_LIB_GLOB) \ + $(MINSTALL) $(TOP)/$(LIB_DIR)/$(esapi_LIB_GLOB) \ $(DESTDIR)$(INSTALL_LIB_DIR) -depend: $(GLAPI_SOURCES) $(MAPI_UTIL_SOURCES) +depend: $(esapi_SOURCES) @echo "running $(MKDEP)" @touch depend - @$(MKDEP) $(MKDEP_OPTIONS) -f- $(DEFINES) $(INCLUDE_DIRS) \ - -DMAPI_MODE_UTIL $(GLAPI_SOURCES) $(MAPI_UTIL_SOURCES) \ - 2>/dev/null | sed -e 's,^$(GLAPI)/,,' -e 's,^$(MAPI)/,,' \ - > depend + @$(MKDEP) $(MKDEP_OPTIONS) -f- $(DEFINES) $(esapi_CPPFLAGS) \ + $(esapi_SOURCES) 2>/dev/null | \ + sed -e 's,^$(GLAPI)/,,' -e 's,^$(MAPI)/,,' > depend + +-include depend diff --git a/src/mapi/glapi/gen-es/Makefile b/src/mapi/glapi/gen-es/Makefile index 837579248f7..7a5bb35ca11 100644 --- a/src/mapi/glapi/gen-es/Makefile +++ b/src/mapi/glapi/gen-es/Makefile @@ -1,18 +1,14 @@ TOP = ../../../.. +MAPI = $(TOP)/src/mapi/mapi GLAPI = ../gen include $(TOP)/configs/current OUTPUTS := \ - glapi/glapitable.h \ - glapi/glapitemp.h \ - glapi/glprocs.h \ - glapi/glapi_sparc.S \ - glapi/glapi_x86-64.S \ - glapi/glapi_x86.S \ + glapi_mapi_tmp.h \ main/glapidispatch.h \ main/remap_helper.h -COMMON = gl_XML.py glX_XML.py license.py typeexpr.py +COMMON = gl_and_es_API.xml gl_XML.py glX_XML.py license.py typeexpr.py COMMON := $(addprefix $(GLAPI)/, $(COMMON)) ES1_APIXML := es1_API.xml @@ -28,41 +24,41 @@ ES2_DEPS = $(ES2_APIXML) base2_API.xml es2_EXT.xml es_EXT.xml \ ES1_OUTPUTS := $(addprefix $(ES1_OUTPUT_DIR)/, $(OUTPUTS)) ES2_OUTPUTS := $(addprefix $(ES2_OUTPUT_DIR)/, $(OUTPUTS)) -all: es1 es2 +SHARED_GLAPI_APIXML := $(GLAPI)/gl_and_es_API.xml +SHARED_GLAPI_OUTPUT_DIR := $(TOP)/src/mapi/shared-glapi +SHARED_GLAPI_DEPS := $(SHARED_GLAPI_APIXML) +SHARED_GLAPI_OUTPUTS = $(SHARED_GLAPI_OUTPUT_DIR)/glapi_mapi_tmp.h + +all: es1 es2 shared-glapi es1: $(ES1_OUTPUTS) es2: $(ES2_OUTPUTS) +shared-glapi: $(SHARED_GLAPI_OUTPUTS) $(ES1_OUTPUTS): APIXML := $(ES1_APIXML) -$(ES2_OUTPUTS): APIXML := $(ES2_APIXML) +$(ES1_OUTPUTS): PRINTER := es1api $(ES1_OUTPUTS): $(ES1_DEPS) + +$(ES2_OUTPUTS): APIXML := $(ES2_APIXML) +$(ES2_OUTPUTS): PRINTER := es2api $(ES2_OUTPUTS): $(ES2_DEPS) +$(SHARED_GLAPI_OUTPUTS): APIXML := $(SHARED_GLAPI_APIXML) +$(SHARED_GLAPI_OUTPUTS): PRINTER := shared-glapi +$(SHARED_GLAPI_OUTPUTS): $(SHARED_GLAPI_DEPS) + define gen-glapi @mkdir -p $(dir $@) $(PYTHON2) $(PYTHON_FLAGS) $< -f $(APIXML) $(1) > $@ endef -%/glapidispatch.h: $(GLAPI)/gl_table.py $(COMMON) - $(call gen-glapi,-c -m remap_table) - -%/glapitable.h: $(GLAPI)/gl_table.py $(COMMON) - $(call gen-glapi,-c) - -%/glapitemp.h: $(GLAPI)/gl_apitemp.py $(COMMON) - $(call gen-glapi,-c) - -%/glprocs.h: $(GLAPI)/gl_procs.py $(COMMON) - $(call gen-glapi,-c) - -%/glapi_sparc.S: $(GLAPI)/gl_SPARC_asm.py $(COMMON) - $(call gen-glapi) - -%/glapi_x86-64.S: $(GLAPI)/gl_x86-64_asm.py $(COMMON) - $(call gen-glapi) +%/glapi_mapi_tmp.h: $(MAPI)/mapi_abi.py $(COMMON) + @mkdir -p $(dir $@) + $(PYTHON2) $(PYTHON_FLAGS) $< \ + --printer $(PRINTER) --mode lib $(GLAPI)/gl_and_es_API.xml > $@ -%/glapi_x86.S: $(GLAPI)/gl_x86_asm.py $(COMMON) - $(call gen-glapi) +%/main/glapidispatch.h: $(GLAPI)/gl_table.py $(COMMON) + $(call gen-glapi,-c -m remap_table) %/main/remap_helper.h: $(GLAPI)/remap_helper.py $(COMMON) $(call gen-glapi) @@ -81,12 +77,15 @@ verify_xml: @rm -f tmp.xml clean-es1: - -rm -rf $(ES1_OUTPUT_DIR)/glapi + -rm -f $(ES1_OUTPUTS) -rm -rf $(ES1_OUTPUT_DIR)/main clean-es2: - -rm -rf $(ES2_OUTPUT_DIR)/glapi + -rm -f $(ES2_OUTPUTS) -rm -rf $(ES2_OUTPUT_DIR)/main -clean: clean-es1 clean-es2 +clean-shared-glapi: + -rm -f $(SHARED_GLAPI_OUTPUTS) + +clean: clean-es1 clean-es2 clean-shared-glapi -rm -f *~ *.pyc *.pyo diff --git a/src/mapi/shared-glapi/Makefile b/src/mapi/shared-glapi/Makefile new file mode 100644 index 00000000000..b89c458f501 --- /dev/null +++ b/src/mapi/shared-glapi/Makefile @@ -0,0 +1,61 @@ +# src/mapi/shared-glapi/Makefile +# +# Used by OpenGL ES +# + +TOP := ../../.. +include $(TOP)/configs/current + +GLAPI := $(TOP)/src/mapi/glapi +MAPI := $(TOP)/src/mapi/mapi + +glapi_CPPFLAGS := \ + -I$(TOP)/include \ + -I$(TOP)/src/mapi \ + -DMAPI_MODE_GLAPI \ + -DMAPI_ABI_HEADER=\"shared-glapi/glapi_mapi_tmp.h\" + +include $(MAPI)/sources.mak +glapi_SOURCES := $(addprefix $(MAPI)/, $(MAPI_GLAPI_SOURCES)) +glapi_OBJECTS := $(MAPI_GLAPI_SOURCES:.c=.o) + +.PHONY: default +default: depend $(TOP)/$(LIB_DIR)/$(GLAPI_LIB_NAME) + +$(TOP)/$(LIB_DIR)/$(GLAPI_LIB_NAME): $(glapi_OBJECTS) + $(MKLIB) -o $(GLAPI_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \ + -major 0 -minor 0 -patch 0 \ + -id $(INSTALL_LIB_DIR)/lib$(GLAPI_LIB).0.dylib \ + $(MKLIB_OPTIONS) -install $(TOP)/$(LIB_DIR) \ + $(glapi_OBJECTS) $(GLAPI_LIB_DEPS) + +$(glapi_OBJECTS): %.o: $(MAPI)/%.c + $(CC) -c $(glapi_CPPFLAGS) $(CFLAGS) $< -o $@ + +$(glapi_SOURCES): glapi_mapi_tmp.h + +.PHONY: glapi_mapi_tmp.h +glapi_mapi_tmp.h: + @$(MAKE) -C $(GLAPI)/gen-es shared-glapi + +.PHONY: clean +clean: + -rm -f $(TOP)/$(LIB_DIR)/$(GLAPI_LIB_NAME) + -rm -f $(glapi_OBJECTS) + -rm -f depend depend.bak + @# clean generated sources/headers + @$(MAKE) -C $(GLAPI)/gen-es clean-shared-glapi + +install: + $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR) + $(MINSTALL) $(TOP)/$(LIB_DIR)/$(GLAPI_LIB_GLOB) \ + $(DESTDIR)$(INSTALL_LIB_DIR) + +depend: $(glapi_SOURCES) + @echo "running $(MKDEP)" + @touch depend + @$(MKDEP) $(MKDEP_OPTIONS) -f- $(DEFINES) $(glapi_CPPFLAGS) \ + $(glapi_SOURCES) 2>/dev/null | sed -e 's,^$(MAPI)/,,' \ + > depend + +-include depend |