diff options
86 files changed, 118 insertions, 11690 deletions
diff --git a/emulator/opengl/Android.mk b/emulator/opengl/Android.mk index 2c1cb64..a349b96 100644 --- a/emulator/opengl/Android.mk +++ b/emulator/opengl/Android.mk @@ -56,19 +56,6 @@ include $(EMUGL_PATH)/host/tools/emugen/Android.mk include $(EMUGL_PATH)/shared/OpenglOsUtils/Android.mk include $(EMUGL_PATH)/shared/OpenglCodecCommon/Android.mk -# System static libraries -include $(EMUGL_PATH)/system/GLESv1_enc/Android.mk -include $(EMUGL_PATH)/system/GLESv2_enc/Android.mk -include $(EMUGL_PATH)/system/renderControl_enc/Android.mk -include $(EMUGL_PATH)/system/OpenglSystemCommon/Android.mk - -# System shared libraries -include $(EMUGL_PATH)/system/GLESv1/Android.mk -include $(EMUGL_PATH)/system/GLESv2/Android.mk - -include $(EMUGL_PATH)/system/gralloc/Android.mk -include $(EMUGL_PATH)/system/egl/Android.mk - # Host static libraries include $(EMUGL_PATH)/host/libs/GLESv1_dec/Android.mk include $(EMUGL_PATH)/host/libs/GLESv2_dec/Android.mk diff --git a/emulator/opengl/DESIGN b/emulator/opengl/DESIGN index 1da44b7..70a5d27 100644 --- a/emulator/opengl/DESIGN +++ b/emulator/opengl/DESIGN @@ -210,8 +210,11 @@ in the Android source trees: - The emulator sources are under $ANDROID/external/qemu, which we'll call $QEMU in the rest of this document. - - The guest and system libraries are under - $ANDROID/development/tools/emulator/opengl, which we'll call $EMUGL + - The guest libraries are under + $ANDROID/development/tools/emulator/opengl, which we'll call $EMUGL_GUEST + + - The host renderer and translator libraries are under + $ANDROID/sdk/emulator/opengl, which we'll call $EMUGL_HOST - The QEMU Pipe kernel driver is under $KERNEL/drivers/misc/qemupipe @@ -228,10 +231,18 @@ The emulator sources related to this projects are: The other sources are: - $EMUGL/system -> system libraries - $EMUGL/host -> host libraries (translator + renderer) - $EMUGL/shared -> shared libraries, used both in the guest and the host - $EMUGL/tests -> various test programs + $EMUGL_GUEST/system -> system libraries + $EMUGL_GUEST/shared -> guest copy of shared libraries + $EMUGL_GUEST/tests -> various test programs + $EMUGL_HOST/host -> host libraries (translator + renderer) + $EMUGL_HOST/shared -> host copy of shared libraries + $EMUGL_HOST/tests -> various test programs + +The reason the shared libraries aren't actually shared is historical: at one +point both guest and host code lived in the same place. That turned out to be +impractical with the way the Android SDK is branched, and didn't support the +requirement that a single emulator binary be able to run several generations +of Android. Translator libraries: @@ -254,13 +265,13 @@ For simplicity, only the library name suffix will change (i.e. the The source code for these libraries is located under the following path in the Android source tree: - $EMUGL/host/libs/Translator/EGL - $EMUGL/host/libs/Translator/GLES_CM - $EMUGL/host/libs/Translator/GLES_V2 + $EMUGL_HOST/host/libs/Translator/EGL + $EMUGL_HOST/host/libs/Translator/GLES_CM + $EMUGL_HOST/host/libs/Translator/GLES_V2 The translator libraries also use a common routines defined under: - $EMUGL/host/libs/Translator/GLcommon + $EMUGL_HOST/host/libs/Translator/GLcommon Wire Protocol Overiew: @@ -321,14 +332,18 @@ host. The host IOStream implementations are under $EMUGL/shared/OpenglCodecCommon/, see in particular: - $EMUGL/shared/OpenglCodecCommon/TcpStream.cpp -> using local TCP sockets - $EMUGL/shared/OpenglCodecCommon/UnixStream.cpp -> using Unix sockets - $EMUGL/shared/OpenglCodecCommon/Win32PipeStream.cpp -> using Win32 named pipes + $EMUGL_HOST/shared/OpenglCodecCommon/TcpStream.cpp + -> using local TCP sockets + $EMUGL_HOST/shared/OpenglCodecCommon/UnixStream.cpp + -> using Unix sockets + $EMUGL_HOST/shared/OpenglCodecCommon/Win32PipeStream.cpp + -> using Win32 named pipes The guest IOStream implementation uses the TcpStream.cpp above, as well as an alternative QEMU-specific source: - $EMUGL/system/OpenglSystemCommon/QemuPipeStream.cpp -> uses QEMU pipe from the guest + $EMUGL_GUEST/system/OpenglSystemCommon/QemuPipeStream.cpp + -> uses QEMU pipe from the guest The QEMU Pipe implementation is _significantly_ faster (about 20x) due to several reasons: @@ -348,38 +363,35 @@ several reasons: However, would it be necessary, you could write a guest IOStream implementation that uses a different transport. If you do, please look at -$EMUGL/system/OpenglCodecCommon/HostConnection.cpp which contains the code -used to connect the guest to the host, on a per-thread basis. +$EMUGL_GUEST/system/OpenglCodecCommon/HostConnection.cpp which contains the +code used to connect the guest to the host, on a per-thread basis. Source code auto-generation: - - - - - - - - - - - - - - -The 'emugen' tool is located under $EMUGL/host/tools/emugen. There is a README -file that explains how it works. +The 'emugen' tool is located under $EMUGL_HOST/host/tools/emugen. There is a +README file that explains how it works. You can also look at the following specifications files: For GLES 1.1: - $EMUGL/system/GLESv1_enc/gl.types - $EMUGL/system/GLESv1_enc/gl.in - $EMUGL/system/GLESv1_enc/gl.attrib - $EMUGL/system/GLESv1_enc/gl.addon + $EMUGL_HOST/host/GLESv1_dec/gl.types + $EMUGL_HOST/host/GLESv1_dec/gl.in + $EMUGL_HOST/host/GLESv1_dec/gl.attrib For GLES 2.0: - $EMUGL/system/GLESv2_enc/gl2.types - $EMUGL/system/GLESv2_enc/gl2.in - $EMUGL/system/GLESv2_enc/gl2.attrib - $EMUGL/system/GLESv2_enc/gl2.addon + $EMUGL_HOST/host/GLESv2_dec/gl2.types + $EMUGL_HOST/host/GLESv2_dec/gl2.in + $EMUGL_HOST/host/GLESv2_dec/gl2.attrib For EGL: - $EMUGL/system/renderControl_enc/renderControl.types - $EMUGL/system/renderControl_enc/renderControl.in - $EMUGL/system/renderControl_enc/renderControl.attrib - $EMUGL/system/renderControl_enc/renderControl.addon + $EMUGL_HOST/host/renderControl_dec/renderControl.types + $EMUGL_HOST/host/renderControl_dec/renderControl.in + $EMUGL_HOST/host/renderControl_dec/renderControl.attrib Note that the EGL specification files are under a directory named -"renderControl_enc" and have filenames that begin with "renderControl" +"renderControl_dec" and have filenames that begin with "renderControl" This is mainly for historic reasons now, but is also related to the fact that this part of the wire protocol contains support functions/calls/specifications @@ -389,13 +401,20 @@ the "gralloc" system library module used to manage graphics surfaces at a lower level than EGL. Generally speaking, guest encoder sources are located under directories -named $EMUGL/system/<name>_enc/, while the corresponding host decoder -sources will be under $EMUGL/host/libs/<name>_dec/ +named $EMUGL_GUEST/system/<name>_enc/, while the corresponding host decoder +sources will be under $EMUGL_HOST/host/libs/<name>_dec/ However, all these sources use the same spec files located under the -encoding directories. The decoders may even need to include a few -non-auto-generated header files from the encoder directories. +decoding directories. +The encoder files are built from emugen and spec files located in $EMUGL_HOST +and copied to the encoder directories in $EMUGL_GUEST by the gen-encoder.sh +script. They are checked in, so that a given version of Android supports a +specific version of the protocol, even if newer versions of the renderer (and +future Android versions) support a newer protocol version. This step needs to +be done manually when the protocol changes; these changes also need to be +accompanied by changes in the renderer to handle the old version of the +protocol. System libraries: @@ -449,11 +468,12 @@ the following lines: 0 1 emulation 0 0 android -See $EMUGL/system/egl/egl.cfg and more generally the following build files: +See $EMUGL_GUEST/system/egl/egl.cfg and more generally the following build +files: - $EMUGL/system/egl/Android.mk - $EMUGL/system/GLESv1/Android.mk - $EMUGL/system/GLESv2/Android.mk + $EMUGL_GUEST/system/egl/Android.mk + $EMUGL_GUEST/system/GLESv1/Android.mk + $EMUGL_GUEST/system/GLESv2/Android.mk to see how the libraries are named and placed under /system/lib/egl/ by the build system. @@ -464,9 +484,9 @@ Emulation libraries: The emulator-specific libraries are under the following: - $EMUGL/system/egl/ - $EMUGL/system/GLESv1/ - $EMUGL/system/GLESv2/ + $EMUGL_GUEST/system/egl/ + $EMUGL_GUEST/system/GLESv1/ + $EMUGL_GUEST/system/GLESv2/ The code for GLESv1 and GLESv2 is pretty small, since it mostly link against the static encoding libraries. @@ -526,9 +546,10 @@ notice here: Host Renderer: -------------- -The host renderer library is located under $EMUGL/host/libs/libOpenglRender, -and it provides an interface described by the headers under -$EMUGL/host/include/libOpenglRender/render_api.h (e.g. for use by the emulator). +The host renderer library is located under +$EMUGL_HOST/host/libs/libOpenglRender, and it provides an interface described +by the headers under $EMUGL_HOST/host/include/libOpenglRender/render_api.h +(e.g. for use by the emulator). In a nutshell, the rendering library is responsible for the following: diff --git a/emulator/opengl/README b/emulator/opengl/README index 1a7536e..f806b41 100644 --- a/emulator/opengl/README +++ b/emulator/opengl/README @@ -1,4 +1,6 @@ -This directory contains the modules related to hardware OpenGL ES emulation. +This directory contains the host-side modules related to hardware OpenGL ES +emulation. The guest-side modules are in +$ANDROID_BUILD_TOP/development/tools/emulator/opengl. I. Overview of components: ========================== diff --git a/emulator/opengl/common.mk b/emulator/opengl/common.mk index 82f652d..78b29ca 100644 --- a/emulator/opengl/common.mk +++ b/emulator/opengl/common.mk @@ -20,8 +20,6 @@ # LOCAL_C_INCLUDES += .... # $(call emugl-end-module) # -emugl-begin-static-library = $(call emugl-begin-module,$1,STATIC_LIBRARY) -emugl-begin-shared-library = $(call emugl-begin-module,$1,SHARED_LIBRARY) emugl-begin-host-static-library = $(call emugl-begin-module,$1,HOST_STATIC_LIBRARY,HOST) emugl-begin-host-shared-library = $(call emugl-begin-module,$1,HOST_SHARED_LIBRARY,HOST) emugl-begin-host-executable = $(call emugl-begin-module,$1,HOST_EXECUTABLE,HOST) @@ -198,34 +196,6 @@ emugl-gen-decoder = \ $(call emugl-gen-decoder-generic,$(_emugl_out),$1,$2)\ $(call emugl-export,C_INCLUDES,$(_emugl_out)) -# This function can be called to generate the encoder source files. -# LOCAL_MODULE and LOCAL_MODULE_CLASS must be defined or the build will abort. -# Source files will be stored in the local intermediates directory that will -# be automatically added to your LOCAL_C_INCLUDES. -# Usage: -# $(call emugl-gen-encoder,<input-dir>,<basename>) -# -emugl-gen-encoder = \ - $(eval _emugl_out := $(call local-intermediates-dir)) \ - $(call emugl-gen-encoder-generic,$(_emugl_out),$1,$2) \ - $(call emugl-export,C_INCLUDES,$(_emugl_out)) - - -# This function can be called to generate the wrapper source files. -# LOCAL_MODULE and LOCAL_MODULE_CLASS must be defined or the build will abort. -# Source files will be stored in the local intermediates directory that will -# be automatically added to your LOCAL_C_INCLUDES. -# Usage: -# $(call emugl-gen-wrapper,<input-dir>,<basename>) -# -emugl-gen-wrapper = \ - $(eval _emugl_out := $(call local-intermediates-dir)) \ - $(call emugl-gen-wrapper-generic,$(_emugl_out),$1,$2) \ - $(call emugl-export,C_INCLUDES,$(_emugl_out)) - -# IMPORTANT: EMUGL_EMUGEN is defined under host/tools/emugen/Android.mk -# - # DO NOT CALL DIRECTLY, USE emugl-gen-decoder instead. # # The following function can be called to generate wire protocol decoder @@ -258,77 +228,6 @@ LOCAL_GENERATED_SOURCES += $$(GEN) LOCAL_C_INCLUDES += $$1 endef -# DO NOT CALL DIRECTLY, USE emugl-gen-encoder instead. -# -# The following function can be called to generate wire protocol encoder -# source files, Usage is: -# -# $(call emugl-gen-encoder-generic,<dst-dir>,<src-dir>,<basename>) -# -# <dst-dir> is the destination directory where the generated sources are stored -# <src-dir> is the source directory where to find <basename>.attrib, etc.. -# <basename> is the emugen basename (see host/tools/emugen/README) -# -emugl-gen-encoder-generic = $(eval $(emugl-gen-encoder-generic-ev)) - -define emugl-gen-encoder-generic-ev -_emugl_enc := $$1/$$3 -_emugl_src := $$2/$$3 -GEN := $$(_emugl_enc)_entry.cpp \ - $$(_emugl_enc)_enc.cpp \ - $$(_emugl_enc)_enc.h \ - $$(_emugl_enc)_ftable.h \ - $$(_emugl_enc)_opcodes.h \ - $$(_emugl_enc)_client_context.h \ - $$(_emugl_enc)_client_context.cpp - -$$(GEN): PRIVATE_PATH := $$(LOCAL_PATH) -$$(GEN): PRIVATE_CUSTOM_TOOL := $$(EMUGL_EMUGEN) -E $$1 -i $$2 $$3 -$$(GEN): $$(EMUGL_EMUGEN) $$(_emugl_src).attrib $$(_emugl_src).in $$(_emugl_src).types - $$(transform-generated-source) - -$$(call emugl-export,ADDITIONAL_DEPENDENCIES,$$(GEN)) -LOCAL_GENERATED_SOURCES += $$(GEN) -LOCAL_C_INCLUDES += $$1 -endef - - -# DO NOT CALL DIRECTLY, USE emugl-gen-wrapper instead. -# -# The following function can be called to generate GL library wrapper -# Usage is: -# -# $(call emugl-gen-wrapper-generic,<dst-dir>,<src-dir>,<basename>) -# -# <dst-dir> is the destination directory where the generated sources are stored -# <src-dir> is the source directory where to find <basename>.attrib, etc.. -# <basename> is the emugen basename (see host/tools/emugen/README) -# -emugl-gen-wrapper-generic = $(eval $(emugl-gen-wrapper-generic-ev)) - -define emugl-gen-wrapper-generic-ev -_emugl_wrap := $$1/$$3 -_emugl_src := $$2/$$3 -GEN := $$(_emugl_wrap)_wrapper_entry.cpp \ - $$(_emugl_wrap)_wrapper_context.cpp \ - $$(_emugl_wrap)_wrapper_context.h \ - $$(_emugl_wrap)_wrapper_proc.h - -$$(GEN): PRIVATE_PATH := $$(LOCAL_PATH) -$$(GEN): PRIVATE_CUSTOM_TOOL := $$(EMUGL_EMUGEN) -W $$1 -i $$2 $$3 -$$(GEN): $$(EMUGL_EMUGEN) $$(_emugl_src).attrib $$(_emugl_src).in $$(_emugl_src).types - $$(transform-generated-source) - -$$(call emugl-export,ADDITIONAL_DEPENDENCIES,$$(GEN)) -LOCAL_GENERATED_SOURCES += $$(GEN) -LOCAL_C_INCLUDES += $$1 - -#ifneq ($$(HOST_OS),windows) -$$(call emugl-export,LDFLAGS,-ldl) -#endif - -endef - # Call this function when your shared library must be placed in a non-standard # library path (i.e. not under /system/lib # $1: library sub-path,relative to /system/lib diff --git a/emulator/opengl/gen-encoder.sh b/emulator/opengl/gen-encoder.sh new file mode 100755 index 0000000..23ecf03 --- /dev/null +++ b/emulator/opengl/gen-encoder.sh @@ -0,0 +1,40 @@ +#!/bin/sh +# Generate the Android-side encoder source files. +# Requirements: +# (a) The ANDROID_BUILD_TOP and ANDROID_HOST_OUT environment variables must be +# defined appropriately. The Android "lunch" bash function will do this. +# (b) The emugen binary must already be built. Any normal build that includes +# the emulator will do this. + +if [ -z "$ANDROID_BUILD_TOP" ]; then + echo error: ANDROID_BUILD_TOP not set + exit 1 +fi +cd "$ANDROID_BUILD_TOP" >/dev/null +SRCDIR="sdk/emulator/opengl/host/libs" +DSTDIR="development/tools/emulator/opengl/system" +if [ ! -d "$SRCDIR" -o ! -d "$DSTDIR" ]; then + echo error: can\'t find source and/or destination directory + exit 1 +fi + +if [ -z "$ANDROID_HOST_OUT" ]; then + echo error: ANDROID_HOST_OUT not set + exit 1 +fi +EMUGEN="$ANDROID_HOST_OUT/bin/emugen" +if [ ! -x "$EMUGEN" ]; then + echo error: emugen not available, did you forget to build? + exit 1 +fi + +function gen() { + local src="$SRCDIR/$1_dec" + local dst="$DSTDIR/$1_enc" + local name="$2" + echo "${EMUGEN}" -E "$dst" -i "$src" "$name" "$src/$name".{attrib,in,types} +} + +$(gen GLESv1 gl) +$(gen GLESv2 gl2) +$(gen renderControl renderControl) diff --git a/emulator/opengl/host/libs/GLESv1_dec/Android.mk b/emulator/opengl/host/libs/GLESv1_dec/Android.mk index 57dc429..a6d8670 100644 --- a/emulator/opengl/host/libs/GLESv1_dec/Android.mk +++ b/emulator/opengl/host/libs/GLESv1_dec/Android.mk @@ -13,13 +13,10 @@ $(call emugl-begin-host-static-library,libGLESv1_dec) $(call emugl-import, libOpenglCodecCommon libOpenglOsUtils) $(call emugl-export,C_INCLUDES,$(LOCAL_PATH)) -$(call emugl-gen-decoder,$(EMUGL_PATH)/system/GLESv1_enc,gl) +$(call emugl-gen-decoder,$(LOCAL_PATH),gl) LOCAL_SRC_FILES := GLDecoder.cpp -# for gl_types.h ! -$(call emugl-export,C_INCLUDES,$(EMUGL_PATH)/system/GLESv1_enc) - $(call emugl-export,CFLAGS,$(host_common_debug_CFLAGS)) $(call emugl-end-module) @@ -31,13 +28,10 @@ $(call emugl-begin-host-static-library,lib64GLESv1_dec) $(call emugl-import, lib64OpenglCodecCommon lib64OpenglOsUtils) $(call emugl-export,C_INCLUDES,$(LOCAL_PATH)) -$(call emugl-gen-decoder,$(EMUGL_PATH)/system/GLESv1_enc,gl) +$(call emugl-gen-decoder,$(LOCAL_PATH),gl) LOCAL_SRC_FILES := GLDecoder.cpp -# for gl_types.h ! -$(call emugl-export,C_INCLUDES,$(EMUGL_PATH)/system/GLESv1_enc) - $(call emugl-export,CFLAGS,$(host_common_debug_CFLAGS) -m64) $(call emugl-end-module) diff --git a/emulator/opengl/system/GLESv1_enc/gl.addon b/emulator/opengl/host/libs/GLESv1_dec/gl.addon index 2331f87..2331f87 100644 --- a/emulator/opengl/system/GLESv1_enc/gl.addon +++ b/emulator/opengl/host/libs/GLESv1_dec/gl.addon diff --git a/emulator/opengl/system/GLESv1_enc/gl.attrib b/emulator/opengl/host/libs/GLESv1_dec/gl.attrib index 9b84f89..9b84f89 100644 --- a/emulator/opengl/system/GLESv1_enc/gl.attrib +++ b/emulator/opengl/host/libs/GLESv1_dec/gl.attrib diff --git a/emulator/opengl/system/GLESv1_enc/gl.in b/emulator/opengl/host/libs/GLESv1_dec/gl.in index 4340608..4340608 100644 --- a/emulator/opengl/system/GLESv1_enc/gl.in +++ b/emulator/opengl/host/libs/GLESv1_dec/gl.in diff --git a/emulator/opengl/system/GLESv1_enc/gl.types b/emulator/opengl/host/libs/GLESv1_dec/gl.types index b269c01..b269c01 100644 --- a/emulator/opengl/system/GLESv1_enc/gl.types +++ b/emulator/opengl/host/libs/GLESv1_dec/gl.types diff --git a/emulator/opengl/system/GLESv1_enc/gl_types.h b/emulator/opengl/host/libs/GLESv1_dec/gl_types.h index 36fabfb..36fabfb 100644 --- a/emulator/opengl/system/GLESv1_enc/gl_types.h +++ b/emulator/opengl/host/libs/GLESv1_dec/gl_types.h diff --git a/emulator/opengl/host/libs/GLESv2_dec/Android.mk b/emulator/opengl/host/libs/GLESv2_dec/Android.mk index f9a83ae..7a034ec 100644 --- a/emulator/opengl/host/libs/GLESv2_dec/Android.mk +++ b/emulator/opengl/host/libs/GLESv2_dec/Android.mk @@ -10,10 +10,9 @@ host_common_debug_CFLAGS := ### host library ########################################## $(call emugl-begin-host-static-library,libGLESv2_dec) $(call emugl-import, libOpenglCodecCommon libOpenglOsUtils) -$(call emugl-gen-decoder,$(EMUGL_PATH)/system/GLESv2_enc,gl2) +$(call emugl-gen-decoder,$(LOCAL_PATH),gl2) # For gl2_types.h ! -$(call emugl-export,C_INCLUDES,$(EMUGL_PATH)/system/GLESv2_enc) $(call emugl-export,C_INCLUDES,$(LOCAL_PATH)) $(call emugl-export,CFLAGS,$(host_common_debug_CFLAGS)) @@ -25,10 +24,9 @@ $(call emugl-end-module) ### host library, 64-bit #################################### $(call emugl-begin-host-static-library,lib64GLESv2_dec) $(call emugl-import, lib64OpenglCodecCommon lib64OpenglOsUtils) -$(call emugl-gen-decoder,$(EMUGL_PATH)/system/GLESv2_enc,gl2) +$(call emugl-gen-decoder,$(LOCAL_PATH),gl2) # For gl2_types.h ! -$(call emugl-export,C_INCLUDES,$(EMUGL_PATH)/system/GLESv2_enc) $(call emugl-export,C_INCLUDES,$(LOCAL_PATH)) $(call emugl-export,CFLAGS,$(host_common_debug_CFLAGS) -m64) diff --git a/emulator/opengl/system/GLESv2_enc/gl2.attrib b/emulator/opengl/host/libs/GLESv2_dec/gl2.attrib index 7fe9a66..7fe9a66 100644 --- a/emulator/opengl/system/GLESv2_enc/gl2.attrib +++ b/emulator/opengl/host/libs/GLESv2_dec/gl2.attrib diff --git a/emulator/opengl/system/GLESv2_enc/gl2.in b/emulator/opengl/host/libs/GLESv2_dec/gl2.in index 916153b..916153b 100644 --- a/emulator/opengl/system/GLESv2_enc/gl2.in +++ b/emulator/opengl/host/libs/GLESv2_dec/gl2.in diff --git a/emulator/opengl/system/GLESv2_enc/gl2.types b/emulator/opengl/host/libs/GLESv2_dec/gl2.types index 4cee99e..4cee99e 100644 --- a/emulator/opengl/system/GLESv2_enc/gl2.types +++ b/emulator/opengl/host/libs/GLESv2_dec/gl2.types diff --git a/emulator/opengl/system/GLESv2_enc/gl2_types.h b/emulator/opengl/host/libs/GLESv2_dec/gl2_types.h index bfff61d..bfff61d 100644 --- a/emulator/opengl/system/GLESv2_enc/gl2_types.h +++ b/emulator/opengl/host/libs/GLESv2_dec/gl2_types.h diff --git a/emulator/opengl/host/libs/renderControl_dec/Android.mk b/emulator/opengl/host/libs/renderControl_dec/Android.mk index 3253a34..1063532 100644 --- a/emulator/opengl/host/libs/renderControl_dec/Android.mk +++ b/emulator/opengl/host/libs/renderControl_dec/Android.mk @@ -4,16 +4,16 @@ LOCAL_PATH := $(call my-dir) ### host library ############################################ $(call emugl-begin-host-static-library,lib_renderControl_dec) $(call emugl-import,libOpenglCodecCommon) -$(call emugl-gen-decoder,$(EMUGL_PATH)/system/renderControl_enc,renderControl) +$(call emugl-gen-decoder,$(LOCAL_PATH),renderControl) # For renderControl_types.h -$(call emugl-export,C_INCLUDES,$(EMUGL_PATH)/system/renderControl_enc) +$(call emugl-export,C_INCLUDES,$(LOCAL_PATH)) $(call emugl-end-module) ### host library, 64-bit #################################### $(call emugl-begin-host-static-library,lib64_renderControl_dec) $(call emugl-import,lib64OpenglCodecCommon) -$(call emugl-gen-decoder,$(EMUGL_PATH)/system/renderControl_enc,renderControl) +$(call emugl-gen-decoder,$(LOCAL_PATH),renderControl) # For renderControl_types.h -$(call emugl-export,C_INCLUDES,$(EMUGL_PATH)/system/renderControl_enc) +$(call emugl-export,C_INCLUDES,$(LOCAL_PATH)) $(call emugl-export,CFLAGS,-m64) $(call emugl-end-module) diff --git a/emulator/opengl/system/renderControl_enc/renderControl.attrib b/emulator/opengl/host/libs/renderControl_dec/renderControl.attrib index 8b9972f..8b9972f 100644 --- a/emulator/opengl/system/renderControl_enc/renderControl.attrib +++ b/emulator/opengl/host/libs/renderControl_dec/renderControl.attrib diff --git a/emulator/opengl/system/renderControl_enc/renderControl.in b/emulator/opengl/host/libs/renderControl_dec/renderControl.in index 8281fd9..8281fd9 100644 --- a/emulator/opengl/system/renderControl_enc/renderControl.in +++ b/emulator/opengl/host/libs/renderControl_dec/renderControl.in diff --git a/emulator/opengl/system/renderControl_enc/renderControl.types b/emulator/opengl/host/libs/renderControl_dec/renderControl.types index a7d96ab..a7d96ab 100644 --- a/emulator/opengl/system/renderControl_enc/renderControl.types +++ b/emulator/opengl/host/libs/renderControl_dec/renderControl.types diff --git a/emulator/opengl/system/renderControl_enc/renderControl_types.h b/emulator/opengl/host/libs/renderControl_dec/renderControl_types.h index da215bb..da215bb 100644 --- a/emulator/opengl/system/renderControl_enc/renderControl_types.h +++ b/emulator/opengl/host/libs/renderControl_dec/renderControl_types.h diff --git a/emulator/opengl/shared/OpenglCodecCommon/Android.mk b/emulator/opengl/shared/OpenglCodecCommon/Android.mk index 7deb058..5deb1f7 100644 --- a/emulator/opengl/shared/OpenglCodecCommon/Android.mk +++ b/emulator/opengl/shared/OpenglCodecCommon/Android.mk @@ -20,18 +20,6 @@ else endif -### CodecCommon guest ############################################## -$(call emugl-begin-static-library,libOpenglCodecCommon) - -LOCAL_SRC_FILES := $(commonSources) - -LOCAL_CFLAGS += -DLOG_TAG=\"eglCodecCommon\" - -$(call emugl-export,SHARED_LIBRARIES,libcutils libutils) -$(call emugl-export,C_INCLUDES,$(LOCAL_PATH)) -$(call emugl-end-module) - - ### OpenglCodecCommon host ############################################## $(call emugl-begin-host-static-library,libOpenglCodecCommon) diff --git a/emulator/opengl/shared/OpenglOsUtils/Android.mk b/emulator/opengl/shared/OpenglOsUtils/Android.mk index 2e5a8a1..8a6c18b 100644 --- a/emulator/opengl/shared/OpenglOsUtils/Android.mk +++ b/emulator/opengl/shared/OpenglOsUtils/Android.mk @@ -6,20 +6,6 @@ # LOCAL_PATH := $(call my-dir) -### Guest library ############################################## -$(call emugl-begin-static-library,libOpenglOsUtils) - - $(call emugl-export,C_INCLUDES,$(LOCAL_PATH)) - $(call emugl-export,LDLIBS,-ldl) - - LOCAL_SRC_FILES := \ - osProcessUnix.cpp \ - osThreadUnix.cpp \ - osDynLibrary.cpp - -$(call emugl-end-module) - - ### Host library ############################################## host_common_SRC_FILES := osDynLibrary.cpp diff --git a/emulator/opengl/system/GLESv1/Android.mk b/emulator/opengl/system/GLESv1/Android.mk deleted file mode 100644 index 97356b7..0000000 --- a/emulator/opengl/system/GLESv1/Android.mk +++ /dev/null @@ -1,12 +0,0 @@ -LOCAL_PATH := $(call my-dir) - -### GLESv1 implementation ########################################### -$(call emugl-begin-shared-library,libGLESv1_CM_emulation) -$(call emugl-import,libOpenglSystemCommon libGLESv1_enc lib_renderControl_enc) - -LOCAL_CFLAGS += -DLOG_TAG=\"GLES_emulation\" -DGL_GLEXT_PROTOTYPES - -LOCAL_SRC_FILES := gl.cpp -LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/egl - -$(call emugl-end-module) diff --git a/emulator/opengl/system/GLESv1/gl.cpp b/emulator/opengl/system/GLESv1/gl.cpp deleted file mode 100644 index 8ecb504..0000000 --- a/emulator/opengl/system/GLESv1/gl.cpp +++ /dev/null @@ -1,146 +0,0 @@ -/* -* Copyright 2011 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "EGLClientIface.h" -#include "HostConnection.h" -#include "GLEncoder.h" -#include "GLES/gl.h" -#include "GLES/glext.h" -#include "ErrorLog.h" -#include "gralloc_cb.h" -#include "ThreadInfo.h" - - -//XXX: fix this macro to get the context from fast tls path -#define GET_CONTEXT GLEncoder * ctx = getEGLThreadInfo()->hostConn->glEncoder(); - -#include "gl_entry.cpp" - -//The functions table -#include "gl_ftable.h" - -static EGLClient_eglInterface * s_egl = NULL; -static EGLClient_glesInterface * s_gl = NULL; - -#define DEFINE_AND_VALIDATE_HOST_CONNECTION(ret) \ - HostConnection *hostCon = HostConnection::get(); \ - if (!hostCon) { \ - ALOGE("egl: Failed to get host connection\n"); \ - return ret; \ - } \ - renderControl_encoder_context_t *rcEnc = hostCon->rcEncoder(); \ - if (!rcEnc) { \ - ALOGE("egl: Failed to get renderControl encoder context\n"); \ - return ret; \ - } - -//GL extensions -void glEGLImageTargetTexture2DOES(void * self, GLenum target, GLeglImageOES image) -{ - DBG("glEGLImageTargetTexture2DOES v1 target=%#x image=%p", target, image); - //TODO: check error - we don't have a way to set gl error - android_native_buffer_t* native_buffer = (android_native_buffer_t*)image; - - if (native_buffer->common.magic != ANDROID_NATIVE_BUFFER_MAGIC) { - return; - } - - if (native_buffer->common.version != sizeof(android_native_buffer_t)) { - return; - } - - GET_CONTEXT; - DEFINE_AND_VALIDATE_HOST_CONNECTION(); - - ctx->override2DTextureTarget(target); - rcEnc->rcBindTexture(rcEnc, - ((cb_handle_t *)(native_buffer->handle))->hostHandle); - ctx->restore2DTextureTarget(); - - return; -} - -void glEGLImageTargetRenderbufferStorageOES(void *self, GLenum target, GLeglImageOES image) -{ - DBG("glEGLImageTargetRenderbufferStorageOES v1 target=%#x image=%p", - target, image); - //TODO: check error - we don't have a way to set gl error - android_native_buffer_t* native_buffer = (android_native_buffer_t*)image; - - if (native_buffer->common.magic != ANDROID_NATIVE_BUFFER_MAGIC) { - return; - } - - if (native_buffer->common.version != sizeof(android_native_buffer_t)) { - return; - } - - DEFINE_AND_VALIDATE_HOST_CONNECTION(); - rcEnc->rcBindRenderbuffer(rcEnc, - ((cb_handle_t *)(native_buffer->handle))->hostHandle); - - return; -} - -void * getProcAddress(const char * procname) -{ - // search in GL function table - for (int i=0; i<gl_num_funcs; i++) { - if (!strcmp(gl_funcs_by_name[i].name, procname)) { - return gl_funcs_by_name[i].proc; - } - } - return NULL; -} - -void finish() -{ - glFinish(); -} - -const GLubyte *my_glGetString (void *self, GLenum name) -{ - if (s_egl) { - return (const GLubyte*)s_egl->getGLString(name); - } - return NULL; -} - -void init() -{ - GET_CONTEXT; - ctx->set_glEGLImageTargetTexture2DOES(glEGLImageTargetTexture2DOES); - ctx->set_glEGLImageTargetRenderbufferStorageOES(glEGLImageTargetRenderbufferStorageOES); - ctx->set_glGetString(my_glGetString); -} - -extern "C" { -EGLClient_glesInterface * init_emul_gles(EGLClient_eglInterface *eglIface) -{ - s_egl = eglIface; - - if (!s_gl) { - s_gl = new EGLClient_glesInterface(); - s_gl->getProcAddress = getProcAddress; - s_gl->finish = finish; - s_gl->init = init; - } - - return s_gl; -} -} //extern - - diff --git a/emulator/opengl/system/GLESv1_enc/Android.mk b/emulator/opengl/system/GLESv1_enc/Android.mk deleted file mode 100644 index 25c8c49..0000000 --- a/emulator/opengl/system/GLESv1_enc/Android.mk +++ /dev/null @@ -1,18 +0,0 @@ -LOCAL_PATH := $(call my-dir) - -### GLESv1_enc Encoder ########################################### -$(call emugl-begin-shared-library,libGLESv1_enc) - -LOCAL_CFLAGS += -DLOG_TAG=\"emuglGLESv1_enc\" - -LOCAL_SRC_FILES := \ - GLEncoder.cpp \ - GLEncoderUtils.cpp - -$(call emugl-gen-encoder,$(LOCAL_PATH),gl) - -$(call emugl-import,libOpenglCodecCommon) -$(call emugl-export,C_INCLUDES,$(LOCAL_PATH)) -$(call emugl-export,C_INCLUDES,$(intermediates)) - -$(call emugl-end-module) diff --git a/emulator/opengl/system/GLESv1_enc/GLEncoder.cpp b/emulator/opengl/system/GLESv1_enc/GLEncoder.cpp deleted file mode 100644 index 4414f24..0000000 --- a/emulator/opengl/system/GLESv1_enc/GLEncoder.cpp +++ /dev/null @@ -1,989 +0,0 @@ -/* -* Copyright (C) 2011 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -#include "GLEncoder.h" -#include "glUtils.h" -#include "FixedBuffer.h" -#include <cutils/log.h> -#include <assert.h> - -#ifndef MIN -#define MIN(a, b) ((a) < (b) ? (a) : (b)) -#endif - -static GLubyte *gVendorString= (GLubyte *) "Android"; -static GLubyte *gRendererString= (GLubyte *) "Android HW-GLES 1.0"; -static GLubyte *gVersionString= (GLubyte *) "OpenGL ES-CM 1.0"; -static GLubyte *gExtensionsString= (GLubyte *) ""; // no extensions at this point; - -#define SET_ERROR_IF(condition,err) if((condition)) { \ - ALOGE("%s:%s:%d GL error 0x%x\n", __FILE__, __FUNCTION__, __LINE__, err); \ - ctx->setError(err); \ - return; \ - } - - -#define RET_AND_SET_ERROR_IF(condition,err,ret) if((condition)) { \ - ALOGE("%s:%s:%d GL error 0x%x\n", __FILE__, __FUNCTION__, __LINE__, err); \ - ctx->setError(err); \ - return ret; \ - } - -GLenum GLEncoder::s_glGetError(void * self) -{ - GLEncoder *ctx = (GLEncoder *)self; - GLenum err = ctx->getError(); - if(err != GL_NO_ERROR) { - ctx->setError(GL_NO_ERROR); - return err; - } - - return ctx->m_glGetError_enc(self); - -} - -GLint * GLEncoder::getCompressedTextureFormats() -{ - if (m_compressedTextureFormats == NULL) { - this->glGetIntegerv(this, GL_NUM_COMPRESSED_TEXTURE_FORMATS, - &m_num_compressedTextureFormats); - if (m_num_compressedTextureFormats > 0) { - // get number of texture formats; - m_compressedTextureFormats = new GLint[m_num_compressedTextureFormats]; - this->glGetCompressedTextureFormats(this, m_num_compressedTextureFormats, m_compressedTextureFormats); - } - } - return m_compressedTextureFormats; -} - -void GLEncoder::s_glGetIntegerv(void *self, GLenum param, GLint *ptr) -{ - GLEncoder *ctx = (GLEncoder *)self; - assert(ctx->m_state != NULL); - GLClientState* state = ctx->m_state; - - switch (param) { - case GL_COMPRESSED_TEXTURE_FORMATS: { - GLint * compressedTextureFormats = ctx->getCompressedTextureFormats(); - if (ctx->m_num_compressedTextureFormats > 0 && - compressedTextureFormats != NULL) { - memcpy(ptr, compressedTextureFormats, - ctx->m_num_compressedTextureFormats * sizeof(GLint)); - } - break; - } - - case GL_MAX_TEXTURE_UNITS: - ctx->m_glGetIntegerv_enc(self, param, ptr); - *ptr = MIN(*ptr, GLClientState::MAX_TEXTURE_UNITS); - break; - - case GL_TEXTURE_BINDING_2D: - *ptr = state->getBoundTexture(GL_TEXTURE_2D); - break; - - case GL_TEXTURE_BINDING_EXTERNAL_OES: - *ptr = state->getBoundTexture(GL_TEXTURE_EXTERNAL_OES); - break; - - default: - if (!state->getClientStateParameter<GLint>(param,ptr)) { - ctx->m_glGetIntegerv_enc(self, param, ptr); - } - break; - } -} - -void GLEncoder::s_glGetFloatv(void *self, GLenum param, GLfloat *ptr) -{ - GLEncoder *ctx = (GLEncoder *)self; - assert(ctx->m_state != NULL); - GLClientState* state = ctx->m_state; - - switch (param) { - case GL_COMPRESSED_TEXTURE_FORMATS: { - GLint * compressedTextureFormats = ctx->getCompressedTextureFormats(); - if (ctx->m_num_compressedTextureFormats > 0 && - compressedTextureFormats != NULL) { - for (int i = 0; i < ctx->m_num_compressedTextureFormats; i++) { - ptr[i] = (GLfloat) compressedTextureFormats[i]; - } - } - break; - } - - case GL_MAX_TEXTURE_UNITS: - ctx->m_glGetFloatv_enc(self, param, ptr); - *ptr = MIN(*ptr, (GLfloat)GLClientState::MAX_TEXTURE_UNITS); - break; - - case GL_TEXTURE_BINDING_2D: - *ptr = (GLfloat)state->getBoundTexture(GL_TEXTURE_2D); - break; - - case GL_TEXTURE_BINDING_EXTERNAL_OES: - *ptr = (GLfloat)state->getBoundTexture(GL_TEXTURE_EXTERNAL_OES); - break; - - default: - if (!state->getClientStateParameter<GLfloat>(param,ptr)) { - ctx->m_glGetFloatv_enc(self, param, ptr); - } - break; - } -} - -void GLEncoder::s_glGetFixedv(void *self, GLenum param, GLfixed *ptr) -{ - GLEncoder *ctx = (GLEncoder *)self; - assert(ctx->m_state != NULL); - GLClientState* state = ctx->m_state; - - switch (param) { - case GL_COMPRESSED_TEXTURE_FORMATS: { - GLint * compressedTextureFormats = ctx->getCompressedTextureFormats(); - if (ctx->m_num_compressedTextureFormats > 0 && - compressedTextureFormats != NULL) { - for (int i = 0; i < ctx->m_num_compressedTextureFormats; i++) { - ptr[i] = compressedTextureFormats[i] << 16; - } - } - break; - } - - case GL_MAX_TEXTURE_UNITS: - ctx->m_glGetFixedv_enc(self, param, ptr); - *ptr = MIN(*ptr, GLClientState::MAX_TEXTURE_UNITS << 16); - break; - - case GL_TEXTURE_BINDING_2D: - *ptr = state->getBoundTexture(GL_TEXTURE_2D) << 16; - break; - - case GL_TEXTURE_BINDING_EXTERNAL_OES: - *ptr = state->getBoundTexture(GL_TEXTURE_EXTERNAL_OES) << 16; - break; - - default: - if (!state->getClientStateParameter<GLfixed>(param,ptr)) { - ctx->m_glGetFixedv_enc(self, param, ptr); - } - break; - } -} - -void GLEncoder::s_glGetBooleanv(void *self, GLenum param, GLboolean *ptr) -{ - GLEncoder *ctx = (GLEncoder *)self; - assert(ctx->m_state != NULL); - GLClientState* state = ctx->m_state; - - switch (param) { - case GL_COMPRESSED_TEXTURE_FORMATS: { - GLint* compressedTextureFormats = ctx->getCompressedTextureFormats(); - if (ctx->m_num_compressedTextureFormats > 0 && - compressedTextureFormats != NULL) { - for (int i = 0; i < ctx->m_num_compressedTextureFormats; i++) { - ptr[i] = compressedTextureFormats[i] != 0 ? GL_TRUE : GL_FALSE; - } - } - break; - } - - case GL_TEXTURE_BINDING_2D: - *ptr = state->getBoundTexture(GL_TEXTURE_2D) != 0 ? GL_TRUE : GL_FALSE; - break; - - case GL_TEXTURE_BINDING_EXTERNAL_OES: - *ptr = state->getBoundTexture(GL_TEXTURE_EXTERNAL_OES) != 0 - ? GL_TRUE : GL_FALSE; - break; - - default: - if (!state->getClientStateParameter<GLboolean>(param,ptr)) { - ctx->m_glGetBooleanv_enc(self, param, ptr); - } - break; - } -} - -void GLEncoder::s_glGetPointerv(void * self, GLenum param, GLvoid **params) -{ - GLEncoder * ctx = (GLEncoder *) self; - assert(ctx->m_state != NULL); - ctx->m_state->getClientStatePointer(param,params); -} - -void GLEncoder::s_glFlush(void *self) -{ - GLEncoder *ctx = (GLEncoder *)self; - ctx->m_glFlush_enc(self); - ctx->m_stream->flush(); -} - -const GLubyte *GLEncoder::s_glGetString(void *self, GLenum name) -{ - GLubyte *retval = (GLubyte *) ""; - switch(name) { - case GL_VENDOR: - retval = gVendorString; - break; - case GL_RENDERER: - retval = gRendererString; - break; - case GL_VERSION: - retval = gVersionString; - break; - case GL_EXTENSIONS: - retval = gExtensionsString; - break; - } - return retval; -} - -void GLEncoder::s_glPixelStorei(void *self, GLenum param, GLint value) -{ - GLEncoder *ctx = (GLEncoder *)self; - ctx->m_glPixelStorei_enc(ctx, param, value); - ALOG_ASSERT(ctx->m_state, "GLEncoder::s_glPixelStorei"); - ctx->m_state->setPixelStore(param, value); -} - -void GLEncoder::s_glVertexPointer(void *self, int size, GLenum type, GLsizei stride, const void *data) -{ - GLEncoder *ctx = (GLEncoder *)self; - assert(ctx->m_state != NULL); - ctx->m_state->setState(GLClientState::VERTEX_LOCATION, size, type, false, stride, data); -} - -void GLEncoder::s_glNormalPointer(void *self, GLenum type, GLsizei stride, const void *data) -{ - GLEncoder *ctx = (GLEncoder *)self; - assert(ctx->m_state != NULL); - ctx->m_state->setState(GLClientState::NORMAL_LOCATION, 3, type, false, stride, data); -} - -void GLEncoder::s_glColorPointer(void *self, int size, GLenum type, GLsizei stride, const void *data) -{ - GLEncoder *ctx = (GLEncoder *)self; - assert(ctx->m_state != NULL); - ctx->m_state->setState(GLClientState::COLOR_LOCATION, size, type, false, stride, data); -} - -void GLEncoder::s_glPointsizePointer(void *self, GLenum type, GLsizei stride, const void *data) -{ - GLEncoder *ctx = (GLEncoder *)self; - assert(ctx->m_state != NULL); - ctx->m_state->setState(GLClientState::POINTSIZE_LOCATION, 1, type, false, stride, data); -} - -void GLEncoder::s_glClientActiveTexture(void *self, GLenum texture) -{ - GLEncoder *ctx = (GLEncoder *)self; - assert(ctx->m_state != NULL); - ctx->m_state->setActiveTexture(texture - GL_TEXTURE0); -} - -void GLEncoder::s_glTexcoordPointer(void *self, int size, GLenum type, GLsizei stride, const void *data) -{ - GLEncoder *ctx = (GLEncoder *)self; - assert(ctx->m_state != NULL); - int loc = ctx->m_state->getLocation(GL_TEXTURE_COORD_ARRAY); - ctx->m_state->setState(loc, size, type, false, stride, data); -} - -void GLEncoder::s_glMatrixIndexPointerOES(void *self, int size, GLenum type, GLsizei stride, const void * data) -{ - GLEncoder *ctx = (GLEncoder *)self; - assert(ctx->m_state != NULL); - int loc = ctx->m_state->getLocation(GL_MATRIX_INDEX_ARRAY_OES); - ctx->m_state->setState(loc, size, type, false, stride, data); -} - -void GLEncoder::s_glWeightPointerOES(void * self, int size, GLenum type, GLsizei stride, const void * data) -{ - GLEncoder *ctx = (GLEncoder *)self; - assert(ctx->m_state != NULL); - int loc = ctx->m_state->getLocation(GL_WEIGHT_ARRAY_OES); - ctx->m_state->setState(loc, size, type, false, stride, data); -} - -void GLEncoder::s_glEnableClientState(void *self, GLenum state) -{ - GLEncoder *ctx = (GLEncoder *) self; - assert(ctx->m_state != NULL); - int loc = ctx->m_state->getLocation(state); - ctx->m_state->enable(loc, 1); -} - -void GLEncoder::s_glDisableClientState(void *self, GLenum state) -{ - GLEncoder *ctx = (GLEncoder *) self; - assert(ctx->m_state != NULL); - int loc = ctx->m_state->getLocation(state); - ctx->m_state->enable(loc, 0); -} - -GLboolean GLEncoder::s_glIsEnabled(void *self, GLenum cap) -{ - GLEncoder *ctx = (GLEncoder *) self; - assert(ctx->m_state != NULL); - int loc = ctx->m_state->getLocation(cap); - const GLClientState::VertexAttribState *state = ctx->m_state->getState(loc); - - if (state!=NULL) - return state->enabled; - - return ctx->m_glIsEnabled_enc(self,cap); -} - -void GLEncoder::s_glBindBuffer(void *self, GLenum target, GLuint id) -{ - GLEncoder *ctx = (GLEncoder *) self; - assert(ctx->m_state != NULL); - ctx->m_state->bindBuffer(target, id); - // TODO set error state if needed; - ctx->m_glBindBuffer_enc(self, target, id); -} - -void GLEncoder::s_glBufferData(void * self, GLenum target, GLsizeiptr size, const GLvoid * data, GLenum usage) -{ - GLEncoder *ctx = (GLEncoder *) self; - GLuint bufferId = ctx->m_state->getBuffer(target); - SET_ERROR_IF(bufferId==0, GL_INVALID_OPERATION); - SET_ERROR_IF(size<0, GL_INVALID_VALUE); - - ctx->m_shared->updateBufferData(bufferId, size, (void*)data); - ctx->m_glBufferData_enc(self, target, size, data, usage); -} - -void GLEncoder::s_glBufferSubData(void * self, GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid * data) -{ - GLEncoder *ctx = (GLEncoder *) self; - GLuint bufferId = ctx->m_state->getBuffer(target); - SET_ERROR_IF(bufferId==0, GL_INVALID_OPERATION); - - GLenum res = ctx->m_shared->subUpdateBufferData(bufferId, offset, size, (void*)data); - SET_ERROR_IF(res, res); - - ctx->m_glBufferSubData_enc(self, target, offset, size, data); -} - -void GLEncoder::s_glDeleteBuffers(void * self, GLsizei n, const GLuint * buffers) -{ - GLEncoder *ctx = (GLEncoder *) self; - SET_ERROR_IF(n<0, GL_INVALID_VALUE); - for (int i=0; i<n; i++) { - ctx->m_shared->deleteBufferData(buffers[i]); - ctx->m_glDeleteBuffers_enc(self,1,&buffers[i]); - } -} - -void GLEncoder::sendVertexData(unsigned int first, unsigned int count) -{ - assert(m_state != NULL); - for (int i = 0; i < GLClientState::LAST_LOCATION; i++) { - bool enableDirty; - const GLClientState::VertexAttribState *state = m_state->getStateAndEnableDirty(i, &enableDirty); - - // do not process if state not valid - if (!state) continue; - - // do not send disable state if state was already disabled - if (!enableDirty && !state->enabled) continue; - - if ( i >= GLClientState::TEXCOORD0_LOCATION && - i <= GLClientState::TEXCOORD7_LOCATION ) { - m_glClientActiveTexture_enc(this, GL_TEXTURE0 + i - GLClientState::TEXCOORD0_LOCATION); - } - - if (state->enabled) { - - if (enableDirty) - m_glEnableClientState_enc(this, state->glConst); - - unsigned int datalen = state->elementSize * count; - int stride = state->stride; - if (stride == 0) stride = state->elementSize; - int firstIndex = stride * first; - - if (state->bufferObject == 0) { - - switch(i) { - case GLClientState::VERTEX_LOCATION: - this->glVertexPointerData(this, state->size, state->type, state->stride, - (unsigned char *)state->data + firstIndex, datalen); - break; - case GLClientState::NORMAL_LOCATION: - this->glNormalPointerData(this, state->type, state->stride, - (unsigned char *)state->data + firstIndex, datalen); - break; - case GLClientState::COLOR_LOCATION: - this->glColorPointerData(this, state->size, state->type, state->stride, - (unsigned char *)state->data + firstIndex, datalen); - break; - case GLClientState::TEXCOORD0_LOCATION: - case GLClientState::TEXCOORD1_LOCATION: - case GLClientState::TEXCOORD2_LOCATION: - case GLClientState::TEXCOORD3_LOCATION: - case GLClientState::TEXCOORD4_LOCATION: - case GLClientState::TEXCOORD5_LOCATION: - case GLClientState::TEXCOORD6_LOCATION: - case GLClientState::TEXCOORD7_LOCATION: - this->glTexCoordPointerData(this, i - GLClientState::TEXCOORD0_LOCATION, state->size, state->type, state->stride, - (unsigned char *)state->data + firstIndex, datalen); - break; - case GLClientState::POINTSIZE_LOCATION: - this->glPointSizePointerData(this, state->type, state->stride, - (unsigned char *) state->data + firstIndex, datalen); - break; - case GLClientState::WEIGHT_LOCATION: - this->glWeightPointerData(this, state->size, state->type, state->stride, - (unsigned char * ) state->data + firstIndex, datalen); - break; - case GLClientState::MATRIXINDEX_LOCATION: - this->glMatrixIndexPointerData(this, state->size, state->type, state->stride, - (unsigned char *)state->data + firstIndex, datalen); - break; - } - } else { - this->m_glBindBuffer_enc(this, GL_ARRAY_BUFFER, state->bufferObject); - - switch(i) { - case GLClientState::VERTEX_LOCATION: - this->glVertexPointerOffset(this, state->size, state->type, state->stride, - (GLuint)state->data + firstIndex); - break; - case GLClientState::NORMAL_LOCATION: - this->glNormalPointerOffset(this, state->type, state->stride, - (GLuint) state->data + firstIndex); - break; - case GLClientState::POINTSIZE_LOCATION: - this->glPointSizePointerOffset(this, state->type, state->stride, - (GLuint) state->data + firstIndex); - break; - case GLClientState::COLOR_LOCATION: - this->glColorPointerOffset(this, state->size, state->type, state->stride, - (GLuint) state->data + firstIndex); - break; - case GLClientState::TEXCOORD0_LOCATION: - case GLClientState::TEXCOORD1_LOCATION: - case GLClientState::TEXCOORD2_LOCATION: - case GLClientState::TEXCOORD3_LOCATION: - case GLClientState::TEXCOORD4_LOCATION: - case GLClientState::TEXCOORD5_LOCATION: - case GLClientState::TEXCOORD6_LOCATION: - case GLClientState::TEXCOORD7_LOCATION: - this->glTexCoordPointerOffset(this, state->size, state->type, state->stride, - (GLuint) state->data + firstIndex); - break; - case GLClientState::WEIGHT_LOCATION: - this->glWeightPointerOffset(this,state->size,state->type,state->stride, - (GLuint)state->data+firstIndex); - break; - case GLClientState::MATRIXINDEX_LOCATION: - this->glMatrixIndexPointerOffset(this,state->size,state->type,state->stride, - (GLuint)state->data+firstIndex); - break; - } - this->m_glBindBuffer_enc(this, GL_ARRAY_BUFFER, m_state->currentArrayVbo()); - } - } else { - this->m_glDisableClientState_enc(this, state->glConst); - } - } -} - -void GLEncoder::s_glDrawArrays(void *self, GLenum mode, GLint first, GLsizei count) -{ - GLEncoder *ctx = (GLEncoder *)self; - - ctx->sendVertexData(first, count); - ctx->m_glDrawArrays_enc(ctx, mode, /*first*/ 0, count); -} - -void GLEncoder::s_glDrawElements(void *self, GLenum mode, GLsizei count, GLenum type, const void *indices) -{ - - GLEncoder *ctx = (GLEncoder *)self; - assert(ctx->m_state != NULL); - SET_ERROR_IF(count<0, GL_INVALID_VALUE); - - bool has_immediate_arrays = false; - bool has_indirect_arrays = false; - - for (int i = 0; i < GLClientState::LAST_LOCATION; i++) { - const GLClientState::VertexAttribState *state = ctx->m_state->getState(i); - if (state->enabled) { - if (state->bufferObject != 0) { - has_indirect_arrays = true; - } else { - has_immediate_arrays = true; - } - } - } - - if (!has_immediate_arrays && !has_indirect_arrays) { - ALOGE("glDrawElements: no data bound to the command - ignoring\n"); - return; - } - - bool adjustIndices = true; - if (ctx->m_state->currentIndexVbo() != 0) { - if (!has_immediate_arrays) { - ctx->sendVertexData(0, count); - ctx->m_glBindBuffer_enc(self, GL_ELEMENT_ARRAY_BUFFER, ctx->m_state->currentIndexVbo()); - ctx->glDrawElementsOffset(ctx, mode, count, type, (GLuint)indices); - adjustIndices = false; - } else { - BufferData * buf = ctx->m_shared->getBufferData(ctx->m_state->currentIndexVbo()); - ctx->m_glBindBuffer_enc(self, GL_ELEMENT_ARRAY_BUFFER, 0); - indices = (void*)((GLintptr)buf->m_fixedBuffer.ptr() + (GLintptr)indices); - } - } - if (adjustIndices) { - void *adjustedIndices = (void*)indices; - int minIndex = 0, maxIndex = 0; - - switch(type) { - case GL_BYTE: - case GL_UNSIGNED_BYTE: - GLUtils::minmax<unsigned char>((unsigned char *)indices, count, &minIndex, &maxIndex); - if (minIndex != 0) { - adjustedIndices = ctx->m_fixedBuffer.alloc(glSizeof(type) * count); - GLUtils::shiftIndices<unsigned char>((unsigned char *)indices, - (unsigned char *)adjustedIndices, - count, -minIndex); - } - break; - case GL_SHORT: - case GL_UNSIGNED_SHORT: - GLUtils::minmax<unsigned short>((unsigned short *)indices, count, &minIndex, &maxIndex); - if (minIndex != 0) { - adjustedIndices = ctx->m_fixedBuffer.alloc(glSizeof(type) * count); - GLUtils::shiftIndices<unsigned short>((unsigned short *)indices, - (unsigned short *)adjustedIndices, - count, -minIndex); - } - break; - default: - ALOGE("unsupported index buffer type %d\n", type); - } - if (has_indirect_arrays || 1) { - ctx->sendVertexData(minIndex, maxIndex - minIndex + 1); - ctx->glDrawElementsData(ctx, mode, count, type, adjustedIndices, - count * glSizeof(type)); - // XXX - OPTIMIZATION (see the other else branch) should be implemented - if(!has_indirect_arrays) { - //ALOGD("unoptimized drawelements !!!\n"); - } - } else { - // we are all direct arrays and immidate mode index array - - // rebuild the arrays and the index array; - ALOGE("glDrawElements: direct index & direct buffer data - will be implemented in later versions;\n"); - } - } -} - -void GLEncoder::s_glActiveTexture(void* self, GLenum texture) -{ - GLEncoder* ctx = (GLEncoder*)self; - GLClientState* state = ctx->m_state; - GLenum err; - - if ((err = state->setActiveTextureUnit(texture)) != GL_NO_ERROR) { - ALOGE("%s:%s:%d GL error %#x\n", __FILE__, __FUNCTION__, __LINE__, err); - ctx->setError(err); - return; - } - - ctx->m_glActiveTexture_enc(ctx, texture); -} - -void GLEncoder::s_glBindTexture(void* self, GLenum target, GLuint texture) -{ - GLEncoder* ctx = (GLEncoder*)self; - GLClientState* state = ctx->m_state; - GLenum err; - - GLboolean firstUse; - if ((err = state->bindTexture(target, texture, &firstUse)) != GL_NO_ERROR) { - ALOGE("%s:%s:%d GL error %#x\n", __FILE__, __FUNCTION__, __LINE__, err); - ctx->setError(err); - return; - } - - if (target != GL_TEXTURE_2D && target != GL_TEXTURE_EXTERNAL_OES) { - ctx->m_glBindTexture_enc(ctx, target, texture); - return; - } - - GLenum priorityTarget = state->getPriorityEnabledTarget(GL_TEXTURE_2D); - - if (target == GL_TEXTURE_EXTERNAL_OES && firstUse) { - // set TEXTURE_EXTERNAL_OES default states which differ from TEXTURE_2D - ctx->m_glBindTexture_enc(ctx, GL_TEXTURE_2D, texture); - ctx->m_glTexParameteri_enc(ctx, GL_TEXTURE_2D, - GL_TEXTURE_MIN_FILTER, GL_LINEAR); - ctx->m_glTexParameteri_enc(ctx, GL_TEXTURE_2D, - GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - ctx->m_glTexParameteri_enc(ctx, GL_TEXTURE_2D, - GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - - if (target != priorityTarget) { - ctx->m_glBindTexture_enc(ctx, GL_TEXTURE_2D, - state->getBoundTexture(GL_TEXTURE_2D)); - } - } - - if (target == priorityTarget) { - ctx->m_glBindTexture_enc(ctx, GL_TEXTURE_2D, texture); - } -} - -void GLEncoder::s_glDeleteTextures(void* self, GLsizei n, const GLuint* textures) -{ - GLEncoder* ctx = (GLEncoder*)self; - GLClientState* state = ctx->m_state; - - state->deleteTextures(n, textures); - ctx->m_glDeleteTextures_enc(ctx, n, textures); -} - -void GLEncoder::s_glDisable(void* self, GLenum cap) -{ - GLEncoder* ctx = (GLEncoder*)self; - GLClientState* state = ctx->m_state; - - if (cap == GL_TEXTURE_2D || cap == GL_TEXTURE_EXTERNAL_OES) { - GLenum prevTarget = state->getPriorityEnabledTarget(GL_INVALID_ENUM); - state->disableTextureTarget(cap); - GLenum currTarget = state->getPriorityEnabledTarget(GL_INVALID_ENUM); - - if (prevTarget != currTarget) { - if (currTarget == GL_INVALID_ENUM) { - ctx->m_glDisable_enc(ctx, GL_TEXTURE_2D); - currTarget = GL_TEXTURE_2D; - } - // maintain the invariant that when TEXTURE_EXTERNAL_OES is - // disabled, the TEXTURE_2D binding is active, even if - // TEXTURE_2D is also disabled. - ctx->m_glBindTexture_enc(ctx, GL_TEXTURE_2D, - state->getBoundTexture(currTarget)); - } - - } else { - ctx->m_glDisable_enc(ctx, cap); - } -} - -void GLEncoder::s_glEnable(void* self, GLenum cap) -{ - GLEncoder* ctx = (GLEncoder*)self; - GLClientState* state = ctx->m_state; - - if (cap == GL_TEXTURE_2D || cap == GL_TEXTURE_EXTERNAL_OES) { - GLenum prevTarget = state->getPriorityEnabledTarget(GL_INVALID_ENUM); - state->enableTextureTarget(cap); - GLenum currTarget = state->getPriorityEnabledTarget(GL_INVALID_ENUM); - - if (prevTarget != currTarget) { - if (prevTarget == GL_INVALID_ENUM) { - ctx->m_glEnable_enc(ctx, GL_TEXTURE_2D); - } - if (currTarget == GL_TEXTURE_EXTERNAL_OES) { - ctx->m_glBindTexture_enc(ctx, GL_TEXTURE_2D, - state->getBoundTexture(currTarget)); - } - } - - } else { - ctx->m_glEnable_enc(ctx, cap); - } -} - -void GLEncoder::s_glGetTexParameterfv(void* self, - GLenum target, GLenum pname, GLfloat* params) -{ - GLEncoder* ctx = (GLEncoder*)self; - const GLClientState* state = ctx->m_state; - - if (target == GL_TEXTURE_2D || target == GL_TEXTURE_EXTERNAL_OES) { - ctx->override2DTextureTarget(target); - ctx->m_glGetTexParameterfv_enc(ctx, GL_TEXTURE_2D, pname, params); - ctx->restore2DTextureTarget(); - } else { - ctx->m_glGetTexParameterfv_enc(ctx, target, pname, params); - } -} - -void GLEncoder::s_glGetTexParameteriv(void* self, - GLenum target, GLenum pname, GLint* params) -{ - GLEncoder* ctx = (GLEncoder*)self; - const GLClientState* state = ctx->m_state; - - switch (pname) { - case GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES: - *params = 1; - break; - - default: - if (target == GL_TEXTURE_2D || target == GL_TEXTURE_EXTERNAL_OES) { - ctx->override2DTextureTarget(target); - ctx->m_glGetTexParameteriv_enc(ctx, GL_TEXTURE_2D, pname, params); - ctx->restore2DTextureTarget(); - } else { - ctx->m_glGetTexParameteriv_enc(ctx, target, pname, params); - } - break; - } -} - -void GLEncoder::s_glGetTexParameterxv(void* self, - GLenum target, GLenum pname, GLfixed* params) -{ - GLEncoder* ctx = (GLEncoder*)self; - const GLClientState* state = ctx->m_state; - - if (target == GL_TEXTURE_2D || target == GL_TEXTURE_EXTERNAL_OES) { - ctx->override2DTextureTarget(target); - ctx->m_glGetTexParameterxv_enc(ctx, GL_TEXTURE_2D, pname, params); - ctx->restore2DTextureTarget(); - } else { - ctx->m_glGetTexParameterxv_enc(ctx, target, pname, params); - } -} - -static bool isValidTextureExternalParam(GLenum pname, GLenum param) -{ - switch (pname) { - case GL_TEXTURE_MIN_FILTER: - case GL_TEXTURE_MAG_FILTER: - return param == GL_NEAREST || param == GL_LINEAR; - - case GL_TEXTURE_WRAP_S: - case GL_TEXTURE_WRAP_T: - return param == GL_CLAMP_TO_EDGE; - - case GL_GENERATE_MIPMAP: - return param == GL_FALSE; - - default: - return true; - } -} - -void GLEncoder::s_glTexParameterf(void* self, - GLenum target, GLenum pname, GLfloat param) -{ - GLEncoder* ctx = (GLEncoder*)self; - const GLClientState* state = ctx->m_state; - - SET_ERROR_IF((target == GL_TEXTURE_EXTERNAL_OES && - !isValidTextureExternalParam(pname, (GLenum)param)), - GL_INVALID_ENUM); - - if (target == GL_TEXTURE_2D || target == GL_TEXTURE_EXTERNAL_OES) { - ctx->override2DTextureTarget(target); - ctx->m_glTexParameterf_enc(ctx, GL_TEXTURE_2D, pname, param); - ctx->restore2DTextureTarget(); - } else { - ctx->m_glTexParameterf_enc(ctx, target, pname, param); - } -} - -void GLEncoder::s_glTexParameterfv(void* self, - GLenum target, GLenum pname, const GLfloat* params) -{ - GLEncoder* ctx = (GLEncoder*)self; - const GLClientState* state = ctx->m_state; - - SET_ERROR_IF((target == GL_TEXTURE_EXTERNAL_OES && - !isValidTextureExternalParam(pname, (GLenum)params[0])), - GL_INVALID_ENUM); - - if (target == GL_TEXTURE_2D || target == GL_TEXTURE_EXTERNAL_OES) { - ctx->override2DTextureTarget(target); - ctx->m_glTexParameterfv_enc(ctx, GL_TEXTURE_2D, pname, params); - ctx->restore2DTextureTarget(); - } else { - ctx->m_glTexParameterfv_enc(ctx, target, pname, params); - } -} - -void GLEncoder::s_glTexParameteri(void* self, - GLenum target, GLenum pname, GLint param) -{ - GLEncoder* ctx = (GLEncoder*)self; - const GLClientState* state = ctx->m_state; - - SET_ERROR_IF((target == GL_TEXTURE_EXTERNAL_OES && - !isValidTextureExternalParam(pname, (GLenum)param)), - GL_INVALID_ENUM); - - if (target == GL_TEXTURE_2D || target == GL_TEXTURE_EXTERNAL_OES) { - ctx->override2DTextureTarget(target); - ctx->m_glTexParameteri_enc(ctx, GL_TEXTURE_2D, pname, param); - ctx->restore2DTextureTarget(); - } else { - ctx->m_glTexParameteri_enc(ctx, target, pname, param); - } -} - -void GLEncoder::s_glTexParameterx(void* self, - GLenum target, GLenum pname, GLfixed param) -{ - GLEncoder* ctx = (GLEncoder*)self; - const GLClientState* state = ctx->m_state; - - SET_ERROR_IF((target == GL_TEXTURE_EXTERNAL_OES && - !isValidTextureExternalParam(pname, (GLenum)param)), - GL_INVALID_ENUM); - - if (target == GL_TEXTURE_2D || target == GL_TEXTURE_EXTERNAL_OES) { - ctx->override2DTextureTarget(target); - ctx->m_glTexParameterx_enc(ctx, GL_TEXTURE_2D, pname, param); - ctx->restore2DTextureTarget(); - } else { - ctx->m_glTexParameterx_enc(ctx, target, pname, param); - } -} - -void GLEncoder::s_glTexParameteriv(void* self, - GLenum target, GLenum pname, const GLint* params) -{ - GLEncoder* ctx = (GLEncoder*)self; - const GLClientState* state = ctx->m_state; - - SET_ERROR_IF((target == GL_TEXTURE_EXTERNAL_OES && - !isValidTextureExternalParam(pname, (GLenum)params[0])), - GL_INVALID_ENUM); - - if (target == GL_TEXTURE_2D || target == GL_TEXTURE_EXTERNAL_OES) { - ctx->override2DTextureTarget(target); - ctx->m_glTexParameteriv_enc(ctx, GL_TEXTURE_2D, pname, params); - ctx->restore2DTextureTarget(); - } else { - ctx->m_glTexParameteriv_enc(ctx, target, pname, params); - } -} - -void GLEncoder::s_glTexParameterxv(void* self, - GLenum target, GLenum pname, const GLfixed* params) -{ - GLEncoder* ctx = (GLEncoder*)self; - const GLClientState* state = ctx->m_state; - - SET_ERROR_IF((target == GL_TEXTURE_EXTERNAL_OES && - !isValidTextureExternalParam(pname, (GLenum)params[0])), - GL_INVALID_ENUM); - - if (target == GL_TEXTURE_2D || target == GL_TEXTURE_EXTERNAL_OES) { - ctx->override2DTextureTarget(target); - ctx->m_glTexParameterxv_enc(ctx, GL_TEXTURE_2D, pname, params); - ctx->restore2DTextureTarget(); - } else { - ctx->m_glTexParameterxv_enc(ctx, target, pname, params); - } -} - -void GLEncoder::override2DTextureTarget(GLenum target) -{ - if ((target == GL_TEXTURE_2D || target == GL_TEXTURE_EXTERNAL_OES) && - target != m_state->getPriorityEnabledTarget(GL_TEXTURE_2D)) { - m_glBindTexture_enc(this, GL_TEXTURE_2D, - m_state->getBoundTexture(target)); - } -} - -void GLEncoder::restore2DTextureTarget() -{ - GLenum priorityTarget = m_state->getPriorityEnabledTarget(GL_TEXTURE_2D); - m_glBindTexture_enc(this, GL_TEXTURE_2D, - m_state->getBoundTexture(priorityTarget)); -} - -GLEncoder::GLEncoder(IOStream *stream) : gl_encoder_context_t(stream) -{ - m_initialized = false; - m_state = NULL; - m_error = GL_NO_ERROR; - m_num_compressedTextureFormats = 0; - m_compressedTextureFormats = NULL; - // overrides; - m_glFlush_enc = set_glFlush(s_glFlush); - m_glPixelStorei_enc = set_glPixelStorei(s_glPixelStorei); - m_glVertexPointer_enc = set_glVertexPointer(s_glVertexPointer); - m_glNormalPointer_enc = set_glNormalPointer(s_glNormalPointer); - m_glColorPointer_enc = set_glColorPointer(s_glColorPointer); - m_glPointSizePointerOES_enc = set_glPointSizePointerOES(s_glPointsizePointer); - m_glClientActiveTexture_enc = set_glClientActiveTexture(s_glClientActiveTexture); - m_glTexCoordPointer_enc = set_glTexCoordPointer(s_glTexcoordPointer); - m_glMatrixIndexPointerOES_enc = set_glMatrixIndexPointerOES(s_glMatrixIndexPointerOES); - m_glWeightPointerOES_enc = set_glWeightPointerOES(s_glWeightPointerOES); - - m_glGetIntegerv_enc = set_glGetIntegerv(s_glGetIntegerv); - m_glGetFloatv_enc = set_glGetFloatv(s_glGetFloatv); - m_glGetBooleanv_enc = set_glGetBooleanv(s_glGetBooleanv); - m_glGetFixedv_enc = set_glGetFixedv(s_glGetFixedv); - m_glGetPointerv_enc = set_glGetPointerv(s_glGetPointerv); - - m_glBindBuffer_enc = set_glBindBuffer(s_glBindBuffer); - m_glBufferData_enc = set_glBufferData(s_glBufferData); - m_glBufferSubData_enc = set_glBufferSubData(s_glBufferSubData); - m_glDeleteBuffers_enc = set_glDeleteBuffers(s_glDeleteBuffers); - - m_glEnableClientState_enc = set_glEnableClientState(s_glEnableClientState); - m_glDisableClientState_enc = set_glDisableClientState(s_glDisableClientState); - m_glIsEnabled_enc = set_glIsEnabled(s_glIsEnabled); - m_glDrawArrays_enc = set_glDrawArrays(s_glDrawArrays); - m_glDrawElements_enc = set_glDrawElements(s_glDrawElements); - set_glGetString(s_glGetString); - set_glFinish(s_glFinish); - m_glGetError_enc = set_glGetError(s_glGetError); - - m_glActiveTexture_enc = set_glActiveTexture(s_glActiveTexture); - m_glBindTexture_enc = set_glBindTexture(s_glBindTexture); - m_glDeleteTextures_enc = set_glDeleteTextures(s_glDeleteTextures); - m_glDisable_enc = set_glDisable(s_glDisable); - m_glEnable_enc = set_glEnable(s_glEnable); - m_glGetTexParameterfv_enc = set_glGetTexParameterfv(s_glGetTexParameterfv); - m_glGetTexParameteriv_enc = set_glGetTexParameteriv(s_glGetTexParameteriv); - m_glGetTexParameterxv_enc = set_glGetTexParameterxv(s_glGetTexParameterxv); - m_glTexParameterf_enc = set_glTexParameterf(s_glTexParameterf); - m_glTexParameterfv_enc = set_glTexParameterfv(s_glTexParameterfv); - m_glTexParameteri_enc = set_glTexParameteri(s_glTexParameteri); - m_glTexParameterx_enc = set_glTexParameterx(s_glTexParameterx); - m_glTexParameteriv_enc = set_glTexParameteriv(s_glTexParameteriv); - m_glTexParameterxv_enc = set_glTexParameterxv(s_glTexParameterxv); -} - -GLEncoder::~GLEncoder() -{ - delete [] m_compressedTextureFormats; -} - -size_t GLEncoder::pixelDataSize(GLsizei width, GLsizei height, GLenum format, GLenum type, int pack) -{ - assert(m_state != NULL); - return m_state->pixelDataSize(width, height, format, type, pack); -} - -void GLEncoder::s_glFinish(void *self) -{ - GLEncoder *ctx = (GLEncoder *)self; - ctx->glFinishRoundTrip(self); -} diff --git a/emulator/opengl/system/GLESv1_enc/GLEncoder.h b/emulator/opengl/system/GLESv1_enc/GLEncoder.h deleted file mode 100644 index effc53f..0000000 --- a/emulator/opengl/system/GLESv1_enc/GLEncoder.h +++ /dev/null @@ -1,149 +0,0 @@ -/* -* Copyright (C) 2011 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -#ifndef _GL_ENCODER_H_ -#define _GL_ENCODER_H_ - -#include "gl_enc.h" -#include "GLClientState.h" -#include "GLSharedGroup.h" -#include "FixedBuffer.h" - -class GLEncoder : public gl_encoder_context_t { - -public: - GLEncoder(IOStream *stream); - virtual ~GLEncoder(); - void setClientState(GLClientState *state) { - m_state = state; - } - void setSharedGroup(GLSharedGroupPtr shared) { m_shared = shared; } - void flush() { m_stream->flush(); } - size_t pixelDataSize(GLsizei width, GLsizei height, GLenum format, GLenum type, int pack); - - void setInitialized(){ m_initialized = true; }; - bool isInitialized(){ return m_initialized; }; - - virtual void setError(GLenum error){ m_error = error; }; - virtual GLenum getError() { return m_error; }; - - void override2DTextureTarget(GLenum target); - void restore2DTextureTarget(); - -private: - - bool m_initialized; - GLClientState *m_state; - GLSharedGroupPtr m_shared; - GLenum m_error; - FixedBuffer m_fixedBuffer; - GLint *m_compressedTextureFormats; - GLint m_num_compressedTextureFormats; - - GLint *getCompressedTextureFormats(); - // original functions; - glGetError_client_proc_t m_glGetError_enc; - glGetIntegerv_client_proc_t m_glGetIntegerv_enc; - glGetFloatv_client_proc_t m_glGetFloatv_enc; - glGetFixedv_client_proc_t m_glGetFixedv_enc; - glGetBooleanv_client_proc_t m_glGetBooleanv_enc; - glGetPointerv_client_proc_t m_glGetPointerv_enc; - - glPixelStorei_client_proc_t m_glPixelStorei_enc; - glVertexPointer_client_proc_t m_glVertexPointer_enc; - glNormalPointer_client_proc_t m_glNormalPointer_enc; - glColorPointer_client_proc_t m_glColorPointer_enc; - glPointSizePointerOES_client_proc_t m_glPointSizePointerOES_enc; - glTexCoordPointer_client_proc_t m_glTexCoordPointer_enc; - glClientActiveTexture_client_proc_t m_glClientActiveTexture_enc; - glMatrixIndexPointerOES_client_proc_t m_glMatrixIndexPointerOES_enc; - glWeightPointerOES_client_proc_t m_glWeightPointerOES_enc; - - glBindBuffer_client_proc_t m_glBindBuffer_enc; - glBufferData_client_proc_t m_glBufferData_enc; - glBufferSubData_client_proc_t m_glBufferSubData_enc; - glDeleteBuffers_client_proc_t m_glDeleteBuffers_enc; - - glEnableClientState_client_proc_t m_glEnableClientState_enc; - glDisableClientState_client_proc_t m_glDisableClientState_enc; - glIsEnabled_client_proc_t m_glIsEnabled_enc; - glDrawArrays_client_proc_t m_glDrawArrays_enc; - glDrawElements_client_proc_t m_glDrawElements_enc; - glFlush_client_proc_t m_glFlush_enc; - - glActiveTexture_client_proc_t m_glActiveTexture_enc; - glBindTexture_client_proc_t m_glBindTexture_enc; - glDeleteTextures_client_proc_t m_glDeleteTextures_enc; - glDisable_client_proc_t m_glDisable_enc; - glEnable_client_proc_t m_glEnable_enc; - glGetTexParameterfv_client_proc_t m_glGetTexParameterfv_enc; - glGetTexParameteriv_client_proc_t m_glGetTexParameteriv_enc; - glGetTexParameterxv_client_proc_t m_glGetTexParameterxv_enc; - glTexParameterf_client_proc_t m_glTexParameterf_enc; - glTexParameterfv_client_proc_t m_glTexParameterfv_enc; - glTexParameteri_client_proc_t m_glTexParameteri_enc; - glTexParameterx_client_proc_t m_glTexParameterx_enc; - glTexParameteriv_client_proc_t m_glTexParameteriv_enc; - glTexParameterxv_client_proc_t m_glTexParameterxv_enc; - - // statics - static GLenum s_glGetError(void * self); - static void s_glGetIntegerv(void *self, GLenum pname, GLint *ptr); - static void s_glGetBooleanv(void *self, GLenum pname, GLboolean *ptr); - static void s_glGetFloatv(void *self, GLenum pname, GLfloat *ptr); - static void s_glGetFixedv(void *self, GLenum pname, GLfixed *ptr); - static void s_glGetPointerv(void *self, GLenum pname, GLvoid **params); - - static void s_glFlush(void * self); - static const GLubyte * s_glGetString(void *self, GLenum name); - static void s_glVertexPointer(void *self, int size, GLenum type, GLsizei stride, const void *data); - static void s_glNormalPointer(void *self, GLenum type, GLsizei stride, const void *data); - static void s_glColorPointer(void *self, int size, GLenum type, GLsizei stride, const void *data); - static void s_glPointsizePointer(void *self, GLenum type, GLsizei stride, const void *data); - static void s_glClientActiveTexture(void *self, GLenum texture); - static void s_glTexcoordPointer(void *self, int size, GLenum type, GLsizei stride, const void *data); - static void s_glMatrixIndexPointerOES(void *self, int size, GLenum type, GLsizei stride, const void * data); - static void s_glWeightPointerOES(void *self, int size, GLenum type, GLsizei stride, const void * data); - static void s_glDisableClientState(void *self, GLenum state); - static void s_glEnableClientState(void *self, GLenum state); - static GLboolean s_glIsEnabled(void *self, GLenum cap); - static void s_glBindBuffer(void *self, GLenum target, GLuint id); - static void s_glBufferData(void *self, GLenum target, GLsizeiptr size, const GLvoid * data, GLenum usage); - static void s_glBufferSubData(void *self, GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid * data); - static void s_glDeleteBuffers(void *self, GLsizei n, const GLuint * buffers); - - static void s_glDrawArrays(void *self, GLenum mode, GLint first, GLsizei count); - static void s_glDrawElements(void *self, GLenum mode, GLsizei count, GLenum type, const void *indices); - static void s_glPixelStorei(void *self, GLenum param, GLint value); - - static void s_glFinish(void *self); - void sendVertexData(unsigned first, unsigned count); - - static void s_glActiveTexture(void* self, GLenum texture); - static void s_glBindTexture(void* self, GLenum target, GLuint texture); - static void s_glDeleteTextures(void* self, GLsizei n, const GLuint* textures); - static void s_glDisable(void* self, GLenum cap); - static void s_glEnable(void* self, GLenum cap); - static void s_glGetTexParameterfv(void* self, GLenum target, GLenum pname, GLfloat* params); - static void s_glGetTexParameteriv(void* self, GLenum target, GLenum pname, GLint* params); - static void s_glGetTexParameterxv(void* self, GLenum target, GLenum pname, GLfixed* params); - static void s_glTexParameterf(void* self, GLenum target, GLenum pname, GLfloat param); - static void s_glTexParameterfv(void* self, GLenum target, GLenum pname, const GLfloat* params); - static void s_glTexParameteri(void* self, GLenum target, GLenum pname, GLint param); - static void s_glTexParameterx(void* self, GLenum target, GLenum pname, GLfixed param); - static void s_glTexParameteriv(void* self, GLenum target, GLenum pname, const GLint* params); - static void s_glTexParameterxv(void* self, GLenum target, GLenum pname, const GLfixed* params); -}; -#endif diff --git a/emulator/opengl/system/GLESv1_enc/GLEncoderUtils.cpp b/emulator/opengl/system/GLESv1_enc/GLEncoderUtils.cpp deleted file mode 100644 index 7866d53..0000000 --- a/emulator/opengl/system/GLESv1_enc/GLEncoderUtils.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/* -* Copyright (C) 2011 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -#include <stdio.h> -#include <stdlib.h> -#include "GLEncoder.h" - -size_t pixelDataSize(void *self, GLsizei width, GLsizei height, GLenum format, GLenum type, int pack) -{ - GLEncoder *ctx = (GLEncoder *)self; - return ctx->pixelDataSize(width, height, format, type, pack); -} diff --git a/emulator/opengl/system/GLESv1_enc/GLEncoderUtils.h b/emulator/opengl/system/GLESv1_enc/GLEncoderUtils.h deleted file mode 100644 index 1d0c847..0000000 --- a/emulator/opengl/system/GLESv1_enc/GLEncoderUtils.h +++ /dev/null @@ -1,22 +0,0 @@ -/* -* Copyright (C) 2011 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -#ifndef GL_ENCODER_UTILS_H -#define GL_ENCLODER_UTILS_H - -extern "C" { - size_t pixelDataSize(void *self, GLsizei width, GLsizei height, GLenum format, GLenum type, int pack); -}; -#endif diff --git a/emulator/opengl/system/GLESv2/Android.mk b/emulator/opengl/system/GLESv2/Android.mk deleted file mode 100644 index c299522..0000000 --- a/emulator/opengl/system/GLESv2/Android.mk +++ /dev/null @@ -1,12 +0,0 @@ -LOCAL_PATH := $(call my-dir) - -### GLESv2 implementation ########################################### -$(call emugl-begin-shared-library,libGLESv2_emulation) -$(call emugl-import,libOpenglSystemCommon libGLESv2_enc lib_renderControl_enc) - -LOCAL_CFLAGS += -DLOG_TAG=\"GLESv2_emulation\" -DGL_GLEXT_PROTOTYPES - -LOCAL_SRC_FILES := gl2.cpp -LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/egl - -$(call emugl-end-module) diff --git a/emulator/opengl/system/GLESv2/gl2.cpp b/emulator/opengl/system/GLESv2/gl2.cpp deleted file mode 100644 index b32dd74..0000000 --- a/emulator/opengl/system/GLESv2/gl2.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/* -* Copyright 2011 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "EGLClientIface.h" -#include "HostConnection.h" -#include "GL2Encoder.h" -#include "GLES/gl.h" -#include "GLES/glext.h" -#include "ErrorLog.h" -#include "gralloc_cb.h" -#include "ThreadInfo.h" - -//XXX: fix this macro to get the context from fast tls path -#define GET_CONTEXT GL2Encoder * ctx = getEGLThreadInfo()->hostConn->gl2Encoder(); - -#include "gl2_entry.cpp" - -//The functions table -#include "gl2_ftable.h" - - -static EGLClient_eglInterface * s_egl = NULL; -static EGLClient_glesInterface * s_gl = NULL; - -#define DEFINE_AND_VALIDATE_HOST_CONNECTION(ret) \ - HostConnection *hostCon = HostConnection::get(); \ - if (!hostCon) { \ - ALOGE("egl: Failed to get host connection\n"); \ - return ret; \ - } \ - renderControl_encoder_context_t *rcEnc = hostCon->rcEncoder(); \ - if (!rcEnc) { \ - ALOGE("egl: Failed to get renderControl encoder context\n"); \ - return ret; \ - } - -//GL extensions -void glEGLImageTargetTexture2DOES(void * self, GLenum target, GLeglImageOES image) -{ - DBG("glEGLImageTargetTexture2DOES v2 target=%#x img=%p\n", target, image); - //TODO: check error - we don't have a way to set gl error - android_native_buffer_t* native_buffer = (android_native_buffer_t*)image; - - if (native_buffer->common.magic != ANDROID_NATIVE_BUFFER_MAGIC) { - return; - } - - if (native_buffer->common.version != sizeof(android_native_buffer_t)) { - return; - } - - GET_CONTEXT; - DEFINE_AND_VALIDATE_HOST_CONNECTION(); - - ctx->override2DTextureTarget(target); - rcEnc->rcBindTexture(rcEnc, ((cb_handle_t *)(native_buffer->handle))->hostHandle); - ctx->restore2DTextureTarget(); - - return; -} - -void glEGLImageTargetRenderbufferStorageOES(void *self, GLenum target, GLeglImageOES image) -{ - DBG("glEGLImageTargetRenderbufferStorageOES v2 image=%p\n", image); - //TODO: check error - we don't have a way to set gl error - android_native_buffer_t* native_buffer = (android_native_buffer_t*)image; - - if (native_buffer->common.magic != ANDROID_NATIVE_BUFFER_MAGIC) { - return; - } - - if (native_buffer->common.version != sizeof(android_native_buffer_t)) { - return; - } - - DEFINE_AND_VALIDATE_HOST_CONNECTION(); - rcEnc->rcBindRenderbuffer(rcEnc, ((cb_handle_t *)(native_buffer->handle))->hostHandle); - - return; -} - -void * getProcAddress(const char * procname) -{ - // search in GL function table - for (int i=0; i<gl2_num_funcs; i++) { - if (!strcmp(gl2_funcs_by_name[i].name, procname)) { - return gl2_funcs_by_name[i].proc; - } - } - return NULL; -} - -void finish() -{ - glFinish(); -} - -const GLubyte *my_glGetString (void *self, GLenum name) -{ - if (s_egl) { - return (const GLubyte*)s_egl->getGLString(name); - } - return NULL; -} - -void init() -{ - GET_CONTEXT; - ctx->set_glEGLImageTargetTexture2DOES(glEGLImageTargetTexture2DOES); - ctx->set_glEGLImageTargetRenderbufferStorageOES(glEGLImageTargetRenderbufferStorageOES); - ctx->set_glGetString(my_glGetString); -} - -extern "C" { -EGLClient_glesInterface * init_emul_gles(EGLClient_eglInterface *eglIface) -{ - s_egl = eglIface; - - if (!s_gl) { - s_gl = new EGLClient_glesInterface(); - s_gl->getProcAddress = getProcAddress; - s_gl->finish = finish; - s_gl->init = init; - } - - return s_gl; -} -} //extern - - diff --git a/emulator/opengl/system/GLESv2_enc/Android.mk b/emulator/opengl/system/GLESv2_enc/Android.mk deleted file mode 100644 index 2a4d2f4..0000000 --- a/emulator/opengl/system/GLESv2_enc/Android.mk +++ /dev/null @@ -1,18 +0,0 @@ -LOCAL_PATH := $(call my-dir) - -### GLESv2_enc Encoder ########################################### -$(call emugl-begin-shared-library,libGLESv2_enc) - -LOCAL_SRC_FILES := \ - GL2EncoderUtils.cpp \ - GL2Encoder.cpp - -LOCAL_CFLAGS += -DLOG_TAG=\"emuglGLESv2_enc\" - -$(call emugl-gen-encoder,$(LOCAL_PATH),gl2) -$(call emugl-export,C_INCLUDES,$(LOCAL_PATH)) -$(call emugl-import,libOpenglCodecCommon) - -$(call emugl-end-module) - - diff --git a/emulator/opengl/system/GLESv2_enc/GL2Encoder.cpp b/emulator/opengl/system/GLESv2_enc/GL2Encoder.cpp deleted file mode 100644 index d8fedf3..0000000 --- a/emulator/opengl/system/GLESv2_enc/GL2Encoder.cpp +++ /dev/null @@ -1,1197 +0,0 @@ -/* -* Copyright (C) 2011 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "GL2Encoder.h" -#include <assert.h> -#include <ctype.h> - -#ifndef MIN -#define MIN(a, b) ((a) < (b) ? (a) : (b)) -#endif - -static GLubyte *gVendorString= (GLubyte *) "Android"; -static GLubyte *gRendererString= (GLubyte *) "Android HW-GLES 2.0"; -static GLubyte *gVersionString= (GLubyte *) "OpenGL ES 2.0"; -static GLubyte *gExtensionsString= (GLubyte *) ""; // no extensions at this point; - -#define SET_ERROR_IF(condition,err) if((condition)) { \ - ALOGE("%s:%s:%d GL error 0x%x\n", __FILE__, __FUNCTION__, __LINE__, err); \ - ctx->setError(err); \ - return; \ - } - - -#define RET_AND_SET_ERROR_IF(condition,err,ret) if((condition)) { \ - ALOGE("%s:%s:%d GL error 0x%x\n", __FILE__, __FUNCTION__, __LINE__, err); \ - ctx->setError(err); \ - return ret; \ - } - - -GL2Encoder::GL2Encoder(IOStream *stream) : gl2_encoder_context_t(stream) -{ - m_initialized = false; - m_state = NULL; - m_error = GL_NO_ERROR; - m_num_compressedTextureFormats = 0; - m_compressedTextureFormats = NULL; - //overrides - m_glFlush_enc = set_glFlush(s_glFlush); - m_glPixelStorei_enc = set_glPixelStorei(s_glPixelStorei); - m_glGetString_enc = set_glGetString(s_glGetString); - m_glBindBuffer_enc = set_glBindBuffer(s_glBindBuffer); - m_glBufferData_enc = set_glBufferData(s_glBufferData); - m_glBufferSubData_enc = set_glBufferSubData(s_glBufferSubData); - m_glDeleteBuffers_enc = set_glDeleteBuffers(s_glDeleteBuffers); - m_glDrawArrays_enc = set_glDrawArrays(s_glDrawArrays); - m_glDrawElements_enc = set_glDrawElements(s_glDrawElements); - m_glGetIntegerv_enc = set_glGetIntegerv(s_glGetIntegerv); - m_glGetFloatv_enc = set_glGetFloatv(s_glGetFloatv); - m_glGetBooleanv_enc = set_glGetBooleanv(s_glGetBooleanv); - m_glVertexAttribPointer_enc = set_glVertexAttribPointer(s_glVertexAtrribPointer); - m_glEnableVertexAttribArray_enc = set_glEnableVertexAttribArray(s_glEnableVertexAttribArray); - m_glDisableVertexAttribArray_enc = set_glDisableVertexAttribArray(s_glDisableVertexAttribArray); - m_glGetVertexAttribiv_enc = set_glGetVertexAttribiv(s_glGetVertexAttribiv); - m_glGetVertexAttribfv_enc = set_glGetVertexAttribfv(s_glGetVertexAttribfv); - m_glGetVertexAttribPointerv = set_glGetVertexAttribPointerv(s_glGetVertexAttribPointerv); - set_glShaderSource(s_glShaderSource); - set_glFinish(s_glFinish); - m_glGetError_enc = set_glGetError(s_glGetError); - m_glLinkProgram_enc = set_glLinkProgram(s_glLinkProgram); - m_glDeleteProgram_enc = set_glDeleteProgram(s_glDeleteProgram); - m_glGetUniformiv_enc = set_glGetUniformiv(s_glGetUniformiv); - m_glGetUniformfv_enc = set_glGetUniformfv(s_glGetUniformfv); - m_glCreateProgram_enc = set_glCreateProgram(s_glCreateProgram); - m_glCreateShader_enc = set_glCreateShader(s_glCreateShader); - m_glDeleteShader_enc = set_glDeleteShader(s_glDeleteShader); - m_glAttachShader_enc = set_glAttachShader(s_glAttachShader); - m_glDetachShader_enc = set_glDetachShader(s_glDetachShader); - m_glGetUniformLocation_enc = set_glGetUniformLocation(s_glGetUniformLocation); - m_glUseProgram_enc = set_glUseProgram(s_glUseProgram); - - m_glUniform1f_enc = set_glUniform1f(s_glUniform1f); - m_glUniform1fv_enc = set_glUniform1fv(s_glUniform1fv); - m_glUniform1i_enc = set_glUniform1i(s_glUniform1i); - m_glUniform1iv_enc = set_glUniform1iv(s_glUniform1iv); - m_glUniform2f_enc = set_glUniform2f(s_glUniform2f); - m_glUniform2fv_enc = set_glUniform2fv(s_glUniform2fv); - m_glUniform2i_enc = set_glUniform2i(s_glUniform2i); - m_glUniform2iv_enc = set_glUniform2iv(s_glUniform2iv); - m_glUniform3f_enc = set_glUniform3f(s_glUniform3f); - m_glUniform3fv_enc = set_glUniform3fv(s_glUniform3fv); - m_glUniform3i_enc = set_glUniform3i(s_glUniform3i); - m_glUniform3iv_enc = set_glUniform3iv(s_glUniform3iv); - m_glUniform4f_enc = set_glUniform4f(s_glUniform4f); - m_glUniform4fv_enc = set_glUniform4fv(s_glUniform4fv); - m_glUniform4i_enc = set_glUniform4i(s_glUniform4i); - m_glUniform4iv_enc = set_glUniform4iv(s_glUniform4iv); - m_glUniformMatrix2fv_enc = set_glUniformMatrix2fv(s_glUniformMatrix2fv); - m_glUniformMatrix3fv_enc = set_glUniformMatrix3fv(s_glUniformMatrix3fv); - m_glUniformMatrix4fv_enc = set_glUniformMatrix4fv(s_glUniformMatrix4fv); - - m_glActiveTexture_enc = set_glActiveTexture(s_glActiveTexture); - m_glBindTexture_enc = set_glBindTexture(s_glBindTexture); - m_glDeleteTextures_enc = set_glDeleteTextures(s_glDeleteTextures); - m_glGetTexParameterfv_enc = set_glGetTexParameterfv(s_glGetTexParameterfv); - m_glGetTexParameteriv_enc = set_glGetTexParameteriv(s_glGetTexParameteriv); - m_glTexParameterf_enc = set_glTexParameterf(s_glTexParameterf); - m_glTexParameterfv_enc = set_glTexParameterfv(s_glTexParameterfv); - m_glTexParameteri_enc = set_glTexParameteri(s_glTexParameteri); - m_glTexParameteriv_enc = set_glTexParameteriv(s_glTexParameteriv); -} - -GL2Encoder::~GL2Encoder() -{ - delete m_compressedTextureFormats; -} - -GLenum GL2Encoder::s_glGetError(void * self) -{ - GL2Encoder *ctx = (GL2Encoder *)self; - GLenum err = ctx->getError(); - if(err != GL_NO_ERROR) { - ctx->setError(GL_NO_ERROR); - return err; - } - - return ctx->m_glGetError_enc(self); - -} - -void GL2Encoder::s_glFlush(void *self) -{ - GL2Encoder *ctx = (GL2Encoder *) self; - ctx->m_glFlush_enc(self); - ctx->m_stream->flush(); -} - -const GLubyte *GL2Encoder::s_glGetString(void *self, GLenum name) -{ - GLubyte *retval = (GLubyte *) ""; - switch(name) { - case GL_VENDOR: - retval = gVendorString; - break; - case GL_RENDERER: - retval = gRendererString; - break; - case GL_VERSION: - retval = gVersionString; - break; - case GL_EXTENSIONS: - retval = gExtensionsString; - break; - } - return retval; -} - -void GL2Encoder::s_glPixelStorei(void *self, GLenum param, GLint value) -{ - GL2Encoder *ctx = (GL2Encoder *)self; - ctx->m_glPixelStorei_enc(ctx, param, value); - assert(ctx->m_state != NULL); - ctx->m_state->setPixelStore(param, value); -} - - -void GL2Encoder::s_glBindBuffer(void *self, GLenum target, GLuint id) -{ - GL2Encoder *ctx = (GL2Encoder *) self; - assert(ctx->m_state != NULL); - ctx->m_state->bindBuffer(target, id); - // TODO set error state if needed; - ctx->m_glBindBuffer_enc(self, target, id); -} - -void GL2Encoder::s_glBufferData(void * self, GLenum target, GLsizeiptr size, const GLvoid * data, GLenum usage) -{ - GL2Encoder *ctx = (GL2Encoder *) self; - GLuint bufferId = ctx->m_state->getBuffer(target); - SET_ERROR_IF(bufferId==0, GL_INVALID_OPERATION); - SET_ERROR_IF(size<0, GL_INVALID_VALUE); - - ctx->m_shared->updateBufferData(bufferId, size, (void*)data); - ctx->m_glBufferData_enc(self, target, size, data, usage); -} - -void GL2Encoder::s_glBufferSubData(void * self, GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid * data) -{ - GL2Encoder *ctx = (GL2Encoder *) self; - GLuint bufferId = ctx->m_state->getBuffer(target); - SET_ERROR_IF(bufferId==0, GL_INVALID_OPERATION); - - GLenum res = ctx->m_shared->subUpdateBufferData(bufferId, offset, size, (void*)data); - SET_ERROR_IF(res, res); - - ctx->m_glBufferSubData_enc(self, target, offset, size, data); -} - -void GL2Encoder::s_glDeleteBuffers(void * self, GLsizei n, const GLuint * buffers) -{ - GL2Encoder *ctx = (GL2Encoder *) self; - SET_ERROR_IF(n<0, GL_INVALID_VALUE); - for (int i=0; i<n; i++) { - ctx->m_shared->deleteBufferData(buffers[i]); - ctx->m_glDeleteBuffers_enc(self,1,&buffers[i]); - } -} - -void GL2Encoder::s_glVertexAtrribPointer(void *self, GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid * ptr) -{ - GL2Encoder *ctx = (GL2Encoder *)self; - assert(ctx->m_state != NULL); - ctx->m_state->setState(indx, size, type, normalized, stride, ptr); -} - -void GL2Encoder::s_glGetIntegerv(void *self, GLenum param, GLint *ptr) -{ - GL2Encoder *ctx = (GL2Encoder *) self; - assert(ctx->m_state != NULL); - GLClientState* state = ctx->m_state; - - switch (param) { - case GL_NUM_SHADER_BINARY_FORMATS: - *ptr = 0; - break; - case GL_SHADER_BINARY_FORMATS: - // do nothing - break; - - case GL_COMPRESSED_TEXTURE_FORMATS: { - GLint *compressedTextureFormats = ctx->getCompressedTextureFormats(); - if (ctx->m_num_compressedTextureFormats > 0 && - compressedTextureFormats != NULL) { - memcpy(ptr, compressedTextureFormats, - ctx->m_num_compressedTextureFormats * sizeof(GLint)); - } - break; - } - - case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS: - case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS: - case GL_MAX_TEXTURE_IMAGE_UNITS: - ctx->m_glGetIntegerv_enc(self, param, ptr); - *ptr = MIN(*ptr, GLClientState::MAX_TEXTURE_UNITS); - break; - - case GL_TEXTURE_BINDING_2D: - *ptr = state->getBoundTexture(GL_TEXTURE_2D); - break; - case GL_TEXTURE_BINDING_EXTERNAL_OES: - *ptr = state->getBoundTexture(GL_TEXTURE_EXTERNAL_OES); - break; - - default: - if (!ctx->m_state->getClientStateParameter<GLint>(param, ptr)) { - ctx->m_glGetIntegerv_enc(self, param, ptr); - } - break; - } -} - - -void GL2Encoder::s_glGetFloatv(void *self, GLenum param, GLfloat *ptr) -{ - GL2Encoder *ctx = (GL2Encoder *)self; - assert(ctx->m_state != NULL); - GLClientState* state = ctx->m_state; - - switch (param) { - case GL_NUM_SHADER_BINARY_FORMATS: - *ptr = 0; - break; - case GL_SHADER_BINARY_FORMATS: - // do nothing - break; - - case GL_COMPRESSED_TEXTURE_FORMATS: { - GLint *compressedTextureFormats = ctx->getCompressedTextureFormats(); - if (ctx->m_num_compressedTextureFormats > 0 && - compressedTextureFormats != NULL) { - for (int i = 0; i < ctx->m_num_compressedTextureFormats; i++) { - ptr[i] = (GLfloat) compressedTextureFormats[i]; - } - } - break; - } - - case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS: - case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS: - case GL_MAX_TEXTURE_IMAGE_UNITS: - ctx->m_glGetFloatv_enc(self, param, ptr); - *ptr = MIN(*ptr, (GLfloat)GLClientState::MAX_TEXTURE_UNITS); - break; - - case GL_TEXTURE_BINDING_2D: - *ptr = (GLfloat)state->getBoundTexture(GL_TEXTURE_2D); - break; - case GL_TEXTURE_BINDING_EXTERNAL_OES: - *ptr = (GLfloat)state->getBoundTexture(GL_TEXTURE_EXTERNAL_OES); - break; - - default: - if (!ctx->m_state->getClientStateParameter<GLfloat>(param, ptr)) { - ctx->m_glGetFloatv_enc(self, param, ptr); - } - break; - } -} - - -void GL2Encoder::s_glGetBooleanv(void *self, GLenum param, GLboolean *ptr) -{ - GL2Encoder *ctx = (GL2Encoder *)self; - assert(ctx->m_state != NULL); - GLClientState* state = ctx->m_state; - - switch (param) { - case GL_NUM_SHADER_BINARY_FORMATS: - *ptr = GL_FALSE; - break; - case GL_SHADER_BINARY_FORMATS: - // do nothing - break; - - case GL_COMPRESSED_TEXTURE_FORMATS: { - GLint *compressedTextureFormats = ctx->getCompressedTextureFormats(); - if (ctx->m_num_compressedTextureFormats > 0 && - compressedTextureFormats != NULL) { - for (int i = 0; i < ctx->m_num_compressedTextureFormats; i++) { - ptr[i] = compressedTextureFormats[i] != 0 ? GL_TRUE : GL_FALSE; - } - } - break; - } - - case GL_TEXTURE_BINDING_2D: - *ptr = state->getBoundTexture(GL_TEXTURE_2D) != 0 ? GL_TRUE : GL_FALSE; - break; - case GL_TEXTURE_BINDING_EXTERNAL_OES: - *ptr = state->getBoundTexture(GL_TEXTURE_EXTERNAL_OES) != 0 - ? GL_TRUE : GL_FALSE; - break; - - default: - if (!ctx->m_state->getClientStateParameter<GLboolean>(param, ptr)) { - ctx->m_glGetBooleanv_enc(self, param, ptr); - } - break; - } -} - - -void GL2Encoder::s_glEnableVertexAttribArray(void *self, GLuint index) -{ - GL2Encoder *ctx = (GL2Encoder *)self; - assert(ctx->m_state); - ctx->m_state->enable(index, 1); -} - -void GL2Encoder::s_glDisableVertexAttribArray(void *self, GLuint index) -{ - GL2Encoder *ctx = (GL2Encoder *)self; - assert(ctx->m_state); - ctx->m_state->enable(index, 0); -} - - -void GL2Encoder::s_glGetVertexAttribiv(void *self, GLuint index, GLenum pname, GLint *params) -{ - GL2Encoder *ctx = (GL2Encoder *)self; - assert(ctx->m_state); - - if (!ctx->m_state->getVertexAttribParameter<GLint>(index, pname, params)) { - ctx->m_glGetVertexAttribiv_enc(self, index, pname, params); - } -} - -void GL2Encoder::s_glGetVertexAttribfv(void *self, GLuint index, GLenum pname, GLfloat *params) -{ - GL2Encoder *ctx = (GL2Encoder *)self; - assert(ctx->m_state); - - if (!ctx->m_state->getVertexAttribParameter<GLfloat>(index, pname, params)) { - ctx->m_glGetVertexAttribfv_enc(self, index, pname, params); - } -} - -void GL2Encoder::s_glGetVertexAttribPointerv(void *self, GLuint index, GLenum pname, GLvoid **pointer) -{ - GL2Encoder *ctx = (GL2Encoder *)self; - if (ctx->m_state == NULL) return; - - const GLClientState::VertexAttribState *va_state = ctx->m_state->getState(index); - if (va_state != NULL) { - *pointer = va_state->data; - } -} - - -void GL2Encoder::sendVertexAttributes(GLint first, GLsizei count) -{ - assert(m_state); - - for (int i = 0; i < m_state->nLocations(); i++) { - bool enableDirty; - const GLClientState::VertexAttribState *state = m_state->getStateAndEnableDirty(i, &enableDirty); - - if (!state) { - continue; - } - - if (!enableDirty && !state->enabled) { - continue; - } - - - if (state->enabled) { - m_glEnableVertexAttribArray_enc(this, i); - - unsigned int datalen = state->elementSize * count; - int stride = state->stride == 0 ? state->elementSize : state->stride; - int firstIndex = stride * first; - - if (state->bufferObject == 0) { - this->glVertexAttribPointerData(this, i, state->size, state->type, state->normalized, state->stride, - (unsigned char *)state->data + firstIndex, datalen); - } else { - this->m_glBindBuffer_enc(this, GL_ARRAY_BUFFER, state->bufferObject); - this->glVertexAttribPointerOffset(this, i, state->size, state->type, state->normalized, state->stride, - (GLuint) state->data + firstIndex); - this->m_glBindBuffer_enc(this, GL_ARRAY_BUFFER, m_state->currentArrayVbo()); - } - } else { - this->m_glDisableVertexAttribArray_enc(this, i); - } - } -} - -void GL2Encoder::s_glDrawArrays(void *self, GLenum mode, GLint first, GLsizei count) -{ - GL2Encoder *ctx = (GL2Encoder *)self; - ctx->sendVertexAttributes(first, count); - ctx->m_glDrawArrays_enc(ctx, mode, 0, count); -} - - -void GL2Encoder::s_glDrawElements(void *self, GLenum mode, GLsizei count, GLenum type, const void *indices) -{ - - GL2Encoder *ctx = (GL2Encoder *)self; - assert(ctx->m_state != NULL); - SET_ERROR_IF(count<0, GL_INVALID_VALUE); - - bool has_immediate_arrays = false; - bool has_indirect_arrays = false; - int nLocations = ctx->m_state->nLocations(); - - for (int i = 0; i < nLocations; i++) { - const GLClientState::VertexAttribState *state = ctx->m_state->getState(i); - if (state->enabled) { - if (state->bufferObject != 0) { - has_indirect_arrays = true; - } else { - has_immediate_arrays = true; - } - } - } - - if (!has_immediate_arrays && !has_indirect_arrays) { - ALOGE("glDrawElements: no data bound to the command - ignoring\n"); - return; - } - - bool adjustIndices = true; - if (ctx->m_state->currentIndexVbo() != 0) { - if (!has_immediate_arrays) { - ctx->sendVertexAttributes(0, count); - ctx->m_glBindBuffer_enc(self, GL_ELEMENT_ARRAY_BUFFER, ctx->m_state->currentIndexVbo()); - ctx->glDrawElementsOffset(ctx, mode, count, type, (GLuint)indices); - adjustIndices = false; - } else { - BufferData * buf = ctx->m_shared->getBufferData(ctx->m_state->currentIndexVbo()); - ctx->m_glBindBuffer_enc(self, GL_ELEMENT_ARRAY_BUFFER, 0); - indices = (void*)((GLintptr)buf->m_fixedBuffer.ptr() + (GLintptr)indices); - } - } - if (adjustIndices) { - void *adjustedIndices = (void*)indices; - int minIndex = 0, maxIndex = 0; - - switch(type) { - case GL_BYTE: - case GL_UNSIGNED_BYTE: - GLUtils::minmax<unsigned char>((unsigned char *)indices, count, &minIndex, &maxIndex); - if (minIndex != 0) { - adjustedIndices = ctx->m_fixedBuffer.alloc(glSizeof(type) * count); - GLUtils::shiftIndices<unsigned char>((unsigned char *)indices, - (unsigned char *)adjustedIndices, - count, -minIndex); - } - break; - case GL_SHORT: - case GL_UNSIGNED_SHORT: - GLUtils::minmax<unsigned short>((unsigned short *)indices, count, &minIndex, &maxIndex); - if (minIndex != 0) { - adjustedIndices = ctx->m_fixedBuffer.alloc(glSizeof(type) * count); - GLUtils::shiftIndices<unsigned short>((unsigned short *)indices, - (unsigned short *)adjustedIndices, - count, -minIndex); - } - break; - default: - ALOGE("unsupported index buffer type %d\n", type); - } - if (has_indirect_arrays || 1) { - ctx->sendVertexAttributes(minIndex, maxIndex - minIndex + 1); - ctx->glDrawElementsData(ctx, mode, count, type, adjustedIndices, - count * glSizeof(type)); - // XXX - OPTIMIZATION (see the other else branch) should be implemented - if(!has_indirect_arrays) { - //ALOGD("unoptimized drawelements !!!\n"); - } - } else { - // we are all direct arrays and immidate mode index array - - // rebuild the arrays and the index array; - ALOGE("glDrawElements: direct index & direct buffer data - will be implemented in later versions;\n"); - } - } -} - - -GLint * GL2Encoder::getCompressedTextureFormats() -{ - if (m_compressedTextureFormats == NULL) { - this->glGetIntegerv(this, GL_NUM_COMPRESSED_TEXTURE_FORMATS, - &m_num_compressedTextureFormats); - if (m_num_compressedTextureFormats > 0) { - // get number of texture formats; - m_compressedTextureFormats = new GLint[m_num_compressedTextureFormats]; - this->glGetCompressedTextureFormats(this, m_num_compressedTextureFormats, m_compressedTextureFormats); - } - } - return m_compressedTextureFormats; -} - -// Replace uses of samplerExternalOES with sampler2D, recording the names of -// modified shaders in data. Also remove -// #extension GL_OES_EGL_image_external : require -// statements. -// -// This implementation assumes the input has already been pre-processed. If not, -// a few cases will be mishandled: -// -// 1. "mySampler" will be incorrectly recorded as being a samplerExternalOES in -// the following code: -// #if 1 -// uniform sampler2D mySampler; -// #else -// uniform samplerExternalOES mySampler; -// #endif -// -// 2. Comments that look like sampler declarations will be incorrectly modified -// and recorded: -// // samplerExternalOES hahaFooledYou -// -// 3. However, GLSL ES does not have a concatentation operator, so things like -// this (valid in C) are invalid and not a problem: -// #define SAMPLER(TYPE, NAME) uniform sampler#TYPE NAME -// SAMPLER(ExternalOES, mySampler); -// -static bool replaceSamplerExternalWith2D(char* const str, ShaderData* const data) -{ - static const char STR_HASH_EXTENSION[] = "#extension"; - static const char STR_GL_OES_EGL_IMAGE_EXTERNAL[] = "GL_OES_EGL_image_external"; - static const char STR_SAMPLER_EXTERNAL_OES[] = "samplerExternalOES"; - static const char STR_SAMPLER2D_SPACE[] = "sampler2D "; - - // -- overwrite all "#extension GL_OES_EGL_image_external : xxx" statements - char* c = str; - while ((c = strstr(c, STR_HASH_EXTENSION))) { - char* start = c; - c += sizeof(STR_HASH_EXTENSION)-1; - while (isspace(*c) && *c != '\0') { - c++; - } - if (strncmp(c, STR_GL_OES_EGL_IMAGE_EXTERNAL, - sizeof(STR_GL_OES_EGL_IMAGE_EXTERNAL)-1) == 0) - { - // #extension statements are terminated by end of line - c = start; - while (*c != '\0' && *c != '\r' && *c != '\n') { - *c++ = ' '; - } - } - } - - // -- replace "samplerExternalOES" with "sampler2D" and record name - c = str; - while ((c = strstr(c, STR_SAMPLER_EXTERNAL_OES))) { - // Make sure "samplerExternalOES" isn't a substring of a larger token - if (c == str || !isspace(*(c-1))) { - c++; - continue; - } - char* sampler_start = c; - c += sizeof(STR_SAMPLER_EXTERNAL_OES)-1; - if (!isspace(*c) && *c != '\0') { - continue; - } - - // capture sampler name - while (isspace(*c) && *c != '\0') { - c++; - } - if (!isalpha(*c) && *c != '_') { - // not an identifier - return false; - } - char* name_start = c; - do { - c++; - } while (isalnum(*c) || *c == '_'); - data->samplerExternalNames.push_back( - android::String8(name_start, c - name_start)); - - // memcpy instead of strcpy since we don't want the NUL terminator - memcpy(sampler_start, STR_SAMPLER2D_SPACE, sizeof(STR_SAMPLER2D_SPACE)-1); - } - - return true; -} - -void GL2Encoder::s_glShaderSource(void *self, GLuint shader, GLsizei count, const GLchar **string, const GLint *length) -{ - GL2Encoder* ctx = (GL2Encoder*)self; - ShaderData* shaderData = ctx->m_shared->getShaderData(shader); - SET_ERROR_IF(!shaderData, GL_INVALID_VALUE); - - int len = glUtilsCalcShaderSourceLen((char**)string, (GLint*)length, count); - char *str = new char[len + 1]; - glUtilsPackStrings(str, (char**)string, (GLint*)length, count); - - // TODO: pre-process str before calling replaceSamplerExternalWith2D(). - // Perhaps we can borrow Mesa's pre-processor? - - if (!replaceSamplerExternalWith2D(str, shaderData)) { - delete str; - ctx->setError(GL_OUT_OF_MEMORY); - return; - } - - ctx->glShaderString(ctx, shader, str, len + 1); - delete str; -} - -void GL2Encoder::s_glFinish(void *self) -{ - GL2Encoder *ctx = (GL2Encoder *)self; - ctx->glFinishRoundTrip(self); -} - -void GL2Encoder::s_glLinkProgram(void * self, GLuint program) -{ - GL2Encoder *ctx = (GL2Encoder *)self; - ctx->m_glLinkProgram_enc(self, program); - - GLint linkStatus = 0; - ctx->glGetProgramiv(self,program,GL_LINK_STATUS,&linkStatus); - if (!linkStatus) - return; - - //get number of active uniforms in the program - GLint numUniforms=0; - ctx->glGetProgramiv(self, program, GL_ACTIVE_UNIFORMS, &numUniforms); - ctx->m_shared->initProgramData(program,numUniforms); - - //get the length of the longest uniform name - GLint maxLength=0; - ctx->glGetProgramiv(self, program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxLength); - - GLint size; - GLenum type; - GLchar *name = new GLchar[maxLength+1]; - GLint location; - //for each active uniform, get its size and starting location. - for (GLint i=0 ; i<numUniforms ; ++i) - { - ctx->glGetActiveUniform(self, program, i, maxLength, NULL, &size, &type, name); - location = ctx->m_glGetUniformLocation_enc(self, program, name); - ctx->m_shared->setProgramIndexInfo(program, i, location, size, type, name); - } - ctx->m_shared->setupLocationShiftWAR(program); - - delete[] name; -} - -void GL2Encoder::s_glDeleteProgram(void *self, GLuint program) -{ - GL2Encoder *ctx = (GL2Encoder*)self; - ctx->m_glDeleteProgram_enc(self, program); - - ctx->m_shared->deleteProgramData(program); -} - -void GL2Encoder::s_glGetUniformiv(void *self, GLuint program, GLint location, GLint* params) -{ - GL2Encoder *ctx = (GL2Encoder*)self; - SET_ERROR_IF(!ctx->m_shared->isProgram(program), GL_INVALID_VALUE); - SET_ERROR_IF(!ctx->m_shared->isProgramInitialized(program), GL_INVALID_OPERATION); - GLint hostLoc = ctx->m_shared->locationWARAppToHost(program, location); - SET_ERROR_IF(ctx->m_shared->getProgramUniformType(program,hostLoc)==0, GL_INVALID_OPERATION); - ctx->m_glGetUniformiv_enc(self, program, hostLoc, params); -} -void GL2Encoder::s_glGetUniformfv(void *self, GLuint program, GLint location, GLfloat* params) -{ - GL2Encoder *ctx = (GL2Encoder*)self; - SET_ERROR_IF(!ctx->m_shared->isProgram(program), GL_INVALID_VALUE); - SET_ERROR_IF(!ctx->m_shared->isProgramInitialized(program), GL_INVALID_OPERATION); - GLint hostLoc = ctx->m_shared->locationWARAppToHost(program,location); - SET_ERROR_IF(ctx->m_shared->getProgramUniformType(program,hostLoc)==0, GL_INVALID_OPERATION); - ctx->m_glGetUniformfv_enc(self, program, hostLoc, params); -} - -GLuint GL2Encoder::s_glCreateProgram(void * self) -{ - GL2Encoder *ctx = (GL2Encoder*)self; - GLuint program = ctx->m_glCreateProgram_enc(self); - if (program!=0) - ctx->m_shared->addProgramData(program); - return program; -} - -GLuint GL2Encoder::s_glCreateShader(void *self, GLenum shaderType) -{ - GL2Encoder *ctx = (GL2Encoder*)self; - GLuint shader = ctx->m_glCreateShader_enc(self, shaderType); - if (shader != 0) { - if (!ctx->m_shared->addShaderData(shader)) { - ctx->m_glDeleteShader_enc(self, shader); - return 0; - } - } - return shader; -} - -void GL2Encoder::s_glDeleteShader(void *self, GLenum shader) -{ - GL2Encoder *ctx = (GL2Encoder*)self; - ctx->m_glDeleteShader_enc(self,shader); - ctx->m_shared->unrefShaderData(shader); -} - -void GL2Encoder::s_glAttachShader(void *self, GLuint program, GLuint shader) -{ - GL2Encoder *ctx = (GL2Encoder*)self; - ctx->m_glAttachShader_enc(self, program, shader); - ctx->m_shared->attachShader(program, shader); -} - -void GL2Encoder::s_glDetachShader(void *self, GLuint program, GLuint shader) -{ - GL2Encoder *ctx = (GL2Encoder*)self; - ctx->m_glDetachShader_enc(self, program, shader); - ctx->m_shared->detachShader(program, shader); -} - -int GL2Encoder::s_glGetUniformLocation(void *self, GLuint program, const GLchar *name) -{ - if (!name) return -1; - - GL2Encoder *ctx = (GL2Encoder*)self; - - // if we need the uniform location WAR - // parse array index from the end of the name string - int arrIndex = 0; - bool needLocationWAR = ctx->m_shared->needUniformLocationWAR(program); - if (needLocationWAR) { - int namelen = strlen(name); - if (name[namelen-1] == ']') { - char *brace = strrchr(name,'['); - if (!brace || sscanf(brace+1,"%d",&arrIndex) != 1) { - return -1; - } - - } - } - - int hostLoc = ctx->m_glGetUniformLocation_enc(self, program, name); - if (hostLoc >= 0 && needLocationWAR) { - return ctx->m_shared->locationWARHostToApp(program, hostLoc, arrIndex); - } - return hostLoc; -} - -bool GL2Encoder::updateHostTexture2DBinding(GLenum texUnit, GLenum newTarget) -{ - if (newTarget != GL_TEXTURE_2D && newTarget != GL_TEXTURE_EXTERNAL_OES) - return false; - - m_state->setActiveTextureUnit(texUnit); - - GLenum oldTarget = m_state->getPriorityEnabledTarget(GL_TEXTURE_2D); - if (newTarget != oldTarget) { - if (newTarget == GL_TEXTURE_EXTERNAL_OES) { - m_state->disableTextureTarget(GL_TEXTURE_2D); - m_state->enableTextureTarget(GL_TEXTURE_EXTERNAL_OES); - } else { - m_state->disableTextureTarget(GL_TEXTURE_EXTERNAL_OES); - m_state->enableTextureTarget(GL_TEXTURE_2D); - } - m_glActiveTexture_enc(this, texUnit); - m_glBindTexture_enc(this, GL_TEXTURE_2D, - m_state->getBoundTexture(newTarget)); - return true; - } - - return false; -} - -void GL2Encoder::s_glUseProgram(void *self, GLuint program) -{ - GL2Encoder *ctx = (GL2Encoder*)self; - GLClientState* state = ctx->m_state; - GLSharedGroupPtr shared = ctx->m_shared; - - ctx->m_glUseProgram_enc(self, program); - ctx->m_state->setCurrentProgram(program); - - GLenum origActiveTexture = state->getActiveTextureUnit(); - GLenum hostActiveTexture = origActiveTexture; - GLint samplerIdx = -1; - GLint samplerVal; - GLenum samplerTarget; - while ((samplerIdx = shared->getNextSamplerUniform(program, samplerIdx, &samplerVal, &samplerTarget)) != -1) { - if (samplerVal < 0 || samplerVal >= GLClientState::MAX_TEXTURE_UNITS) - continue; - if (ctx->updateHostTexture2DBinding(GL_TEXTURE0 + samplerVal, - samplerTarget)) - { - hostActiveTexture = GL_TEXTURE0 + samplerVal; - } - } - state->setActiveTextureUnit(origActiveTexture); - if (hostActiveTexture != origActiveTexture) { - ctx->m_glActiveTexture_enc(self, origActiveTexture); - } -} - -void GL2Encoder::s_glUniform1f(void *self , GLint location, GLfloat x) -{ - GL2Encoder *ctx = (GL2Encoder*)self; - GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentProgram(),location); - ctx->m_glUniform1f_enc(self, hostLoc, x); -} - -void GL2Encoder::s_glUniform1fv(void *self , GLint location, GLsizei count, const GLfloat* v) -{ - GL2Encoder *ctx = (GL2Encoder*)self; - GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentProgram(),location); - ctx->m_glUniform1fv_enc(self, hostLoc, count, v); -} - -void GL2Encoder::s_glUniform1i(void *self , GLint location, GLint x) -{ - GL2Encoder *ctx = (GL2Encoder*)self; - GLClientState* state = ctx->m_state; - GLSharedGroupPtr shared = ctx->m_shared; - - GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentProgram(),location); - ctx->m_glUniform1i_enc(self, hostLoc, x); - - GLenum target; - if (shared->setSamplerUniform(state->currentProgram(), location, x, &target)) { - GLenum origActiveTexture = state->getActiveTextureUnit(); - if (ctx->updateHostTexture2DBinding(GL_TEXTURE0 + x, target)) { - ctx->m_glActiveTexture_enc(self, origActiveTexture); - } - state->setActiveTextureUnit(origActiveTexture); - } -} - -void GL2Encoder::s_glUniform1iv(void *self , GLint location, GLsizei count, const GLint* v) -{ - GL2Encoder *ctx = (GL2Encoder*)self; - GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentProgram(),location); - ctx->m_glUniform1iv_enc(self, hostLoc, count, v); -} - -void GL2Encoder::s_glUniform2f(void *self , GLint location, GLfloat x, GLfloat y) -{ - GL2Encoder *ctx = (GL2Encoder*)self; - GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentProgram(),location); - ctx->m_glUniform2f_enc(self, hostLoc, x, y); -} - -void GL2Encoder::s_glUniform2fv(void *self , GLint location, GLsizei count, const GLfloat* v) -{ - GL2Encoder *ctx = (GL2Encoder*)self; - GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentProgram(),location); - ctx->m_glUniform2fv_enc(self, hostLoc, count, v); -} - -void GL2Encoder::s_glUniform2i(void *self , GLint location, GLint x, GLint y) -{ - GL2Encoder *ctx = (GL2Encoder*)self; - GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentProgram(),location); - ctx->m_glUniform2i_enc(self, hostLoc, x, y); -} - -void GL2Encoder::s_glUniform2iv(void *self , GLint location, GLsizei count, const GLint* v) -{ - GL2Encoder *ctx = (GL2Encoder*)self; - GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentProgram(),location); - ctx->m_glUniform2iv_enc(self, hostLoc, count, v); -} - -void GL2Encoder::s_glUniform3f(void *self , GLint location, GLfloat x, GLfloat y, GLfloat z) -{ - GL2Encoder *ctx = (GL2Encoder*)self; - GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentProgram(),location); - ctx->m_glUniform3f_enc(self, hostLoc, x, y, z); -} - -void GL2Encoder::s_glUniform3fv(void *self , GLint location, GLsizei count, const GLfloat* v) -{ - GL2Encoder *ctx = (GL2Encoder*)self; - GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentProgram(),location); - ctx->m_glUniform3fv_enc(self, hostLoc, count, v); -} - -void GL2Encoder::s_glUniform3i(void *self , GLint location, GLint x, GLint y, GLint z) -{ - GL2Encoder *ctx = (GL2Encoder*)self; - GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentProgram(),location); - ctx->m_glUniform3i_enc(self, hostLoc, x, y, z); -} - -void GL2Encoder::s_glUniform3iv(void *self , GLint location, GLsizei count, const GLint* v) -{ - GL2Encoder *ctx = (GL2Encoder*)self; - GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentProgram(),location); - ctx->m_glUniform3iv_enc(self, hostLoc, count, v); -} - -void GL2Encoder::s_glUniform4f(void *self , GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) -{ - GL2Encoder *ctx = (GL2Encoder*)self; - GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentProgram(),location); - ctx->m_glUniform4f_enc(self, hostLoc, x, y, z, w); -} - -void GL2Encoder::s_glUniform4fv(void *self , GLint location, GLsizei count, const GLfloat* v) -{ - GL2Encoder *ctx = (GL2Encoder*)self; - GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentProgram(),location); - ctx->m_glUniform4fv_enc(self, hostLoc, count, v); -} - -void GL2Encoder::s_glUniform4i(void *self , GLint location, GLint x, GLint y, GLint z, GLint w) -{ - GL2Encoder *ctx = (GL2Encoder*)self; - GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentProgram(),location); - ctx->m_glUniform4i_enc(self, hostLoc, x, y, z, w); -} - -void GL2Encoder::s_glUniform4iv(void *self , GLint location, GLsizei count, const GLint* v) -{ - GL2Encoder *ctx = (GL2Encoder*)self; - GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentProgram(),location); - ctx->m_glUniform4iv_enc(self, hostLoc, count, v); -} - -void GL2Encoder::s_glUniformMatrix2fv(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) -{ - GL2Encoder *ctx = (GL2Encoder*)self; - GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentProgram(),location); - ctx->m_glUniformMatrix2fv_enc(self, hostLoc, count, transpose, value); -} - -void GL2Encoder::s_glUniformMatrix3fv(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) -{ - GL2Encoder *ctx = (GL2Encoder*)self; - GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentProgram(),location); - ctx->m_glUniformMatrix3fv_enc(self, hostLoc, count, transpose, value); -} - -void GL2Encoder::s_glUniformMatrix4fv(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) -{ - GL2Encoder *ctx = (GL2Encoder*)self; - GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentProgram(),location); - ctx->m_glUniformMatrix4fv_enc(self, hostLoc, count, transpose, value); -} - -void GL2Encoder::s_glActiveTexture(void* self, GLenum texture) -{ - GL2Encoder* ctx = (GL2Encoder*)self; - GLClientState* state = ctx->m_state; - GLenum err; - - SET_ERROR_IF((err = state->setActiveTextureUnit(texture)) != GL_NO_ERROR, err); - - ctx->m_glActiveTexture_enc(ctx, texture); -} - -void GL2Encoder::s_glBindTexture(void* self, GLenum target, GLuint texture) -{ - GL2Encoder* ctx = (GL2Encoder*)self; - GLClientState* state = ctx->m_state; - GLenum err; - GLboolean firstUse; - - SET_ERROR_IF((err = state->bindTexture(target, texture, &firstUse)) != GL_NO_ERROR, err); - - if (target != GL_TEXTURE_2D && target != GL_TEXTURE_EXTERNAL_OES) { - ctx->m_glBindTexture_enc(ctx, target, texture); - return; - } - - GLenum priorityTarget = state->getPriorityEnabledTarget(GL_TEXTURE_2D); - - if (target == GL_TEXTURE_EXTERNAL_OES && firstUse) { - ctx->m_glBindTexture_enc(ctx, GL_TEXTURE_2D, texture); - ctx->m_glTexParameteri_enc(ctx, GL_TEXTURE_2D, - GL_TEXTURE_MIN_FILTER, GL_LINEAR); - ctx->m_glTexParameteri_enc(ctx, GL_TEXTURE_2D, - GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - ctx->m_glTexParameteri_enc(ctx, GL_TEXTURE_2D, - GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - - if (target != priorityTarget) { - ctx->m_glBindTexture_enc(ctx, GL_TEXTURE_2D, - state->getBoundTexture(GL_TEXTURE_2D)); - } - } - - if (target == priorityTarget) { - ctx->m_glBindTexture_enc(ctx, GL_TEXTURE_2D, texture); - } -} - -void GL2Encoder::s_glDeleteTextures(void* self, GLsizei n, const GLuint* textures) -{ - GL2Encoder* ctx = (GL2Encoder*)self; - GLClientState* state = ctx->m_state; - - state->deleteTextures(n, textures); - ctx->m_glDeleteTextures_enc(ctx, n, textures); -} - -void GL2Encoder::s_glGetTexParameterfv(void* self, - GLenum target, GLenum pname, GLfloat* params) -{ - GL2Encoder* ctx = (GL2Encoder*)self; - const GLClientState* state = ctx->m_state; - - if (target == GL_TEXTURE_2D || target == GL_TEXTURE_EXTERNAL_OES) { - ctx->override2DTextureTarget(target); - ctx->m_glGetTexParameterfv_enc(ctx, GL_TEXTURE_2D, pname, params); - ctx->restore2DTextureTarget(); - } else { - ctx->m_glGetTexParameterfv_enc(ctx, target, pname, params); - } -} - -void GL2Encoder::s_glGetTexParameteriv(void* self, - GLenum target, GLenum pname, GLint* params) -{ - GL2Encoder* ctx = (GL2Encoder*)self; - const GLClientState* state = ctx->m_state; - - switch (pname) { - case GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES: - *params = 1; - break; - - default: - if (target == GL_TEXTURE_2D || target == GL_TEXTURE_EXTERNAL_OES) { - ctx->override2DTextureTarget(target); - ctx->m_glGetTexParameteriv_enc(ctx, GL_TEXTURE_2D, pname, params); - ctx->restore2DTextureTarget(); - } else { - ctx->m_glGetTexParameteriv_enc(ctx, target, pname, params); - } - break; - } -} - -static bool isValidTextureExternalParam(GLenum pname, GLenum param) -{ - switch (pname) { - case GL_TEXTURE_MIN_FILTER: - case GL_TEXTURE_MAG_FILTER: - return param == GL_NEAREST || param == GL_LINEAR; - - case GL_TEXTURE_WRAP_S: - case GL_TEXTURE_WRAP_T: - return param == GL_CLAMP_TO_EDGE; - - default: - return true; - } -} - -void GL2Encoder::s_glTexParameterf(void* self, - GLenum target, GLenum pname, GLfloat param) -{ - GL2Encoder* ctx = (GL2Encoder*)self; - const GLClientState* state = ctx->m_state; - - SET_ERROR_IF((target == GL_TEXTURE_EXTERNAL_OES && - !isValidTextureExternalParam(pname, (GLenum)param)), - GL_INVALID_ENUM); - - if (target == GL_TEXTURE_2D || target == GL_TEXTURE_EXTERNAL_OES) { - ctx->override2DTextureTarget(target); - ctx->m_glTexParameterf_enc(ctx, GL_TEXTURE_2D, pname, param); - ctx->restore2DTextureTarget(); - } else { - ctx->m_glTexParameterf_enc(ctx, target, pname, param); - } -} - -void GL2Encoder::s_glTexParameterfv(void* self, - GLenum target, GLenum pname, const GLfloat* params) -{ - GL2Encoder* ctx = (GL2Encoder*)self; - const GLClientState* state = ctx->m_state; - - SET_ERROR_IF((target == GL_TEXTURE_EXTERNAL_OES && - !isValidTextureExternalParam(pname, (GLenum)params[0])), - GL_INVALID_ENUM); - - if (target == GL_TEXTURE_2D || target == GL_TEXTURE_EXTERNAL_OES) { - ctx->override2DTextureTarget(target); - ctx->m_glTexParameterfv_enc(ctx, GL_TEXTURE_2D, pname, params); - ctx->restore2DTextureTarget(); - } else { - ctx->m_glTexParameterfv_enc(ctx, target, pname, params); - } -} - -void GL2Encoder::s_glTexParameteri(void* self, - GLenum target, GLenum pname, GLint param) -{ - GL2Encoder* ctx = (GL2Encoder*)self; - const GLClientState* state = ctx->m_state; - - SET_ERROR_IF((target == GL_TEXTURE_EXTERNAL_OES && - !isValidTextureExternalParam(pname, (GLenum)param)), - GL_INVALID_ENUM); - - if (target == GL_TEXTURE_2D || target == GL_TEXTURE_EXTERNAL_OES) { - ctx->override2DTextureTarget(target); - ctx->m_glTexParameteri_enc(ctx, GL_TEXTURE_2D, pname, param); - ctx->restore2DTextureTarget(); - } else { - ctx->m_glTexParameteri_enc(ctx, target, pname, param); - } -} - -void GL2Encoder::s_glTexParameteriv(void* self, - GLenum target, GLenum pname, const GLint* params) -{ - GL2Encoder* ctx = (GL2Encoder*)self; - const GLClientState* state = ctx->m_state; - - SET_ERROR_IF((target == GL_TEXTURE_EXTERNAL_OES && - !isValidTextureExternalParam(pname, (GLenum)params[0])), - GL_INVALID_ENUM); - - if (target == GL_TEXTURE_2D || target == GL_TEXTURE_EXTERNAL_OES) { - ctx->override2DTextureTarget(target); - ctx->m_glTexParameteriv_enc(ctx, GL_TEXTURE_2D, pname, params); - ctx->restore2DTextureTarget(); - } else { - ctx->m_glTexParameteriv_enc(ctx, target, pname, params); - } -} - -void GL2Encoder::override2DTextureTarget(GLenum target) -{ - if ((target == GL_TEXTURE_2D || target == GL_TEXTURE_EXTERNAL_OES) && - target != m_state->getPriorityEnabledTarget(GL_TEXTURE_2D)) { - m_glBindTexture_enc(this, GL_TEXTURE_2D, - m_state->getBoundTexture(target)); - } -} - -void GL2Encoder::restore2DTextureTarget() -{ - GLenum priorityTarget = m_state->getPriorityEnabledTarget(GL_TEXTURE_2D); - m_glBindTexture_enc(this, GL_TEXTURE_2D, - m_state->getBoundTexture(priorityTarget)); -} diff --git a/emulator/opengl/system/GLESv2_enc/GL2Encoder.h b/emulator/opengl/system/GLESv2_enc/GL2Encoder.h deleted file mode 100644 index f9235d7..0000000 --- a/emulator/opengl/system/GLESv2_enc/GL2Encoder.h +++ /dev/null @@ -1,216 +0,0 @@ -/* -* Copyright (C) 2011 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -#ifndef _GL2_ENCODER_H_ -#define _GL2_ENCODER_H_ - -#include "gl2_enc.h" -#include "GLClientState.h" -#include "GLSharedGroup.h" -#include "FixedBuffer.h" - - -class GL2Encoder : public gl2_encoder_context_t { -public: - GL2Encoder(IOStream *stream); - virtual ~GL2Encoder(); - void setClientState(GLClientState *state) { - m_state = state; - } - void setSharedGroup(GLSharedGroupPtr shared){ m_shared = shared; } - const GLClientState *state() { return m_state; } - const GLSharedGroupPtr shared() { return m_shared; } - void flush() { m_stream->flush(); } - - void setInitialized(){ m_initialized = true; }; - bool isInitialized(){ return m_initialized; }; - - virtual void setError(GLenum error){ m_error = error; }; - virtual GLenum getError() { return m_error; }; - - void override2DTextureTarget(GLenum target); - void restore2DTextureTarget(); - -private: - - bool m_initialized; - GLClientState *m_state; - GLSharedGroupPtr m_shared; - GLenum m_error; - - GLint *m_compressedTextureFormats; - GLint m_num_compressedTextureFormats; - GLint *getCompressedTextureFormats(); - - FixedBuffer m_fixedBuffer; - - void sendVertexAttributes(GLint first, GLsizei count); - bool updateHostTexture2DBinding(GLenum texUnit, GLenum newTarget); - - glGetError_client_proc_t m_glGetError_enc; - static GLenum s_glGetError(void * self); - - glFlush_client_proc_t m_glFlush_enc; - static void s_glFlush(void * self); - - glPixelStorei_client_proc_t m_glPixelStorei_enc; - static void s_glPixelStorei(void *self, GLenum param, GLint value); - - glGetString_client_proc_t m_glGetString_enc; - static const GLubyte * s_glGetString(void *self, GLenum name); - - glBindBuffer_client_proc_t m_glBindBuffer_enc; - static void s_glBindBuffer(void *self, GLenum target, GLuint id); - - - glBufferData_client_proc_t m_glBufferData_enc; - static void s_glBufferData(void *self, GLenum target, GLsizeiptr size, const GLvoid * data, GLenum usage); - glBufferSubData_client_proc_t m_glBufferSubData_enc; - static void s_glBufferSubData(void *self, GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid * data); - glDeleteBuffers_client_proc_t m_glDeleteBuffers_enc; - static void s_glDeleteBuffers(void *self, GLsizei n, const GLuint * buffers); - - glDrawArrays_client_proc_t m_glDrawArrays_enc; - static void s_glDrawArrays(void *self, GLenum mode, GLint first, GLsizei count); - - glDrawElements_client_proc_t m_glDrawElements_enc; - static void s_glDrawElements(void *self, GLenum mode, GLsizei count, GLenum type, const void *indices); - - - glGetIntegerv_client_proc_t m_glGetIntegerv_enc; - static void s_glGetIntegerv(void *self, GLenum pname, GLint *ptr); - - glGetFloatv_client_proc_t m_glGetFloatv_enc; - static void s_glGetFloatv(void *self, GLenum pname, GLfloat *ptr); - - glGetBooleanv_client_proc_t m_glGetBooleanv_enc; - static void s_glGetBooleanv(void *self, GLenum pname, GLboolean *ptr); - - glVertexAttribPointer_client_proc_t m_glVertexAttribPointer_enc; - static void s_glVertexAtrribPointer(void *self, GLuint indx, GLint size, GLenum type, - GLboolean normalized, GLsizei stride, const GLvoid * ptr); - - glEnableVertexAttribArray_client_proc_t m_glEnableVertexAttribArray_enc; - static void s_glEnableVertexAttribArray(void *self, GLuint index); - - glDisableVertexAttribArray_client_proc_t m_glDisableVertexAttribArray_enc; - static void s_glDisableVertexAttribArray(void *self, GLuint index); - - glGetVertexAttribiv_client_proc_t m_glGetVertexAttribiv_enc; - static void s_glGetVertexAttribiv(void *self, GLuint index, GLenum pname, GLint *params); - - glGetVertexAttribfv_client_proc_t m_glGetVertexAttribfv_enc; - static void s_glGetVertexAttribfv(void *self, GLuint index, GLenum pname, GLfloat *params); - - glGetVertexAttribPointerv_client_proc_t m_glGetVertexAttribPointerv; - static void s_glGetVertexAttribPointerv(void *self, GLuint index, GLenum pname, GLvoid **pointer); - - static void s_glShaderSource(void *self, GLuint shader, GLsizei count, const GLchar **string, const GLint *length); - - static void s_glFinish(void *self); - - glLinkProgram_client_proc_t m_glLinkProgram_enc; - static void s_glLinkProgram(void *self, GLuint program); - - glDeleteProgram_client_proc_t m_glDeleteProgram_enc; - static void s_glDeleteProgram(void * self, GLuint program); - - glGetUniformiv_client_proc_t m_glGetUniformiv_enc; - static void s_glGetUniformiv(void *self, GLuint program, GLint location , GLint *params); - - glGetUniformfv_client_proc_t m_glGetUniformfv_enc; - static void s_glGetUniformfv(void *self, GLuint program, GLint location , GLfloat *params); - - glCreateProgram_client_proc_t m_glCreateProgram_enc; - static GLuint s_glCreateProgram(void *self); - - glCreateShader_client_proc_t m_glCreateShader_enc; - static GLuint s_glCreateShader(void *self, GLenum shaderType); - - glDeleteShader_client_proc_t m_glDeleteShader_enc; - static void s_glDeleteShader(void *self, GLuint shader); - - glAttachShader_client_proc_t m_glAttachShader_enc; - static void s_glAttachShader(void *self, GLuint program, GLuint shader); - - glDetachShader_client_proc_t m_glDetachShader_enc; - static void s_glDetachShader(void *self, GLuint program, GLuint shader); - - glGetUniformLocation_client_proc_t m_glGetUniformLocation_enc; - static int s_glGetUniformLocation(void *self, GLuint program, const GLchar *name); - glUseProgram_client_proc_t m_glUseProgram_enc; - - glUniform1f_client_proc_t m_glUniform1f_enc; - glUniform1fv_client_proc_t m_glUniform1fv_enc; - glUniform1i_client_proc_t m_glUniform1i_enc; - glUniform1iv_client_proc_t m_glUniform1iv_enc; - glUniform2f_client_proc_t m_glUniform2f_enc; - glUniform2fv_client_proc_t m_glUniform2fv_enc; - glUniform2i_client_proc_t m_glUniform2i_enc; - glUniform2iv_client_proc_t m_glUniform2iv_enc; - glUniform3f_client_proc_t m_glUniform3f_enc; - glUniform3fv_client_proc_t m_glUniform3fv_enc; - glUniform3i_client_proc_t m_glUniform3i_enc; - glUniform3iv_client_proc_t m_glUniform3iv_enc; - glUniform4f_client_proc_t m_glUniform4f_enc; - glUniform4fv_client_proc_t m_glUniform4fv_enc; - glUniform4i_client_proc_t m_glUniform4i_enc; - glUniform4iv_client_proc_t m_glUniform4iv_enc; - glUniformMatrix2fv_client_proc_t m_glUniformMatrix2fv_enc; - glUniformMatrix3fv_client_proc_t m_glUniformMatrix3fv_enc; - glUniformMatrix4fv_client_proc_t m_glUniformMatrix4fv_enc; - - static void s_glUseProgram(void *self, GLuint program); - static void s_glUniform1f(void *self , GLint location, GLfloat x); - static void s_glUniform1fv(void *self , GLint location, GLsizei count, const GLfloat* v); - static void s_glUniform1i(void *self , GLint location, GLint x); - static void s_glUniform1iv(void *self , GLint location, GLsizei count, const GLint* v); - static void s_glUniform2f(void *self , GLint location, GLfloat x, GLfloat y); - static void s_glUniform2fv(void *self , GLint location, GLsizei count, const GLfloat* v); - static void s_glUniform2i(void *self , GLint location, GLint x, GLint y); - static void s_glUniform2iv(void *self , GLint location, GLsizei count, const GLint* v); - static void s_glUniform3f(void *self , GLint location, GLfloat x, GLfloat y, GLfloat z); - static void s_glUniform3fv(void *self , GLint location, GLsizei count, const GLfloat* v); - static void s_glUniform3i(void *self , GLint location, GLint x, GLint y, GLint z); - static void s_glUniform3iv(void *self , GLint location, GLsizei count, const GLint* v); - static void s_glUniform4f(void *self , GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); - static void s_glUniform4fv(void *self , GLint location, GLsizei count, const GLfloat* v); - static void s_glUniform4i(void *self , GLint location, GLint x, GLint y, GLint z, GLint w); - static void s_glUniform4iv(void *self , GLint location, GLsizei count, const GLint* v); - static void s_glUniformMatrix2fv(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); - static void s_glUniformMatrix3fv(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); - static void s_glUniformMatrix4fv(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); - - glActiveTexture_client_proc_t m_glActiveTexture_enc; - glBindTexture_client_proc_t m_glBindTexture_enc; - glDeleteTextures_client_proc_t m_glDeleteTextures_enc; - glGetTexParameterfv_client_proc_t m_glGetTexParameterfv_enc; - glGetTexParameteriv_client_proc_t m_glGetTexParameteriv_enc; - glTexParameterf_client_proc_t m_glTexParameterf_enc; - glTexParameterfv_client_proc_t m_glTexParameterfv_enc; - glTexParameteri_client_proc_t m_glTexParameteri_enc; - glTexParameteriv_client_proc_t m_glTexParameteriv_enc; - - static void s_glActiveTexture(void* self, GLenum texture); - static void s_glBindTexture(void* self, GLenum target, GLuint texture); - static void s_glDeleteTextures(void* self, GLsizei n, const GLuint* textures); - static void s_glGetTexParameterfv(void* self, GLenum target, GLenum pname, GLfloat* params); - static void s_glGetTexParameteriv(void* self, GLenum target, GLenum pname, GLint* params); - static void s_glTexParameterf(void* self, GLenum target, GLenum pname, GLfloat param); - static void s_glTexParameterfv(void* self, GLenum target, GLenum pname, const GLfloat* params); - static void s_glTexParameteri(void* self, GLenum target, GLenum pname, GLint param); - static void s_glTexParameteriv(void* self, GLenum target, GLenum pname, const GLint* params); -}; -#endif diff --git a/emulator/opengl/system/GLESv2_enc/GL2EncoderUtils.cpp b/emulator/opengl/system/GLESv2_enc/GL2EncoderUtils.cpp deleted file mode 100644 index 57d65c0..0000000 --- a/emulator/opengl/system/GLESv2_enc/GL2EncoderUtils.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* -* Copyright (C) 2011 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -#include <stdio.h> -#include <stdlib.h> -#include "GL2Encoder.h" -#include <assert.h> - -size_t pixelDataSize(void *self, GLsizei width, GLsizei height, GLenum format, GLenum type, int pack) -{ - GL2Encoder *ctx = (GL2Encoder *)self; - assert (ctx->state() != NULL); - return ctx->state()->pixelDataSize(width, height, format, type, pack); -} - -size_t pixelDataSize3D(void *self, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, int pack) -{ - size_t layerSize = pixelDataSize(self, width, height, format, type, pack); - return layerSize * depth; -} - -GLenum uniformType(void * self, GLuint program, GLint location) -{ - GL2Encoder * ctx = (GL2Encoder *) self; - assert (ctx->shared() != NULL); - return ctx->shared()->getProgramUniformType(program, location); -} diff --git a/emulator/opengl/system/GLESv2_enc/GL2EncoderUtils.h b/emulator/opengl/system/GLESv2_enc/GL2EncoderUtils.h deleted file mode 100644 index 8e91aeb..0000000 --- a/emulator/opengl/system/GLESv2_enc/GL2EncoderUtils.h +++ /dev/null @@ -1,24 +0,0 @@ -/* -* Copyright (C) 2011 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -#ifndef GL2_ENCODER_UTILS_H -#define GL2_ENCLODER_UTILS_H - -extern "C" { - size_t pixelDataSize(void *self, GLsizei width, GLsizei height, GLenum format, GLenum type, int pack); - size_t pixelDataSize3D(void *self, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, int pack); - GLenum uniformType(void * self, GLuint program, GLint location); -}; -#endif diff --git a/emulator/opengl/system/OpenglSystemCommon/Android.mk b/emulator/opengl/system/OpenglSystemCommon/Android.mk deleted file mode 100644 index 6198748..0000000 --- a/emulator/opengl/system/OpenglSystemCommon/Android.mk +++ /dev/null @@ -1,13 +0,0 @@ -LOCAL_PATH := $(call my-dir) - -$(call emugl-begin-shared-library,libOpenglSystemCommon) -$(call emugl-import,libGLESv1_enc libGLESv2_enc lib_renderControl_enc) - -LOCAL_SRC_FILES := \ - HostConnection.cpp \ - QemuPipeStream.cpp \ - ThreadInfo.cpp - -$(call emugl-export,C_INCLUDES,$(LOCAL_PATH) bionic/libc/private) - -$(call emugl-end-module) diff --git a/emulator/opengl/system/OpenglSystemCommon/EGLClientIface.h b/emulator/opengl/system/OpenglSystemCommon/EGLClientIface.h deleted file mode 100644 index 3c8cb55..0000000 --- a/emulator/opengl/system/OpenglSystemCommon/EGLClientIface.h +++ /dev/null @@ -1,41 +0,0 @@ -/* -* Copyright 2011 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef _SYSTEM_COMMON_EGL_CLIENT_IFACE_H -#define _SYSTEM_COMMON_EGL_CLIENT_IFACE_H - -struct EGLThreadInfo; // defined in ThreadInfo.h - -typedef struct { - EGLThreadInfo* (*getThreadInfo)(); - const char* (*getGLString)(int glEnum); -} EGLClient_eglInterface; - -typedef struct { - void* (*getProcAddress)(const char *funcName); - void (*init)(); - void (*finish)(); -} EGLClient_glesInterface; - -// -// Any GLES/GLES2 client API library should define a function named "init_emul_gles" -// with the following prototype, -// It will be called by EGL after loading the GLES library for initialization -// and exchanging interface function pointers. -// -typedef EGLClient_glesInterface *(*init_emul_gles_t)(EGLClient_eglInterface *eglIface); - -#endif diff --git a/emulator/opengl/system/OpenglSystemCommon/HostConnection.cpp b/emulator/opengl/system/OpenglSystemCommon/HostConnection.cpp deleted file mode 100644 index 940f5ae..0000000 --- a/emulator/opengl/system/OpenglSystemCommon/HostConnection.cpp +++ /dev/null @@ -1,153 +0,0 @@ -/* -* Copyright (C) 2011 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -#include "HostConnection.h" -#include "TcpStream.h" -#include "QemuPipeStream.h" -#include "ThreadInfo.h" -#include <cutils/log.h> -#include "GLEncoder.h" -#include "GL2Encoder.h" - -#define STREAM_BUFFER_SIZE 4*1024*1024 -#define STREAM_PORT_NUM 22468 - -/* Set to 1 to use a QEMU pipe, or 0 for a TCP connection */ -#define USE_QEMU_PIPE 1 - -HostConnection::HostConnection() : - m_stream(NULL), - m_glEnc(NULL), - m_gl2Enc(NULL), - m_rcEnc(NULL) -{ -} - -HostConnection::~HostConnection() -{ - delete m_stream; - delete m_glEnc; - delete m_gl2Enc; - delete m_rcEnc; -} - -HostConnection *HostConnection::get() -{ - /* TODO: Make this configurable with a system property */ - const int useQemuPipe = USE_QEMU_PIPE; - - // Get thread info - EGLThreadInfo *tinfo = getEGLThreadInfo(); - if (!tinfo) { - return NULL; - } - - if (tinfo->hostConn == NULL) { - HostConnection *con = new HostConnection(); - if (NULL == con) { - return NULL; - } - - if (useQemuPipe) { - QemuPipeStream *stream = new QemuPipeStream(STREAM_BUFFER_SIZE); - if (!stream) { - ALOGE("Failed to create QemuPipeStream for host connection!!!\n"); - delete con; - return NULL; - } - if (stream->connect() < 0) { - ALOGE("Failed to connect to host (QemuPipeStream)!!!\n"); - delete stream; - delete con; - return NULL; - } - con->m_stream = stream; - } - else /* !useQemuPipe */ - { - TcpStream *stream = new TcpStream(STREAM_BUFFER_SIZE); - if (!stream) { - ALOGE("Failed to create TcpStream for host connection!!!\n"); - delete con; - return NULL; - } - - if (stream->connect("10.0.2.2", STREAM_PORT_NUM) < 0) { - ALOGE("Failed to connect to host (TcpStream)!!!\n"); - delete stream; - delete con; - return NULL; - } - con->m_stream = stream; - } - - // send zero 'clientFlags' to the host. - unsigned int *pClientFlags = - (unsigned int *)con->m_stream->allocBuffer(sizeof(unsigned int)); - *pClientFlags = 0; - con->m_stream->commitBuffer(sizeof(unsigned int)); - - ALOGD("HostConnection::get() New Host Connection established %p, tid %d\n", con, gettid()); - tinfo->hostConn = con; - } - - return tinfo->hostConn; -} - -GLEncoder *HostConnection::glEncoder() -{ - if (!m_glEnc) { - m_glEnc = new GLEncoder(m_stream); - DBG("HostConnection::glEncoder new encoder %p, tid %d", m_glEnc, gettid()); - m_glEnc->setContextAccessor(s_getGLContext); - } - return m_glEnc; -} - -GL2Encoder *HostConnection::gl2Encoder() -{ - if (!m_gl2Enc) { - m_gl2Enc = new GL2Encoder(m_stream); - DBG("HostConnection::gl2Encoder new encoder %p, tid %d", m_gl2Enc, gettid()); - m_gl2Enc->setContextAccessor(s_getGL2Context); - } - return m_gl2Enc; -} - -renderControl_encoder_context_t *HostConnection::rcEncoder() -{ - if (!m_rcEnc) { - m_rcEnc = new renderControl_encoder_context_t(m_stream); - } - return m_rcEnc; -} - -gl_client_context_t *HostConnection::s_getGLContext() -{ - EGLThreadInfo *ti = getEGLThreadInfo(); - if (ti->hostConn) { - return ti->hostConn->m_glEnc; - } - return NULL; -} - -gl2_client_context_t *HostConnection::s_getGL2Context() -{ - EGLThreadInfo *ti = getEGLThreadInfo(); - if (ti->hostConn) { - return ti->hostConn->m_gl2Enc; - } - return NULL; -} diff --git a/emulator/opengl/system/OpenglSystemCommon/HostConnection.h b/emulator/opengl/system/OpenglSystemCommon/HostConnection.h deleted file mode 100644 index e7a5ac4..0000000 --- a/emulator/opengl/system/OpenglSystemCommon/HostConnection.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -* Copyright (C) 2011 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -#ifndef __COMMON_HOST_CONNECTION_H -#define __COMMON_HOST_CONNECTION_H - -#include "IOStream.h" -#include "renderControl_enc.h" - -class GLEncoder; -class gl_client_context_t; -class GL2Encoder; -class gl2_client_context_t; - -class HostConnection -{ -public: - static HostConnection *get(); - ~HostConnection(); - - GLEncoder *glEncoder(); - GL2Encoder *gl2Encoder(); - renderControl_encoder_context_t *rcEncoder(); - - void flush() { - if (m_stream) { - m_stream->flush(); - } - } - -private: - HostConnection(); - static gl_client_context_t *s_getGLContext(); - static gl2_client_context_t *s_getGL2Context(); - -private: - IOStream *m_stream; - GLEncoder *m_glEnc; - GL2Encoder *m_gl2Enc; - renderControl_encoder_context_t *m_rcEnc; -}; - -#endif diff --git a/emulator/opengl/system/OpenglSystemCommon/QemuPipeStream.cpp b/emulator/opengl/system/OpenglSystemCommon/QemuPipeStream.cpp deleted file mode 100644 index 50c3d8b..0000000 --- a/emulator/opengl/system/OpenglSystemCommon/QemuPipeStream.cpp +++ /dev/null @@ -1,190 +0,0 @@ -/* -* Copyright (C) 2011 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -#include "QemuPipeStream.h" -#include <hardware/qemu_pipe.h> -#include <errno.h> -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <string.h> - -QemuPipeStream::QemuPipeStream(size_t bufSize) : - IOStream(bufSize), - m_sock(-1), - m_bufsize(bufSize), - m_buf(NULL) -{ -} - -QemuPipeStream::QemuPipeStream(int sock, size_t bufSize) : - IOStream(bufSize), - m_sock(sock), - m_bufsize(bufSize), - m_buf(NULL) -{ -} - -QemuPipeStream::~QemuPipeStream() -{ - if (m_sock >= 0) { - ::close(m_sock); - } - if (m_buf != NULL) { - free(m_buf); - } -} - - -int QemuPipeStream::connect(void) -{ - m_sock = qemu_pipe_open("opengles"); - if (!valid()) return -1; - return 0; -} - -void *QemuPipeStream::allocBuffer(size_t minSize) -{ - size_t allocSize = (m_bufsize < minSize ? minSize : m_bufsize); - if (!m_buf) { - m_buf = (unsigned char *)malloc(allocSize); - } - else if (m_bufsize < allocSize) { - unsigned char *p = (unsigned char *)realloc(m_buf, allocSize); - if (p != NULL) { - m_buf = p; - m_bufsize = allocSize; - } else { - ERR("realloc (%d) failed\n", allocSize); - free(m_buf); - m_buf = NULL; - m_bufsize = 0; - } - } - - return m_buf; -}; - -int QemuPipeStream::commitBuffer(size_t size) -{ - return writeFully(m_buf, size); -} - -int QemuPipeStream::writeFully(const void *buf, size_t len) -{ - //DBG(">> QemuPipeStream::writeFully %d\n", len); - if (!valid()) return -1; - - size_t res = len; - int retval = 0; - - while (res > 0) { - ssize_t stat = ::write(m_sock, (const char *)(buf) + (len - res), res); - if (stat > 0) { - res -= stat; - continue; - } - if (stat == 0) { /* EOF */ - ERR("QemuPipeStream::writeFully failed: premature EOF\n"); - retval = -1; - break; - } - if (errno == EINTR) { - continue; - } - retval = stat; - ERR("QemuPipeStream::writeFully failed: %s\n", strerror(errno)); - break; - } - //DBG("<< QemuPipeStream::writeFully %d\n", len ); - return retval; -} - -const unsigned char *QemuPipeStream::readFully(void *buf, size_t len) -{ - //DBG(">> QemuPipeStream::readFully %d\n", len); - if (!valid()) return NULL; - if (!buf) { - if (len>0) ERR("QemuPipeStream::readFully failed, buf=NULL, len %d", len); - return NULL; // do not allow NULL buf in that implementation - } - size_t res = len; - while (res > 0) { - ssize_t stat = ::read(m_sock, (char *)(buf) + len - res, len); - if (stat == 0) { - // client shutdown; - return NULL; - } else if (stat < 0) { - if (errno == EINTR) { - continue; - } else { - ERR("QemuPipeStream::readFully failed (buf %p): %s\n", - buf, strerror(errno)); - return NULL; - } - } else { - res -= stat; - } - } - //DBG("<< QemuPipeStream::readFully %d\n", len); - return (const unsigned char *)buf; -} - -const unsigned char *QemuPipeStream::read( void *buf, size_t *inout_len) -{ - //DBG(">> QemuPipeStream::read %d\n", *inout_len); - if (!valid()) return NULL; - if (!buf) { - ERR("QemuPipeStream::read failed, buf=NULL"); - return NULL; // do not allow NULL buf in that implementation - } - - int n = recv(buf, *inout_len); - - if (n > 0) { - *inout_len = n; - return (const unsigned char *)buf; - } - - //DBG("<< QemuPipeStream::read %d\n", *inout_len); - return NULL; -} - -int QemuPipeStream::recv(void *buf, size_t len) -{ - if (!valid()) return int(ERR_INVALID_SOCKET); - char* p = (char *)buf; - int ret = 0; - while(len > 0) { - int res = ::read(m_sock, p, len); - if (res > 0) { - p += res; - ret += res; - len -= res; - continue; - } - if (res == 0) { /* EOF */ - break; - } - if (errno == EINTR) - continue; - - /* A real error */ - if (ret == 0) - ret = -1; - break; - } - return ret; -} diff --git a/emulator/opengl/system/OpenglSystemCommon/QemuPipeStream.h b/emulator/opengl/system/OpenglSystemCommon/QemuPipeStream.h deleted file mode 100644 index 57ee399..0000000 --- a/emulator/opengl/system/OpenglSystemCommon/QemuPipeStream.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -* Copyright (C) 2011 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -#ifndef __QEMU_PIPE_STREAM_H -#define __QEMU_PIPE_STREAM_H - -/* This file implements an IOStream that uses a QEMU fast-pipe - * to communicate with the emulator's 'opengles' service. See - * <hardware/qemu_pipe.h> for more details. - */ -#include <stdlib.h> -#include "IOStream.h" - -class QemuPipeStream : public IOStream { -public: - typedef enum { ERR_INVALID_SOCKET = -1000 } QemuPipeStreamError; - - explicit QemuPipeStream(size_t bufsize = 10000); - ~QemuPipeStream(); - int connect(void); - - virtual void *allocBuffer(size_t minSize); - virtual int commitBuffer(size_t size); - virtual const unsigned char *readFully( void *buf, size_t len); - virtual const unsigned char *read( void *buf, size_t *inout_len); - - bool valid() { return m_sock >= 0; } - int recv(void *buf, size_t len); - - virtual int writeFully(const void *buf, size_t len); - -private: - int m_sock; - size_t m_bufsize; - unsigned char *m_buf; - QemuPipeStream(int sock, size_t bufSize); -}; - -#endif diff --git a/emulator/opengl/system/OpenglSystemCommon/ThreadInfo.cpp b/emulator/opengl/system/OpenglSystemCommon/ThreadInfo.cpp deleted file mode 100644 index 75da8f2..0000000 --- a/emulator/opengl/system/OpenglSystemCommon/ThreadInfo.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* -* Copyright (C) 2011 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -#include "ThreadInfo.h" -#include "cutils/threads.h" - -thread_store_t s_tls = THREAD_STORE_INITIALIZER; - -static void tlsDestruct(void *ptr) -{ - if (ptr) { - EGLThreadInfo *ti = (EGLThreadInfo *)ptr; - delete ti->hostConn; - delete ti; - } -} - -EGLThreadInfo *slow_getEGLThreadInfo() -{ - EGLThreadInfo *ti = (EGLThreadInfo *)thread_store_get(&s_tls); - if (ti) return ti; - - ti = new EGLThreadInfo(); - thread_store_set(&s_tls, ti, tlsDestruct); - - return ti; -} diff --git a/emulator/opengl/system/OpenglSystemCommon/ThreadInfo.h b/emulator/opengl/system/OpenglSystemCommon/ThreadInfo.h deleted file mode 100644 index 0328733..0000000 --- a/emulator/opengl/system/OpenglSystemCommon/ThreadInfo.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -* Copyright (C) 2011 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -#ifndef _THREAD_INFO_H -#define _THREAD_INFO_H - -#include "HostConnection.h" -#include <pthread.h> -#ifdef HAVE_ANDROID_OS -#include <bionic_tls.h> -#endif - -struct EGLContext_t; - -struct EGLThreadInfo -{ - EGLThreadInfo() : currentContext(NULL), hostConn(NULL), eglError(EGL_SUCCESS) {} - - EGLContext_t *currentContext; - HostConnection *hostConn; - int eglError; -}; - - -EGLThreadInfo *slow_getEGLThreadInfo(); - -#ifdef HAVE_ANDROID_OS - // We have a dedicated TLS slot in bionic - inline EGLThreadInfo* getEGLThreadInfo() { - EGLThreadInfo *tInfo = - (EGLThreadInfo *)(((unsigned *)__get_tls())[TLS_SLOT_OPENGL]); - if (!tInfo) { - tInfo = slow_getEGLThreadInfo(); - ((uint32_t *)__get_tls())[TLS_SLOT_OPENGL] = (uint32_t)tInfo; - } - return tInfo; - } -#else - inline EGLThreadInfo* getEGLThreadInfo() { - return slow_getEGLThreadInfo(); - } -#endif - - - - -#endif // of _THREAD_INFO_H diff --git a/emulator/opengl/system/OpenglSystemCommon/gralloc_cb.h b/emulator/opengl/system/OpenglSystemCommon/gralloc_cb.h deleted file mode 100644 index e879409..0000000 --- a/emulator/opengl/system/OpenglSystemCommon/gralloc_cb.h +++ /dev/null @@ -1,106 +0,0 @@ -/* -* Copyright 2011 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef __GRALLOC_CB_H__ -#define __GRALLOC_CB_H__ - -#include <hardware/hardware.h> -#include <hardware/gralloc.h> -#include <cutils/native_handle.h> - -#define BUFFER_HANDLE_MAGIC ((int)0xabfabfab) -#define CB_HANDLE_NUM_INTS(nfds) (int)((sizeof(cb_handle_t) - (nfds)*sizeof(int)) / sizeof(int)) - -// -// Our buffer handle structure -// -struct cb_handle_t : public native_handle { - - cb_handle_t(int p_fd, int p_ashmemSize, int p_usage, - int p_width, int p_height, - int p_glFormat, int p_glType) : - fd(p_fd), - magic(BUFFER_HANDLE_MAGIC), - usage(p_usage), - width(p_width), - height(p_height), - glFormat(p_glFormat), - glType(p_glType), - ashmemSize(p_ashmemSize), - ashmemBase(NULL), - ashmemBasePid(0), - mappedPid(0), - lockedLeft(0), - lockedTop(0), - lockedWidth(0), - lockedHeight(0), - hostHandle(0) - { - version = sizeof(native_handle); - numFds = 0; - numInts = CB_HANDLE_NUM_INTS(numFds); - } - - ~cb_handle_t() { - magic = 0; - } - - void setFd(int p_fd) { - if (p_fd >= 0) { - numFds = 1; - } - else { - numFds = 0; - } - fd = p_fd; - numInts = CB_HANDLE_NUM_INTS(numFds); - } - - static bool validate(cb_handle_t * hnd) { - return (hnd && - hnd->version == sizeof(native_handle) && - hnd->magic == BUFFER_HANDLE_MAGIC && - hnd->numInts == CB_HANDLE_NUM_INTS(hnd->numFds)); - } - - bool canBePosted() { - return (0 != (usage & GRALLOC_USAGE_HW_FB)); - } - - // file-descriptors - int fd; // ashmem fd (-1 of ashmem region did not allocated, i.e. no SW access needed) - - // ints - int magic; // magic number in order to validate a pointer to be a cb_handle_t - int usage; // usage bits the buffer was created with - int width; // buffer width - int height; // buffer height - int glFormat; // OpenGL format enum used for host h/w color buffer - int glType; // OpenGL type enum used when uploading to host - int ashmemSize; // ashmem region size for the buffer (0 unless is HW_FB buffer or - // s/w access is needed) - int ashmemBase; // CPU address of the mapped ashmem region - int ashmemBasePid; // process id which mapped the ashmem region - int mappedPid; // process id which succeeded gralloc_register call - int lockedLeft; // region of buffer locked for s/w write - int lockedTop; - int lockedWidth; - int lockedHeight; - uint32_t hostHandle; -}; - - -#endif //__GRALLOC_CB_H__ diff --git a/emulator/opengl/system/egl/Android.mk b/emulator/opengl/system/egl/Android.mk deleted file mode 100644 index b9c9749..0000000 --- a/emulator/opengl/system/egl/Android.mk +++ /dev/null @@ -1,42 +0,0 @@ -ifneq (false,$(BUILD_EMULATOR_OPENGL_DRIVER)) - -LOCAL_PATH := $(call my-dir) - -$(call emugl-begin-shared-library,libEGL_emulation) -$(call emugl-import,libOpenglSystemCommon) -$(call emugl-set-shared-library-subpath,egl) - -LOCAL_CFLAGS += -DLOG_TAG=\"EGL_emulation\" -DEGL_EGLEXT_PROTOTYPES -DWITH_GLES2 - -LOCAL_SRC_FILES := \ - eglDisplay.cpp \ - egl.cpp \ - ClientAPIExts.cpp - -LOCAL_SHARED_LIBRARIES += libdl - -# Used to access the Bionic private OpenGL TLS slot -LOCAL_C_INCLUDES += bionic/libc/private - -$(call emugl-end-module) - -#### egl.cfg #### - -# Ensure that this file is only copied to emulator-specific builds. -# Other builds are device-specific and will provide their own -# version of this file to point to the appropriate HW EGL libraries. -# -ifneq (,$(filter full full_x86 full_mips sdk sdk_x86 sdk_mips google_sdk google_sdk_x86 google_sdk_mips,$(TARGET_PRODUCT))) -include $(CLEAR_VARS) - -LOCAL_MODULE := egl.cfg -LOCAL_SRC_FILES := $(LOCAL_MODULE) - -LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/egl -LOCAL_MODULE_TAGS := debug -LOCAL_MODULE_CLASS := ETC - -include $(BUILD_PREBUILT) -endif # TARGET_PRODUCT in 'full sdk full_x86 full_mips sdk_x86 sdk_mips google_sdk google_sdk_x86 google_sdk_mips) - -endif # BUILD_EMULATOR_OPENGL_DRIVER != false diff --git a/emulator/opengl/system/egl/ClientAPIExts.cpp b/emulator/opengl/system/egl/ClientAPIExts.cpp deleted file mode 100644 index 5e81afe..0000000 --- a/emulator/opengl/system/egl/ClientAPIExts.cpp +++ /dev/null @@ -1,157 +0,0 @@ -/* -* Copyright (C) 2011 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -#include "ClientAPIExts.h" -#include "ThreadInfo.h" -#include <GLES/gl.h> -#include <GLES/glext.h> -#include "eglContext.h" - -namespace ClientAPIExts -{ - -// -// define function pointer type for each extention function -// typename has the form __egl_{funcname}_t -// -#define FUNC_TYPE(fname) __egl_ ## fname ## _t -#define API_ENTRY(fname,params,args) \ - typedef void (GL_APIENTRY *FUNC_TYPE(fname)) params; - -#define API_ENTRY_RET(rtype,fname,params,args) \ - typedef rtype (GL_APIENTRY *FUNC_TYPE(fname)) params; - -#include "ClientAPIExts.in" -#undef API_ENTRY -#undef API_ENTRY_RET - -///// -// Define static table to store the function value for each -// client API. functions pointers will get initialized through -// ClientAPIExts::initClientFuncs function after each client API has been -// loaded. -///// -#define API_ENTRY(fname,params,args) \ - FUNC_TYPE(fname) fname; - -#define API_ENTRY_RET(rtype,fname,params,args) \ - API_ENTRY(fname,params,args) - -static struct _ext_table -{ -#include "ClientAPIExts.in" -} s_client_extensions[2]; - -#undef API_ENTRY -#undef API_ENTRY_RET - -// -// This function initialized each entry in the s_client_extensions -// struct at the givven index using the givven client interface -// -void initClientFuncs(const EGLClient_glesInterface *iface, int idx) -{ -#define API_ENTRY(fname,params,args) \ - s_client_extensions[idx].fname = \ - (FUNC_TYPE(fname))iface->getProcAddress(#fname); - -#define API_ENTRY_RET(rtype,fname,params,args) \ - API_ENTRY(fname,params,args) - - // - // reset all func pointers to NULL - // - memset(&s_client_extensions[idx], 0, sizeof(struct _ext_table)); - - // - // And now query the GLES library for each proc address - // -#include "ClientAPIExts.in" -#undef API_ENTRY -#undef API_ENTRY_RET -} - -// -// Define implementation for each extension function which checks -// the current context version and calls to the correct client API -// function. -// -#define API_ENTRY(fname,params,args) \ - static void _egl_ ## fname params \ - { \ - EGLThreadInfo* thread = getEGLThreadInfo(); \ - if (!thread->currentContext) { \ - return; \ - } \ - int idx = (int)thread->currentContext->version - 1; \ - if (!s_client_extensions[idx].fname) { \ - return; \ - } \ - (*s_client_extensions[idx].fname) args; \ - } - -#define API_ENTRY_RET(rtype,fname,params,args) \ - static rtype _egl_ ## fname params \ - { \ - EGLThreadInfo* thread = getEGLThreadInfo(); \ - if (!thread->currentContext) { \ - return (rtype)0; \ - } \ - int idx = (int)thread->currentContext->version - 1; \ - if (!s_client_extensions[idx].fname) { \ - return (rtype)0; \ - } \ - return (*s_client_extensions[idx].fname) args; \ - } - -#include "ClientAPIExts.in" -#undef API_ENTRY -#undef API_ENTRY_RET - -// -// Define a table to map function names to the local _egl_ version of -// the extension function, to be used in eglGetProcAddress. -// -#define API_ENTRY(fname,params,args) \ - { #fname, (void*)_egl_ ## fname}, -#define API_ENTRY_RET(rtype,fname,params,args) \ - API_ENTRY(fname,params,args) - -static const struct _client_ext_funcs { - const char *fname; - void* proc; -} s_client_ext_funcs[] = { -#include "ClientAPIExts.in" -}; -static const int numExtFuncs = sizeof(s_client_ext_funcs) / - sizeof(s_client_ext_funcs[0]); - -#undef API_ENTRY -#undef API_ENTRY_RET - -// -// returns the __egl_ version of the givven extension function name. -// -void* getProcAddress(const char *fname) -{ - for (int i=0; i<numExtFuncs; i++) { - if (!strcmp(fname, s_client_ext_funcs[i].fname)) { - return s_client_ext_funcs[i].proc; - } - } - return NULL; -} - -} // of namespace ClientAPIExts diff --git a/emulator/opengl/system/egl/ClientAPIExts.h b/emulator/opengl/system/egl/ClientAPIExts.h deleted file mode 100644 index eee9172..0000000 --- a/emulator/opengl/system/egl/ClientAPIExts.h +++ /dev/null @@ -1,29 +0,0 @@ -/* -* Copyright (C) 2011 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -#ifndef _CLIENT_APIS_EXTS_H -#define _CLIENT_APIS_EXTS_H - -#include "EGLClientIface.h" - -namespace ClientAPIExts -{ - -void initClientFuncs(const EGLClient_glesInterface *iface, int idx); -void* getProcAddress(const char *fname); - -} // of namespace ClientAPIExts - -#endif diff --git a/emulator/opengl/system/egl/ClientAPIExts.in b/emulator/opengl/system/egl/ClientAPIExts.in deleted file mode 100644 index 5850701..0000000 --- a/emulator/opengl/system/egl/ClientAPIExts.in +++ /dev/null @@ -1,201 +0,0 @@ -// -// Each extension function should have one of the following -// macro definitions: -// API_ENTRY(funcname, paramlist, arglist) -// -or- (if the function has a return value) -// API_ENTRY_RET(return_type,funcname, paramlist, arglist) -// -API_ENTRY(glEGLImageTargetTexture2DOES, - (GLenum target, GLeglImageOES image), - (target, image)) - -API_ENTRY(glEGLImageTargetRenderbufferStorageOES, - (GLenum target, GLeglImageOES image), - (target, image)) - -API_ENTRY(glBlendEquationSeparateOES, - (GLenum modeRGB, GLenum modeAlpha), - (modeRGB, modeAlpha)) - -API_ENTRY(glBlendFuncSeparateOES, - (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha), - (srcRGB, dstRGB, srcAlpha, dstAlpha)) - -API_ENTRY(glBlendEquationOES, - (GLenum mode), - (mode)) - -API_ENTRY(glCurrentPaletteMatrixOES, - (GLuint matrixpaletteindex), - (matrixpaletteindex)) - -API_ENTRY(glLoadPaletteFromModelViewMatrixOES, - (void), - ()) - -API_ENTRY(glMatrixIndexPointerOES, - (GLint size, GLenum type, GLsizei stride, const GLvoid * pointer), - (size, type, stride, pointer)) - -API_ENTRY(glWeightPointerOES, - (GLint size, GLenum type, GLsizei stride, const GLvoid * pointer), - (size, type, stride, pointer)) - -API_ENTRY(glDepthRangefOES, - (GLclampf zNear, GLclampf zFar), - (zNear, zFar)) - -API_ENTRY(glFrustumfOES, - (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar), - (left, right, bottom, top, zNear, zFar)) - -API_ENTRY(glOrthofOES, - (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar), - (left, right, bottom, top, zNear, zFar)) - -API_ENTRY(glClipPlanefOES, - (GLenum plane, const GLfloat *equation), - (plane, equation)) - -API_ENTRY(glGetClipPlanefOES, - (GLenum pname, GLfloat * eqn), - (pname, eqn)) - -API_ENTRY(glClearDepthfOES, - (GLclampf depth), - (depth)) - -API_ENTRY(glPointSizePointerOES, - (GLenum type, GLsizei stride, const GLvoid *pointer), - (type, stride, pointer)) - -API_ENTRY(glTexGenfOES, - (GLenum coord, GLenum pname, GLfloat param), - (coord, pname, param)) - -API_ENTRY(glTexGenfvOES, - (GLenum coord, GLenum pname, const GLfloat *params), - (coord, pname, params)) - -API_ENTRY(glTexGeniOES, - (GLenum coord, GLenum pname, GLint param), - (coord, pname, param)) - -API_ENTRY(glTexGenivOES, - (GLenum coord, GLenum pname, const GLint *params), - (coord, pname, params)) - -API_ENTRY(glTexGenxOES, - (GLenum coord, GLenum pname, GLfixed param), - (coord, pname, param)) - -API_ENTRY(glTexGenxvOES, - (GLenum coord, GLenum pname, const GLfixed *params), - (coord, pname, params)) - -API_ENTRY(glGetTexGenfvOES, - (GLenum coord, GLenum pname, GLfloat *params), - (coord, pname, params)) - -API_ENTRY(glGetTexGenivOES, - (GLenum coord, GLenum pname, GLint *params), - (coord, pname, params)) - -API_ENTRY(glGetTexGenxvOES, - (GLenum coord, GLenum pname, GLfixed *params), - (coord, pname, params)) - -API_ENTRY_RET(GLboolean, - glIsRenderbufferOES, - (GLuint renderbuffer), - (renderbuffer)) - -API_ENTRY(glBindRenderbufferOES, - (GLenum target, GLuint renderbuffer), - (target, renderbuffer)) - -API_ENTRY(glDeleteRenderbuffersOES, - (GLsizei n, const GLuint* renderbuffers), - (n, renderbuffers)) - -API_ENTRY(glGenRenderbuffersOES, - (GLsizei n, GLuint* renderbuffers), - (n, renderbuffers)) - -API_ENTRY(glRenderbufferStorageOES, - (GLenum target, GLenum internalformat, GLsizei width, GLsizei height), - (target, internalformat, width, height)) - -API_ENTRY(glGetRenderbufferParameterivOES, - (GLenum target, GLenum pname, GLint* params), - (target, pname, params)) - -API_ENTRY_RET(GLboolean, - glIsFramebufferOES, - (GLuint framebuffer), - (framebuffer)) - -API_ENTRY(glBindFramebufferOES, - (GLenum target, GLuint framebuffer), - (target, framebuffer)) - -API_ENTRY(glDeleteFramebuffersOES, - (GLsizei n, const GLuint* framebuffers), - (n, framebuffers)) - -API_ENTRY(glGenFramebuffersOES, - (GLsizei n, GLuint* framebuffers), - (n, framebuffers)) - -API_ENTRY_RET(GLenum, - glCheckFramebufferStatusOES, - (GLenum target), - (target)) - -API_ENTRY(glFramebufferTexture2DOES, - (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level), - (target, attachment, textarget, texture, level)) - -API_ENTRY(glFramebufferRenderbufferOES, - (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer), - (target, attachment, renderbuffertarget, renderbuffer)) - -API_ENTRY(glGetFramebufferAttachmentParameterivOES, - (GLenum target, GLenum attachment, GLenum pname, GLint* params), - (target, attachment, pname, params)) - -API_ENTRY(glGenerateMipmapOES, - (GLenum target), - (target)) - -API_ENTRY(glDrawTexsOES, - (GLshort x, GLshort y, GLshort z, GLshort width, GLshort height), - (x, y, z, width, height)) - -API_ENTRY(glDrawTexiOES, - (GLint x, GLint y, GLint z, GLint width, GLint height), - (x, y, z, width, height)) - -API_ENTRY(glDrawTexfOES, - (GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height), - (x, y, z, width, height)) - -API_ENTRY(glDrawTexxOES, - (GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height), - (x, y, z, width, height)) - -API_ENTRY(glDrawTexsvOES, - (const GLshort *coords), - (coords)) - -API_ENTRY(glDrawTexivOES, - (const GLint *coords), - (coords)) - -API_ENTRY(glDrawTexfvOES, - (const GLfloat *coords), - (coords)) - -API_ENTRY(glDrawTexxvOES, - (const GLfixed *coords), - (coords)) diff --git a/emulator/opengl/system/egl/egl.cfg b/emulator/opengl/system/egl/egl.cfg deleted file mode 100644 index 9d3f2dc..0000000 --- a/emulator/opengl/system/egl/egl.cfg +++ /dev/null @@ -1 +0,0 @@ -0 0 emulation diff --git a/emulator/opengl/system/egl/egl.cpp b/emulator/opengl/system/egl/egl.cpp deleted file mode 100644 index ee195ac..0000000 --- a/emulator/opengl/system/egl/egl.cpp +++ /dev/null @@ -1,1254 +0,0 @@ -/* -* Copyright (C) 2011 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "HostConnection.h" -#include "ThreadInfo.h" -#include "eglDisplay.h" -#include "egl_ftable.h" -#include <cutils/log.h> -#include "gralloc_cb.h" -#include "GLClientState.h" -#include "GLSharedGroup.h" -#include "eglContext.h" -#include "ClientAPIExts.h" - -#include "GLEncoder.h" -#ifdef WITH_GLES2 -#include "GL2Encoder.h" -#endif - -#include <system/window.h> - -template<typename T> -static T setErrorFunc(GLint error, T returnValue) { - getEGLThreadInfo()->eglError = error; - return returnValue; -} - -const char * eglStrError(EGLint err) -{ - switch (err){ - case EGL_SUCCESS: return "EGL_SUCCESS"; - case EGL_NOT_INITIALIZED: return "EGL_NOT_INITIALIZED"; - case EGL_BAD_ACCESS: return "EGL_BAD_ACCESS"; - case EGL_BAD_ALLOC: return "EGL_BAD_ALLOC"; - case EGL_BAD_ATTRIBUTE: return "EGL_BAD_ATTRIBUTE"; - case EGL_BAD_CONFIG: return "EGL_BAD_CONFIG"; - case EGL_BAD_CONTEXT: return "EGL_BAD_CONTEXT"; - case EGL_BAD_CURRENT_SURFACE: return "EGL_BAD_CURRENT_SURFACE"; - case EGL_BAD_DISPLAY: return "EGL_BAD_DISPLAY"; - case EGL_BAD_MATCH: return "EGL_BAD_MATCH"; - case EGL_BAD_NATIVE_PIXMAP: return "EGL_BAD_NATIVE_PIXMAP"; - case EGL_BAD_NATIVE_WINDOW: return "EGL_BAD_NATIVE_WINDOW"; - case EGL_BAD_PARAMETER: return "EGL_BAD_PARAMETER"; - case EGL_BAD_SURFACE: return "EGL_BAD_SURFACE"; - case EGL_CONTEXT_LOST: return "EGL_CONTEXT_LOST"; - default: return "UNKNOWN"; - } -} - -#define LOG_EGL_ERRORS 1 - -#ifdef LOG_EGL_ERRORS - -#define setErrorReturn(error, retVal) \ - { \ - ALOGE("tid %d: %s(%d): error 0x%x (%s)", gettid(), __FUNCTION__, __LINE__, error, eglStrError(error)); \ - return setErrorFunc(error, retVal); \ - } - -#define RETURN_ERROR(ret,err) \ - ALOGE("tid %d: %s(%d): error 0x%x (%s)", gettid(), __FUNCTION__, __LINE__, err, eglStrError(err)); \ - getEGLThreadInfo()->eglError = err; \ - return ret; - -#else //!LOG_EGL_ERRORS - -#define setErrorReturn(error, retVal) return setErrorFunc(error, retVal); - -#define RETURN_ERROR(ret,err) \ - getEGLThreadInfo()->eglError = err; \ - return ret; - -#endif //LOG_EGL_ERRORS - -#define VALIDATE_CONFIG(cfg,ret) \ - if(((int)cfg<0)||((int)cfg>s_display.getNumConfigs())) { \ - RETURN_ERROR(ret,EGL_BAD_CONFIG); \ - } - -#define VALIDATE_DISPLAY(dpy,ret) \ - if ((dpy) != (EGLDisplay)&s_display) { \ - RETURN_ERROR(ret, EGL_BAD_DISPLAY); \ - } - -#define VALIDATE_DISPLAY_INIT(dpy,ret) \ - VALIDATE_DISPLAY(dpy, ret) \ - if (!s_display.initialized()) { \ - RETURN_ERROR(ret, EGL_NOT_INITIALIZED); \ - } - -#define DEFINE_HOST_CONNECTION \ - HostConnection *hostCon = HostConnection::get(); \ - renderControl_encoder_context_t *rcEnc = (hostCon ? hostCon->rcEncoder() : NULL) - -#define DEFINE_AND_VALIDATE_HOST_CONNECTION(ret) \ - HostConnection *hostCon = HostConnection::get(); \ - if (!hostCon) { \ - ALOGE("egl: Failed to get host connection\n"); \ - return ret; \ - } \ - renderControl_encoder_context_t *rcEnc = hostCon->rcEncoder(); \ - if (!rcEnc) { \ - ALOGE("egl: Failed to get renderControl encoder context\n"); \ - return ret; \ - } - -#define VALIDATE_CONTEXT_RETURN(context,ret) \ - if (!context) { \ - RETURN_ERROR(ret,EGL_BAD_CONTEXT); \ - } - -#define VALIDATE_SURFACE_RETURN(surface, ret) \ - if (surface != EGL_NO_SURFACE) { \ - egl_surface_t* s( static_cast<egl_surface_t*>(surface) ); \ - if (s->dpy != (EGLDisplay)&s_display) \ - setErrorReturn(EGL_BAD_DISPLAY, EGL_FALSE); \ - } - - -EGLContext_t::EGLContext_t(EGLDisplay dpy, EGLConfig config, EGLContext_t* shareCtx) : - dpy(dpy), - config(config), - read(EGL_NO_SURFACE), - draw(EGL_NO_SURFACE), - shareCtx(shareCtx), - rcContext(0), - versionString(NULL), - vendorString(NULL), - rendererString(NULL), - extensionString(NULL) -{ - flags = 0; - version = 1; - clientState = new GLClientState(); - if (shareCtx) - sharedGroup = shareCtx->getSharedGroup(); - else - sharedGroup = GLSharedGroupPtr(new GLSharedGroup()); -}; - -EGLContext_t::~EGLContext_t() -{ - delete clientState; - delete [] versionString; - delete [] vendorString; - delete [] rendererString; - delete [] extensionString; -} - -// ---------------------------------------------------------------------------- -//egl_surface_t - -//we don't need to handle depth since it's handled when window created on the host - -struct egl_surface_t { - - EGLDisplay dpy; - EGLConfig config; - - - egl_surface_t(EGLDisplay dpy, EGLConfig config, EGLint surfaceType); - virtual ~egl_surface_t(); - - virtual void setSwapInterval(int interval) = 0; - virtual EGLBoolean swapBuffers() = 0; - - EGLint getSwapBehavior() const; - uint32_t getRcSurface() { return rcSurface; } - EGLint getSurfaceType() { return surfaceType; } - - EGLint getWidth(){ return width; } - EGLint getHeight(){ return height; } - void setTextureFormat(EGLint _texFormat) { texFormat = _texFormat; } - EGLint getTextureFormat() { return texFormat; } - void setTextureTarget(EGLint _texTarget) { texTarget = _texTarget; } - EGLint getTextureTarget() { return texTarget; } - -private: - // - //Surface attributes - // - EGLint width; - EGLint height; - EGLint texFormat; - EGLint texTarget; - -protected: - void setWidth(EGLint w) { width = w; } - void setHeight(EGLint h) { height = h; } - - EGLint surfaceType; - uint32_t rcSurface; //handle to surface created via remote control -}; - -egl_surface_t::egl_surface_t(EGLDisplay dpy, EGLConfig config, EGLint surfaceType) - : dpy(dpy), config(config), surfaceType(surfaceType), rcSurface(0) -{ - width = 0; - height = 0; - texFormat = EGL_NO_TEXTURE; - texTarget = EGL_NO_TEXTURE; -} - -EGLint egl_surface_t::getSwapBehavior() const { - return EGL_BUFFER_PRESERVED; -} - -egl_surface_t::~egl_surface_t() -{ -} - -// ---------------------------------------------------------------------------- -// egl_window_surface_t - -struct egl_window_surface_t : public egl_surface_t { - static egl_window_surface_t* create( - EGLDisplay dpy, EGLConfig config, EGLint surfType, - ANativeWindow* window); - - virtual ~egl_window_surface_t(); - - virtual void setSwapInterval(int interval); - virtual EGLBoolean swapBuffers(); - -private: - egl_window_surface_t( - EGLDisplay dpy, EGLConfig config, EGLint surfType, - ANativeWindow* window); - EGLBoolean init(); - - ANativeWindow* nativeWindow; - android_native_buffer_t* buffer; -}; - -egl_window_surface_t::egl_window_surface_t ( - EGLDisplay dpy, EGLConfig config, EGLint surfType, - ANativeWindow* window) -: egl_surface_t(dpy, config, surfType), - nativeWindow(window), - buffer(NULL) -{ - // keep a reference on the window - nativeWindow->common.incRef(&nativeWindow->common); - EGLint w,h; - nativeWindow->query(nativeWindow, NATIVE_WINDOW_WIDTH, &w); - setWidth(w); - nativeWindow->query(nativeWindow, NATIVE_WINDOW_HEIGHT, &h); - setHeight(h); -} - -EGLBoolean egl_window_surface_t::init() -{ - if (nativeWindow->dequeueBuffer(nativeWindow, &buffer) != NO_ERROR) { - setErrorReturn(EGL_BAD_ALLOC, EGL_FALSE); - } - nativeWindow->lockBuffer(nativeWindow, buffer); - - DEFINE_AND_VALIDATE_HOST_CONNECTION(EGL_FALSE); - rcSurface = rcEnc->rcCreateWindowSurface(rcEnc, (uint32_t)config, - getWidth(), getHeight()); - if (!rcSurface) { - ALOGE("rcCreateWindowSurface returned 0"); - return EGL_FALSE; - } - rcEnc->rcSetWindowColorBuffer(rcEnc, rcSurface, - ((cb_handle_t*)(buffer->handle))->hostHandle); - - return EGL_TRUE; -} - -egl_window_surface_t* egl_window_surface_t::create( - EGLDisplay dpy, EGLConfig config, EGLint surfType, - ANativeWindow* window) -{ - egl_window_surface_t* wnd = new egl_window_surface_t( - dpy, config, surfType, window); - if (wnd && !wnd->init()) { - delete wnd; - wnd = NULL; - } - return wnd; -} - -egl_window_surface_t::~egl_window_surface_t() { - DEFINE_HOST_CONNECTION; - if (rcSurface && rcEnc) { - rcEnc->rcDestroyWindowSurface(rcEnc, rcSurface); - } - if (buffer) { - nativeWindow->cancelBuffer(nativeWindow, buffer); - } - nativeWindow->common.decRef(&nativeWindow->common); -} - -void egl_window_surface_t::setSwapInterval(int interval) -{ - nativeWindow->setSwapInterval(nativeWindow, interval); -} - -EGLBoolean egl_window_surface_t::swapBuffers() -{ - DEFINE_AND_VALIDATE_HOST_CONNECTION(EGL_FALSE); - - rcEnc->rcFlushWindowColorBuffer(rcEnc, rcSurface); - - nativeWindow->queueBuffer(nativeWindow, buffer); - if (nativeWindow->dequeueBuffer(nativeWindow, &buffer)) { - buffer = NULL; - setErrorReturn(EGL_BAD_ALLOC, EGL_FALSE); - } - nativeWindow->lockBuffer(nativeWindow, buffer); - - rcEnc->rcSetWindowColorBuffer(rcEnc, rcSurface, - ((cb_handle_t *)(buffer->handle))->hostHandle); - - return EGL_TRUE; -} - -// ---------------------------------------------------------------------------- -//egl_pbuffer_surface_t - -struct egl_pbuffer_surface_t : public egl_surface_t { - static egl_pbuffer_surface_t* create(EGLDisplay dpy, EGLConfig config, - EGLint surfType, int32_t w, int32_t h, GLenum pixelFormat); - - virtual ~egl_pbuffer_surface_t(); - - virtual void setSwapInterval(int interval) {} - virtual EGLBoolean swapBuffers() { return EGL_TRUE; } - - uint32_t getRcColorBuffer() { return rcColorBuffer; } - -private: - egl_pbuffer_surface_t(EGLDisplay dpy, EGLConfig config, EGLint surfType, - int32_t w, int32_t h); - EGLBoolean init(GLenum format); - - uint32_t rcColorBuffer; -}; - -egl_pbuffer_surface_t::egl_pbuffer_surface_t(EGLDisplay dpy, EGLConfig config, - EGLint surfType, int32_t w, int32_t h) -: egl_surface_t(dpy, config, surfType), - rcColorBuffer(0) -{ - setWidth(w); - setHeight(h); -} - -egl_pbuffer_surface_t::~egl_pbuffer_surface_t() -{ - DEFINE_HOST_CONNECTION; - if (rcEnc) { - if (rcColorBuffer) rcEnc->rcCloseColorBuffer(rcEnc, rcColorBuffer); - if (rcSurface) rcEnc->rcDestroyWindowSurface(rcEnc, rcSurface); - } -} - -EGLBoolean egl_pbuffer_surface_t::init(GLenum pixelFormat) -{ - DEFINE_AND_VALIDATE_HOST_CONNECTION(EGL_FALSE); - - rcSurface = rcEnc->rcCreateWindowSurface(rcEnc, (uint32_t)config, - getWidth(), getHeight()); - if (!rcSurface) { - ALOGE("rcCreateWindowSurface returned 0"); - return EGL_FALSE; - } - - rcColorBuffer = rcEnc->rcCreateColorBuffer(rcEnc, getWidth(), getHeight(), - pixelFormat); - if (!rcColorBuffer) { - ALOGE("rcCreateColorBuffer returned 0"); - return EGL_FALSE; - } - - rcEnc->rcSetWindowColorBuffer(rcEnc, rcSurface, rcColorBuffer); - - return EGL_TRUE; -} - -egl_pbuffer_surface_t* egl_pbuffer_surface_t::create(EGLDisplay dpy, - EGLConfig config, EGLint surfType, int32_t w, int32_t h, - GLenum pixelFormat) -{ - egl_pbuffer_surface_t* pb = new egl_pbuffer_surface_t(dpy, config, surfType, - w, h); - if (pb && !pb->init(pixelFormat)) { - delete pb; - pb = NULL; - } - return pb; -} - -static const char *getGLString(int glEnum) -{ - EGLThreadInfo *tInfo = getEGLThreadInfo(); - if (!tInfo || !tInfo->currentContext) { - return NULL; - } - - const char** strPtr = NULL; - -#define GL_VENDOR 0x1F00 -#define GL_RENDERER 0x1F01 -#define GL_VERSION 0x1F02 -#define GL_EXTENSIONS 0x1F03 - - switch(glEnum) { - case GL_VERSION: - strPtr = &tInfo->currentContext->versionString; - break; - case GL_VENDOR: - strPtr = &tInfo->currentContext->vendorString; - break; - case GL_RENDERER: - strPtr = &tInfo->currentContext->rendererString; - break; - case GL_EXTENSIONS: - strPtr = &tInfo->currentContext->extensionString; - break; - } - - if (!strPtr) { - return NULL; - } - - if (*strPtr != NULL) { - // - // string is already cached - // - return *strPtr; - } - - // - // first query of that string - need to query host - // - DEFINE_AND_VALIDATE_HOST_CONNECTION(NULL); - char *hostStr = NULL; - int n = rcEnc->rcGetGLString(rcEnc, glEnum, NULL, 0); - if (n < 0) { - hostStr = new char[-n+1]; - n = rcEnc->rcGetGLString(rcEnc, glEnum, hostStr, -n); - if (n <= 0) { - delete [] hostStr; - hostStr = NULL; - } - } - - // - // keep the string in the context and return its value - // - *strPtr = hostStr; - return hostStr; -} - -// ---------------------------------------------------------------------------- - -// The one and only supported display object. -static eglDisplay s_display; - -static EGLClient_eglInterface s_eglIface = { - getThreadInfo: getEGLThreadInfo, - getGLString: getGLString -}; - -#define DBG_FUNC DBG("%s\n", __FUNCTION__) -EGLDisplay eglGetDisplay(EGLNativeDisplayType display_id) -{ - // - // we support only EGL_DEFAULT_DISPLAY. - // - if (display_id != EGL_DEFAULT_DISPLAY) { - return EGL_NO_DISPLAY; - } - - return (EGLDisplay)&s_display; -} - -EGLBoolean eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor) -{ - VALIDATE_DISPLAY(dpy,EGL_FALSE); - - if (!s_display.initialize(&s_eglIface)) { - return EGL_FALSE; - } - if (major!=NULL) - *major = s_display.getVersionMajor(); - if (minor!=NULL) - *minor = s_display.getVersionMinor(); - return EGL_TRUE; -} - -EGLBoolean eglTerminate(EGLDisplay dpy) -{ - VALIDATE_DISPLAY_INIT(dpy, EGL_FALSE); - - s_display.terminate(); - return EGL_TRUE; -} - -EGLint eglGetError() -{ - EGLint error = getEGLThreadInfo()->eglError; - getEGLThreadInfo()->eglError = EGL_SUCCESS; - return error; -} - -__eglMustCastToProperFunctionPointerType eglGetProcAddress(const char *procname) -{ - // search in EGL function table - for (int i=0; i<egl_num_funcs; i++) { - if (!strcmp(egl_funcs_by_name[i].name, procname)) { - return (__eglMustCastToProperFunctionPointerType)egl_funcs_by_name[i].proc; - } - } - - // - // Make sure display is initialized before searching in client APIs - // - if (!s_display.initialized()) { - if (!s_display.initialize(&s_eglIface)) { - return NULL; - } - } - - // look in gles client api's extensions table - return (__eglMustCastToProperFunctionPointerType)ClientAPIExts::getProcAddress(procname); - - // Fail - function not found. - return NULL; -} - -const char* eglQueryString(EGLDisplay dpy, EGLint name) -{ - VALIDATE_DISPLAY_INIT(dpy, NULL); - - return s_display.queryString(name); -} - -EGLBoolean eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config) -{ - VALIDATE_DISPLAY_INIT(dpy, NULL); - - if(!num_config) { - RETURN_ERROR(EGL_FALSE,EGL_BAD_PARAMETER); - } - - GLint numConfigs = s_display.getNumConfigs(); - if (!configs) { - *num_config = numConfigs; - return EGL_TRUE; - } - - int i=0; - for (i=0 ; i<numConfigs && i<config_size ; i++) { - *configs++ = (EGLConfig)i; - } - *num_config = i; - return EGL_TRUE; -} - -EGLBoolean eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config) -{ - VALIDATE_DISPLAY_INIT(dpy, EGL_FALSE); - - int attribs_size = 0; - if (attrib_list) { - const EGLint * attrib_p = attrib_list; - while (attrib_p[0] != EGL_NONE) { - attribs_size += 2; - attrib_p += 2; - } - attribs_size++; //for the terminating EGL_NONE - } - - DEFINE_AND_VALIDATE_HOST_CONNECTION(EGL_FALSE); - *num_config = rcEnc->rcChooseConfig(rcEnc, (EGLint*)attrib_list, attribs_size * sizeof(EGLint), (uint32_t*)configs, config_size); - - return EGL_TRUE; -} - -EGLBoolean eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value) -{ - VALIDATE_DISPLAY_INIT(dpy, NULL); - VALIDATE_CONFIG(config, EGL_FALSE); - - if (s_display.getConfigAttrib(config, attribute, value)) - { - return EGL_TRUE; - } - else - { - RETURN_ERROR(EGL_FALSE, EGL_BAD_ATTRIBUTE); - } -} - -EGLSurface eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list) -{ - VALIDATE_DISPLAY_INIT(dpy, NULL); - VALIDATE_CONFIG(config, EGL_FALSE); - if (win == 0) { - setErrorReturn(EGL_BAD_MATCH, EGL_NO_SURFACE); - } - - EGLint surfaceType; - if (s_display.getConfigAttrib(config, EGL_SURFACE_TYPE, &surfaceType) == EGL_FALSE) return EGL_FALSE; - - if (!(surfaceType & EGL_WINDOW_BIT)) { - setErrorReturn(EGL_BAD_MATCH, EGL_NO_SURFACE); - } - - if (static_cast<ANativeWindow*>(win)->common.magic != ANDROID_NATIVE_WINDOW_MAGIC) { - setErrorReturn(EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE); - } - - egl_surface_t* surface = egl_window_surface_t::create( - &s_display, config, surfaceType, static_cast<ANativeWindow*>(win)); - if (!surface) { - setErrorReturn(EGL_BAD_ALLOC, EGL_NO_SURFACE); - } - - return surface; -} - -EGLSurface eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list) -{ - VALIDATE_DISPLAY_INIT(dpy, NULL); - VALIDATE_CONFIG(config, EGL_FALSE); - - EGLint surfaceType; - if (s_display.getConfigAttrib(config, EGL_SURFACE_TYPE, &surfaceType) == EGL_FALSE) return EGL_FALSE; - - if (!(surfaceType & EGL_PBUFFER_BIT)) { - setErrorReturn(EGL_BAD_MATCH, EGL_NO_SURFACE); - } - - int32_t w = 0; - int32_t h = 0; - EGLint texFormat = EGL_NO_TEXTURE; - EGLint texTarget = EGL_NO_TEXTURE; - while (attrib_list[0]) { - switch (attrib_list[0]) { - case EGL_WIDTH: - w = attrib_list[1]; - break; - case EGL_HEIGHT: - h = attrib_list[1]; - break; - case EGL_TEXTURE_FORMAT: - texFormat = attrib_list[1]; - break; - case EGL_TEXTURE_TARGET: - texTarget = attrib_list[1]; - break; - default: - break; - }; - attrib_list+=2; - } - if (((texFormat == EGL_NO_TEXTURE)&&(texTarget != EGL_NO_TEXTURE)) || - ((texFormat != EGL_NO_TEXTURE)&&(texTarget == EGL_NO_TEXTURE))) { - setErrorReturn(EGL_BAD_MATCH, EGL_NO_SURFACE); - } - // TODO: check EGL_TEXTURE_FORMAT - need to support eglBindTexImage - - GLenum pixelFormat; - if (s_display.getConfigGLPixelFormat(config, &pixelFormat) == EGL_FALSE) - setErrorReturn(EGL_BAD_MATCH, EGL_NO_SURFACE); - - egl_surface_t* surface = egl_pbuffer_surface_t::create(dpy, config, - surfaceType, w, h, pixelFormat); - if (!surface) { - setErrorReturn(EGL_BAD_ALLOC, EGL_NO_SURFACE); - } - - //setup attributes - surface->setTextureFormat(texFormat); - surface->setTextureTarget(texTarget); - - return surface; -} - -EGLSurface eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list) -{ - //XXX: Pixmap not supported. The host cannot render to a pixmap resource - // located on host. In order to support Pixmaps we should either punt - // to s/w rendering -or- let the host render to a buffer that will be - // copied back to guest at some sync point. None of those methods not - // implemented and pixmaps are not used with OpenGL anyway ... - return EGL_NO_SURFACE; -} - -EGLBoolean eglDestroySurface(EGLDisplay dpy, EGLSurface eglSurface) -{ - VALIDATE_DISPLAY_INIT(dpy, EGL_FALSE); - VALIDATE_SURFACE_RETURN(eglSurface, EGL_FALSE); - - egl_surface_t* surface(static_cast<egl_surface_t*>(eglSurface)); - delete surface; - - return EGL_TRUE; -} - -EGLBoolean eglQuerySurface(EGLDisplay dpy, EGLSurface eglSurface, EGLint attribute, EGLint *value) -{ - VALIDATE_DISPLAY_INIT(dpy, EGL_FALSE); - VALIDATE_SURFACE_RETURN(eglSurface, EGL_FALSE); - - egl_surface_t* surface( static_cast<egl_surface_t*>(eglSurface) ); - EGLBoolean ret = EGL_TRUE; - switch (attribute) { - case EGL_CONFIG_ID: - ret = s_display.getConfigAttrib(surface->config, EGL_CONFIG_ID, value); - break; - case EGL_WIDTH: - *value = surface->getWidth(); - break; - case EGL_HEIGHT: - *value = surface->getHeight(); - break; - case EGL_TEXTURE_FORMAT: - *value = surface->getTextureFormat(); - break; - case EGL_TEXTURE_TARGET: - *value = surface->getTextureTarget(); - break; - case EGL_SWAP_BEHAVIOR: - *value = surface->getSwapBehavior(); - break; - case EGL_LARGEST_PBUFFER: - // not modified for a window or pixmap surface - // and we ignore it when creating a PBuffer surface (default is EGL_FALSE) - if (surface->getSurfaceType() & EGL_PBUFFER_BIT) *value = EGL_FALSE; - break; - //TODO: complete other attributes - default: - ALOGE("eglQuerySurface %x EGL_BAD_ATTRIBUTE", attribute); - ret = setErrorFunc(EGL_BAD_ATTRIBUTE, EGL_FALSE); - break; - } - - return ret; -} - -EGLBoolean eglBindAPI(EGLenum api) -{ - if (api != EGL_OPENGL_ES_API) - setErrorReturn(EGL_BAD_PARAMETER, EGL_FALSE); - return EGL_TRUE; -} - -EGLenum eglQueryAPI() -{ - return EGL_OPENGL_ES_API; -} - -EGLBoolean eglWaitClient() -{ - return eglWaitGL(); -} - -EGLBoolean eglReleaseThread() -{ - EGLThreadInfo *tInfo = getEGLThreadInfo(); - if (tInfo && tInfo->currentContext) { - return eglMakeCurrent(&s_display, EGL_NO_CONTEXT, EGL_NO_SURFACE, EGL_NO_SURFACE); - } - return EGL_TRUE; -} - -EGLSurface eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list) -{ - //TODO - ALOGW("%s not implemented", __FUNCTION__); - return 0; -} - -EGLBoolean eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value) -{ - //TODO - ALOGW("%s not implemented", __FUNCTION__); - return 0; -} - -EGLBoolean eglBindTexImage(EGLDisplay dpy, EGLSurface eglSurface, EGLint buffer) -{ - VALIDATE_DISPLAY_INIT(dpy, EGL_FALSE); - VALIDATE_SURFACE_RETURN(eglSurface, EGL_FALSE); - if (eglSurface == EGL_NO_SURFACE) { - setErrorReturn(EGL_BAD_SURFACE, EGL_FALSE); - } - - if (buffer != EGL_BACK_BUFFER) { - setErrorReturn(EGL_BAD_PARAMETER, EGL_FALSE); - } - - egl_surface_t* surface( static_cast<egl_surface_t*>(eglSurface) ); - - if (surface->getTextureFormat() == EGL_NO_TEXTURE) { - setErrorReturn(EGL_BAD_MATCH, EGL_FALSE); - } - - if (!(surface->getSurfaceType() & EGL_PBUFFER_BIT)) { - setErrorReturn(EGL_BAD_SURFACE, EGL_FALSE); - } - - //It's now safe to cast to pbuffer surface - egl_pbuffer_surface_t* pbSurface = (egl_pbuffer_surface_t*)surface; - - DEFINE_AND_VALIDATE_HOST_CONNECTION(EGL_FALSE); - rcEnc->rcBindTexture(rcEnc, pbSurface->getRcColorBuffer()); - - return GL_TRUE; -} - -EGLBoolean eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) -{ - //TODO - ALOGW("%s not implemented", __FUNCTION__); - return 0; -} - -EGLBoolean eglSwapInterval(EGLDisplay dpy, EGLint interval) -{ - VALIDATE_DISPLAY_INIT(dpy, EGL_FALSE); - DEFINE_AND_VALIDATE_HOST_CONNECTION(EGL_FALSE); - - EGLContext_t* ctx = getEGLThreadInfo()->currentContext; - if (!ctx) { - setErrorReturn(EGL_BAD_CONTEXT, EGL_FALSE); - } - if (!ctx->draw) { - setErrorReturn(EGL_BAD_SURFACE, EGL_FALSE); - } - egl_surface_t* draw(static_cast<egl_surface_t*>(ctx->draw)); - draw->setSwapInterval(interval); - - rcEnc->rcFBSetSwapInterval(rcEnc, interval); //TODO: implement on the host - - return EGL_TRUE; -} - -EGLContext eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list) -{ - VALIDATE_DISPLAY_INIT(dpy, EGL_NO_CONTEXT); - VALIDATE_CONFIG(config, EGL_NO_CONTEXT); - - EGLint version = 1; //default - while (attrib_list && attrib_list[0]) { - if (attrib_list[0] == EGL_CONTEXT_CLIENT_VERSION) version = attrib_list[1]; - attrib_list+=2; - } - - uint32_t rcShareCtx = 0; - EGLContext_t * shareCtx = NULL; - if (share_context) { - shareCtx = static_cast<EGLContext_t*>(share_context); - rcShareCtx = shareCtx->rcContext; - if (shareCtx->dpy != dpy) - setErrorReturn(EGL_BAD_MATCH, EGL_NO_CONTEXT); - } - - DEFINE_AND_VALIDATE_HOST_CONNECTION(EGL_NO_CONTEXT); - uint32_t rcContext = rcEnc->rcCreateContext(rcEnc, (uint32_t)config, rcShareCtx, version); - if (!rcContext) { - ALOGE("rcCreateContext returned 0"); - setErrorReturn(EGL_BAD_ALLOC, EGL_NO_CONTEXT); - } - - EGLContext_t * context = new EGLContext_t(dpy, config, shareCtx); - if (!context) - setErrorReturn(EGL_BAD_ALLOC, EGL_NO_CONTEXT); - - context->version = version; - context->rcContext = rcContext; - - - return context; -} - -EGLBoolean eglDestroyContext(EGLDisplay dpy, EGLContext ctx) -{ - VALIDATE_DISPLAY_INIT(dpy, EGL_FALSE); - VALIDATE_CONTEXT_RETURN(ctx, EGL_FALSE); - - EGLContext_t * context = static_cast<EGLContext_t*>(ctx); - - if (getEGLThreadInfo()->currentContext == context) - { - eglMakeCurrent(dpy, EGL_NO_CONTEXT, EGL_NO_SURFACE, EGL_NO_SURFACE); - } - - if (context->rcContext) { - DEFINE_AND_VALIDATE_HOST_CONNECTION(EGL_FALSE); - rcEnc->rcDestroyContext(rcEnc, context->rcContext); - context->rcContext = 0; - } - - delete context; - return EGL_TRUE; -} - -EGLBoolean eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx) -{ - VALIDATE_DISPLAY_INIT(dpy, EGL_FALSE); - VALIDATE_SURFACE_RETURN(draw, EGL_FALSE); - VALIDATE_SURFACE_RETURN(read, EGL_FALSE); - - if ((read == EGL_NO_SURFACE && draw == EGL_NO_SURFACE) && (ctx != EGL_NO_CONTEXT)) - setErrorReturn(EGL_BAD_MATCH, EGL_FALSE); - if ((read != EGL_NO_SURFACE || draw != EGL_NO_SURFACE) && (ctx == EGL_NO_CONTEXT)) - setErrorReturn(EGL_BAD_MATCH, EGL_FALSE); - - EGLContext_t * context = static_cast<EGLContext_t*>(ctx); - uint32_t ctxHandle = (context) ? context->rcContext : 0; - egl_surface_t * drawSurf = static_cast<egl_surface_t *>(draw); - uint32_t drawHandle = (drawSurf) ? drawSurf->getRcSurface() : 0; - egl_surface_t * readSurf = static_cast<egl_surface_t *>(read); - uint32_t readHandle = (readSurf) ? readSurf->getRcSurface() : 0; - - // - // Nothing to do if no binding change has made - // - EGLThreadInfo *tInfo = getEGLThreadInfo(); - if (tInfo->currentContext == context && - (context == NULL || - (context && context->draw == draw && context->read == read))) { - return EGL_TRUE; - } - - if (context && (context->flags & EGLContext_t::IS_CURRENT) && (context != tInfo->currentContext)) { - //context is current to another thread - setErrorReturn(EGL_BAD_ACCESS, EGL_FALSE); - } - - DEFINE_AND_VALIDATE_HOST_CONNECTION(EGL_FALSE); - if (rcEnc->rcMakeCurrent(rcEnc, ctxHandle, drawHandle, readHandle) == EGL_FALSE) { - ALOGE("rcMakeCurrent returned EGL_FALSE"); - setErrorReturn(EGL_BAD_CONTEXT, EGL_FALSE); - } - - //Now make the local bind - if (context) { - context->draw = draw; - context->read = read; - context->flags |= EGLContext_t::IS_CURRENT; - //set the client state - if (context->version == 2) { - hostCon->gl2Encoder()->setClientState(context->getClientState()); - hostCon->gl2Encoder()->setSharedGroup(context->getSharedGroup()); - } - else { - hostCon->glEncoder()->setClientState(context->getClientState()); - hostCon->glEncoder()->setSharedGroup(context->getSharedGroup()); - } - } - else { - //release ClientState & SharedGroup - if (tInfo->currentContext->version == 2) { - hostCon->gl2Encoder()->setClientState(NULL); - hostCon->gl2Encoder()->setSharedGroup(GLSharedGroupPtr(NULL)); - } - else { - hostCon->glEncoder()->setClientState(NULL); - hostCon->glEncoder()->setSharedGroup(GLSharedGroupPtr(NULL)); - } - - } - - if (tInfo->currentContext) - tInfo->currentContext->flags &= ~EGLContext_t::IS_CURRENT; - - //Now make current - tInfo->currentContext = context; - - //Check maybe we need to init the encoder, if it's first eglMakeCurrent - if (tInfo->currentContext) { - if (tInfo->currentContext->version == 2) { - if (!hostCon->gl2Encoder()->isInitialized()) { - s_display.gles2_iface()->init(); - hostCon->gl2Encoder()->setInitialized(); - ClientAPIExts::initClientFuncs(s_display.gles2_iface(), 1); - } - } - else { - if (!hostCon->glEncoder()->isInitialized()) { - s_display.gles_iface()->init(); - hostCon->glEncoder()->setInitialized(); - ClientAPIExts::initClientFuncs(s_display.gles_iface(), 0); - } - } - } - - return EGL_TRUE; -} - -EGLContext eglGetCurrentContext() -{ - return getEGLThreadInfo()->currentContext; -} - -EGLSurface eglGetCurrentSurface(EGLint readdraw) -{ - EGLContext_t * context = getEGLThreadInfo()->currentContext; - if (!context) - return EGL_NO_SURFACE; //not an error - - switch (readdraw) { - case EGL_READ: - return context->read; - case EGL_DRAW: - return context->draw; - default: - setErrorReturn(EGL_BAD_PARAMETER, EGL_NO_SURFACE); - } -} - -EGLDisplay eglGetCurrentDisplay() -{ - EGLContext_t * context = getEGLThreadInfo()->currentContext; - if (!context) - return EGL_NO_DISPLAY; //not an error - - return context->dpy; -} - -EGLBoolean eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value) -{ - VALIDATE_DISPLAY_INIT(dpy, EGL_FALSE); - VALIDATE_CONTEXT_RETURN(ctx, EGL_FALSE); - - EGLContext_t * context = static_cast<EGLContext_t*>(ctx); - - EGLBoolean ret = EGL_TRUE; - switch (attribute) { - case EGL_CONFIG_ID: - ret = s_display.getConfigAttrib(context->config, EGL_CONFIG_ID, value); - break; - case EGL_CONTEXT_CLIENT_TYPE: - *value = EGL_OPENGL_ES_API; - break; - case EGL_CONTEXT_CLIENT_VERSION: - *value = context->version; - break; - case EGL_RENDER_BUFFER: - if (!context->draw) - *value = EGL_NONE; - else - *value = EGL_BACK_BUFFER; //single buffer not supported - break; - default: - ALOGE("eglQueryContext %x EGL_BAD_ATTRIBUTE", attribute); - setErrorReturn(EGL_BAD_ATTRIBUTE, EGL_FALSE); - break; - } - - return ret; -} - -EGLBoolean eglWaitGL() -{ - EGLThreadInfo *tInfo = getEGLThreadInfo(); - if (!tInfo || !tInfo->currentContext) { - return EGL_FALSE; - } - - if (tInfo->currentContext->version == 2) { - s_display.gles2_iface()->finish(); - } - else { - s_display.gles_iface()->finish(); - } - - return EGL_TRUE; -} - -EGLBoolean eglWaitNative(EGLint engine) -{ - return EGL_TRUE; -} - -EGLBoolean eglSwapBuffers(EGLDisplay dpy, EGLSurface eglSurface) -{ - VALIDATE_DISPLAY_INIT(dpy, EGL_FALSE); - if (eglSurface == EGL_NO_SURFACE) - setErrorReturn(EGL_BAD_SURFACE, EGL_FALSE); - - DEFINE_AND_VALIDATE_HOST_CONNECTION(EGL_FALSE); - - egl_surface_t* d = static_cast<egl_surface_t*>(eglSurface); - if (d->dpy != dpy) - setErrorReturn(EGL_BAD_DISPLAY, EGL_FALSE); - - // post the surface - d->swapBuffers(); - - hostCon->flush(); - return EGL_TRUE; -} - -EGLBoolean eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target) -{ - //TODO :later - return 0; -} - -EGLBoolean eglLockSurfaceKHR(EGLDisplay display, EGLSurface surface, const EGLint *attrib_list) -{ - //TODO later - return 0; -} - -EGLBoolean eglUnlockSurfaceKHR(EGLDisplay display, EGLSurface surface) -{ - //TODO later - return 0; -} - -EGLImageKHR eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list) -{ - VALIDATE_DISPLAY_INIT(dpy, EGL_NO_IMAGE_KHR); - if (ctx != EGL_NO_CONTEXT) { - setErrorReturn(EGL_BAD_CONTEXT, EGL_NO_IMAGE_KHR); - } - if (target != EGL_NATIVE_BUFFER_ANDROID) { - setErrorReturn(EGL_BAD_PARAMETER, EGL_NO_IMAGE_KHR); - } - - android_native_buffer_t* native_buffer = (android_native_buffer_t*)buffer; - - if (native_buffer->common.magic != ANDROID_NATIVE_BUFFER_MAGIC) - setErrorReturn(EGL_BAD_PARAMETER, EGL_NO_IMAGE_KHR); - - if (native_buffer->common.version != sizeof(android_native_buffer_t)) - setErrorReturn(EGL_BAD_PARAMETER, EGL_NO_IMAGE_KHR); - - switch (native_buffer->format) { - case HAL_PIXEL_FORMAT_RGBA_8888: - case HAL_PIXEL_FORMAT_RGBX_8888: - case HAL_PIXEL_FORMAT_RGB_888: - case HAL_PIXEL_FORMAT_RGB_565: - case HAL_PIXEL_FORMAT_BGRA_8888: - case HAL_PIXEL_FORMAT_RGBA_5551: - case HAL_PIXEL_FORMAT_RGBA_4444: - break; - default: - setErrorReturn(EGL_BAD_PARAMETER, EGL_NO_IMAGE_KHR); - } - - native_buffer->common.incRef(&native_buffer->common); - return (EGLImageKHR)native_buffer; -} - -EGLBoolean eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR img) -{ - VALIDATE_DISPLAY_INIT(dpy, EGL_FALSE); - android_native_buffer_t* native_buffer = (android_native_buffer_t*)img; - - if (native_buffer->common.magic != ANDROID_NATIVE_BUFFER_MAGIC) - setErrorReturn(EGL_BAD_PARAMETER, EGL_FALSE); - - if (native_buffer->common.version != sizeof(android_native_buffer_t)) - setErrorReturn(EGL_BAD_PARAMETER, EGL_FALSE); - - native_buffer->common.decRef(&native_buffer->common); - - return EGL_TRUE; -} - -#define FENCE_SYNC_HANDLE (EGLSyncKHR)0xFE4CE - -EGLSyncKHR eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, - const EGLint *attrib_list) -{ - // TODO: This implementation could be faster. We should require the host EGL - // to support KHR_fence_sync, or at least pipe the fence command to the host - // and wait for it (probably involving a glFinish on the host) in - // eglClientWaitSyncKHR. - - VALIDATE_DISPLAY(dpy, EGL_NO_SYNC_KHR); - - if (type != EGL_SYNC_FENCE_KHR || - (attrib_list != NULL && attrib_list[0] != EGL_NONE)) { - setErrorReturn(EGL_BAD_ATTRIBUTE, EGL_NO_SYNC_KHR); - } - - EGLThreadInfo *tInfo = getEGLThreadInfo(); - if (!tInfo || !tInfo->currentContext) { - setErrorReturn(EGL_BAD_MATCH, EGL_NO_SYNC_KHR); - } - - if (tInfo->currentContext->version == 2) { - s_display.gles2_iface()->finish(); - } else { - s_display.gles_iface()->finish(); - } - - return FENCE_SYNC_HANDLE; -} - -EGLBoolean eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync) -{ - if (sync != FENCE_SYNC_HANDLE) { - setErrorReturn(EGL_BAD_PARAMETER, EGL_FALSE); - } - - return EGL_TRUE; -} - -EGLint eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, - EGLTimeKHR timeout) -{ - if (sync != FENCE_SYNC_HANDLE) { - setErrorReturn(EGL_BAD_PARAMETER, EGL_FALSE); - } - - return EGL_CONDITION_SATISFIED_KHR; -} - -EGLBoolean eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, - EGLint attribute, EGLint *value) -{ - if (sync != FENCE_SYNC_HANDLE) { - setErrorReturn(EGL_BAD_PARAMETER, EGL_FALSE); - } - - switch (attribute) { - case EGL_SYNC_TYPE_KHR: - *value = EGL_SYNC_FENCE_KHR; - return EGL_TRUE; - case EGL_SYNC_STATUS_KHR: - *value = EGL_SIGNALED_KHR; - return EGL_TRUE; - case EGL_SYNC_CONDITION_KHR: - *value = EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR; - return EGL_TRUE; - default: - setErrorReturn(EGL_BAD_ATTRIBUTE, EGL_FALSE); - } -} diff --git a/emulator/opengl/system/egl/eglContext.h b/emulator/opengl/system/egl/eglContext.h deleted file mode 100644 index 2ca6d0c..0000000 --- a/emulator/opengl/system/egl/eglContext.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -* Copyright (C) 2011 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -#ifndef _EGL_CONTEXT_H -#define _EGL_CONTEXT_H - -#include "GLClientState.h" -#include "GLSharedGroup.h" - -struct EGLContext_t { - - enum { - IS_CURRENT = 0x00010000, - NEVER_CURRENT = 0x00020000 - }; - - EGLContext_t(EGLDisplay dpy, EGLConfig config, EGLContext_t* shareCtx); - ~EGLContext_t(); - uint32_t flags; - EGLDisplay dpy; - EGLConfig config; - EGLSurface read; - EGLSurface draw; - EGLContext_t * shareCtx; - EGLint version; - uint32_t rcContext; - const char* versionString; - const char* vendorString; - const char* rendererString; - const char* extensionString; - - GLClientState * getClientState(){ return clientState; } - GLSharedGroupPtr getSharedGroup(){ return sharedGroup; } -private: - GLClientState * clientState; - GLSharedGroupPtr sharedGroup; -}; - -#endif diff --git a/emulator/opengl/system/egl/eglDisplay.cpp b/emulator/opengl/system/egl/eglDisplay.cpp deleted file mode 100644 index bcb0d4b..0000000 --- a/emulator/opengl/system/egl/eglDisplay.cpp +++ /dev/null @@ -1,497 +0,0 @@ -/* -* Copyright (C) 2011 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -#include "eglDisplay.h" -#include "HostConnection.h" -#include <dlfcn.h> - -static const int systemEGLVersionMajor = 1; -static const int systemEGLVersionMinor = 4; -static const char systemEGLVendor[] = "Google Android emulator"; - -// list of extensions supported by this EGL implementation -// NOTE that each extension name should be suffixed with space -static const char systemStaticEGLExtensions[] = - "EGL_ANDROID_image_native_buffer " - "EGL_KHR_fence_sync "; - -// list of extensions supported by this EGL implementation only if supported -// on the host implementation. -// NOTE that each extension name should be suffixed with space -static const char systemDynamicEGLExtensions[] = - "EGL_KHR_image_base " - "EGL_KHR_gl_texture_2d_image "; - - -static void *s_gles_lib = NULL; -static void *s_gles2_lib = NULL; - -// The following function will be called when we (libEGL) -// gets unloaded -// At this point we want to unload the gles libraries we -// might have loaded during initialization -static void __attribute__ ((destructor)) do_on_unload(void) -{ - if (s_gles_lib) { - dlclose(s_gles_lib); - } - - if (s_gles2_lib) { - dlclose(s_gles2_lib); - } -} - -eglDisplay::eglDisplay() : - m_initialized(false), - m_major(0), - m_minor(0), - m_hostRendererVersion(0), - m_numConfigs(0), - m_numConfigAttribs(0), - m_attribs(DefaultKeyedVector<EGLint, EGLint>(ATTRIBUTE_NONE)), - m_configs(NULL), - m_gles_iface(NULL), - m_gles2_iface(NULL), - m_versionString(NULL), - m_vendorString(NULL), - m_extensionString(NULL) -{ - pthread_mutex_init(&m_lock, NULL); -} - -eglDisplay::~eglDisplay() -{ - pthread_mutex_destroy(&m_lock); -} - -bool eglDisplay::initialize(EGLClient_eglInterface *eglIface) -{ - pthread_mutex_lock(&m_lock); - if (!m_initialized) { - - // - // load GLES client API - // - m_gles_iface = loadGLESClientAPI("/system/lib/egl/libGLESv1_CM_emulation.so", - eglIface, - &s_gles_lib); - if (!m_gles_iface) { - pthread_mutex_unlock(&m_lock); - ALOGE("Failed to load gles1 iface"); - return false; - } - -#ifdef WITH_GLES2 - m_gles2_iface = loadGLESClientAPI("/system/lib/egl/libGLESv2_emulation.so", - eglIface, - &s_gles2_lib); - // Note that if loading gles2 failed, we can still run with no - // GLES2 support, having GLES2 is not mandatory. -#endif - - // - // establish connection with the host - // - HostConnection *hcon = HostConnection::get(); - if (!hcon) { - pthread_mutex_unlock(&m_lock); - ALOGE("Failed to establish connection with the host\n"); - return false; - } - - // - // get renderControl encoder instance - // - renderControl_encoder_context_t *rcEnc = hcon->rcEncoder(); - if (!rcEnc) { - pthread_mutex_unlock(&m_lock); - ALOGE("Failed to get renderControl encoder instance"); - return false; - } - - // - // Query host reneder and EGL version - // - m_hostRendererVersion = rcEnc->rcGetRendererVersion(rcEnc); - EGLint status = rcEnc->rcGetEGLVersion(rcEnc, &m_major, &m_minor); - if (status != EGL_TRUE) { - // host EGL initialization failed !! - pthread_mutex_unlock(&m_lock); - return false; - } - - // - // Take minimum version beween what we support and what the host support - // - if (m_major > systemEGLVersionMajor) { - m_major = systemEGLVersionMajor; - m_minor = systemEGLVersionMinor; - } - else if (m_major == systemEGLVersionMajor && - m_minor > systemEGLVersionMinor) { - m_minor = systemEGLVersionMinor; - } - - // - // Query the host for the set of configs - // - m_numConfigs = rcEnc->rcGetNumConfigs(rcEnc, (uint32_t*)&m_numConfigAttribs); - if (m_numConfigs <= 0 || m_numConfigAttribs <= 0) { - // just sanity check - should never happen - pthread_mutex_unlock(&m_lock); - return false; - } - - uint32_t nInts = m_numConfigAttribs * (m_numConfigs + 1); - EGLint tmp_buf[nInts]; - m_configs = new EGLint[nInts-m_numConfigAttribs]; - if (!m_configs) { - pthread_mutex_unlock(&m_lock); - return false; - } - - //EGLint n = rcEnc->rcGetConfigs(rcEnc, nInts*sizeof(EGLint), m_configs); - EGLint n = rcEnc->rcGetConfigs(rcEnc, nInts*sizeof(EGLint), (GLuint*)tmp_buf); - if (n != m_numConfigs) { - pthread_mutex_unlock(&m_lock); - return false; - } - - //Fill the attributes vector. - //The first m_numConfigAttribs values of tmp_buf are the actual attributes enums. - for (int i=0; i<m_numConfigAttribs; i++) { - m_attribs.add(tmp_buf[i], i); - } - - //Copy the actual configs data to m_configs - memcpy(m_configs, tmp_buf + m_numConfigAttribs, m_numConfigs*m_numConfigAttribs*sizeof(EGLint)); - - m_initialized = true; - } - pthread_mutex_unlock(&m_lock); - - processConfigs(); - - return true; -} - -void eglDisplay::processConfigs() -{ - for (int i=0; i<m_numConfigs; i++) { - EGLConfig config = (EGLConfig)i; - //Setup the EGL_NATIVE_VISUAL_ID attribute - PixelFormat format; - if (getConfigNativePixelFormat(config, &format)) { - setConfigAttrib(config, EGL_NATIVE_VISUAL_ID, format); - } - } -} - -void eglDisplay::terminate() -{ - pthread_mutex_lock(&m_lock); - if (m_initialized) { - m_initialized = false; - delete [] m_configs; - m_configs = NULL; - - if (m_versionString) { - free(m_versionString); - m_versionString = NULL; - } - if (m_vendorString) { - free(m_vendorString); - m_vendorString = NULL; - } - if (m_extensionString) { - free(m_extensionString); - m_extensionString = NULL; - } - } - pthread_mutex_unlock(&m_lock); -} - -EGLClient_glesInterface *eglDisplay::loadGLESClientAPI(const char *libName, - EGLClient_eglInterface *eglIface, - void **libHandle) -{ - void *lib = dlopen(libName, RTLD_NOW); - if (!lib) { - ALOGE("Failed to dlopen %s", libName); - return NULL; - } - - init_emul_gles_t init_gles_func = (init_emul_gles_t)dlsym(lib,"init_emul_gles"); - if (!init_gles_func) { - ALOGE("Failed to find init_emul_gles"); - dlclose((void*)lib); - return NULL; - } - - *libHandle = lib; - return (*init_gles_func)(eglIface); -} - -static char *queryHostEGLString(EGLint name) -{ - HostConnection *hcon = HostConnection::get(); - if (hcon) { - renderControl_encoder_context_t *rcEnc = hcon->rcEncoder(); - if (rcEnc) { - int n = rcEnc->rcQueryEGLString(rcEnc, name, NULL, 0); - if (n < 0) { - // allocate space for the string with additional - // space charachter to be suffixed at the end. - char *str = (char *)malloc(-n+2); - n = rcEnc->rcQueryEGLString(rcEnc, name, str, -n); - if (n > 0) { - // add extra space at end of string which will be - // needed later when filtering the extension list. - strcat(str, " "); - return str; - } - - free(str); - } - } - } - - return NULL; -} - -static bool findExtInList(const char* token, int tokenlen, const char* list) -{ - const char* p = list; - while (*p != '\0') { - const char* q = strchr(p, ' '); - if (q == NULL) { - /* should not happen, list must be space-terminated */ - break; - } - if (tokenlen == (q - p) && !memcmp(token, p, tokenlen)) { - return true; /* found it */ - } - p = q+1; - } - return false; /* not found */ -} - -static char *buildExtensionString() -{ - //Query host extension string - char *hostExt = queryHostEGLString(EGL_EXTENSIONS); - if (!hostExt || (hostExt[1] == '\0')) { - // no extensions on host - only static extension list supported - return strdup(systemStaticEGLExtensions); - } - - // - // Filter host extension list to include only extensions - // we can support (in the systemDynamicEGLExtensions list) - // - char *ext = (char *)hostExt; - char *c = ext; - char *insert = ext; - while(*c != '\0') { - if (*c == ' ') { - int len = c - ext; - if (findExtInList(ext, len, systemDynamicEGLExtensions)) { - if (ext != insert) { - memcpy(insert, ext, len+1); // including space - } - insert += (len + 1); - } - ext = c + 1; - } - c++; - } - *insert = '\0'; - - int n = strlen(hostExt); - if (n > 0) { - char *str; - asprintf(&str,"%s%s", systemStaticEGLExtensions, hostExt); - free((char*)hostExt); - return str; - } - else { - free((char*)hostExt); - return strdup(systemStaticEGLExtensions); - } -} - -const char *eglDisplay::queryString(EGLint name) -{ - if (name == EGL_CLIENT_APIS) { - return "OpenGL_ES"; - } - else if (name == EGL_VERSION) { - pthread_mutex_lock(&m_lock); - if (m_versionString) { - pthread_mutex_unlock(&m_lock); - return m_versionString; - } - - // build version string - asprintf(&m_versionString, "%d.%d", m_major, m_minor); - pthread_mutex_unlock(&m_lock); - - return m_versionString; - } - else if (name == EGL_VENDOR) { - pthread_mutex_lock(&m_lock); - if (m_vendorString) { - pthread_mutex_unlock(&m_lock); - return m_vendorString; - } - - // build vendor string - const char *hostVendor = queryHostEGLString(EGL_VENDOR); - - if (hostVendor) { - asprintf(&m_vendorString, "%s Host: %s", - systemEGLVendor, hostVendor); - free((char*)hostVendor); - } - else { - m_vendorString = (char *)systemEGLVendor; - } - pthread_mutex_unlock(&m_lock); - - return m_vendorString; - } - else if (name == EGL_EXTENSIONS) { - pthread_mutex_lock(&m_lock); - if (m_extensionString) { - pthread_mutex_unlock(&m_lock); - return m_extensionString; - } - - // build extension string - m_extensionString = buildExtensionString(); - pthread_mutex_unlock(&m_lock); - - return m_extensionString; - } - else { - ALOGE("[%s] Unknown name %d\n", __FUNCTION__, name); - return NULL; - } -} - -/* To get the value of attribute <a> of config <c> use the following formula: - * value = *(m_configs + (int)c*m_numConfigAttribs + a); - */ -EGLBoolean eglDisplay::getAttribValue(EGLConfig config, EGLint attribIdx, EGLint * value) -{ - if (attribIdx == ATTRIBUTE_NONE) - { - ALOGE("[%s] Bad attribute idx\n", __FUNCTION__); - return EGL_FALSE; - } - *value = *(m_configs + (int)config*m_numConfigAttribs + attribIdx); - return EGL_TRUE; -} - -EGLBoolean eglDisplay::getConfigAttrib(EGLConfig config, EGLint attrib, EGLint * value) -{ - //Though it seems that valueFor() is thread-safe, we don't take chanses - pthread_mutex_lock(&m_lock); - EGLBoolean ret = getAttribValue(config, m_attribs.valueFor(attrib), value); - pthread_mutex_unlock(&m_lock); - return ret; -} - -void eglDisplay::dumpConfig(EGLConfig config) -{ - EGLint value = 0; - DBG("^^^^^^^^^^ dumpConfig %d ^^^^^^^^^^^^^^^^^^", (int)config); - for (int i=0; i<m_numConfigAttribs; i++) { - getAttribValue(config, i, &value); - DBG("{%d}[%d] %d\n", (int)config, i, value); - } -} - -/* To set the value of attribute <a> of config <c> use the following formula: - * *(m_configs + (int)c*m_numConfigAttribs + a) = value; - */ -EGLBoolean eglDisplay::setAttribValue(EGLConfig config, EGLint attribIdx, EGLint value) -{ - if (attribIdx == ATTRIBUTE_NONE) - { - ALOGE("[%s] Bad attribute idx\n", __FUNCTION__); - return EGL_FALSE; - } - *(m_configs + (int)config*m_numConfigAttribs + attribIdx) = value; - return EGL_TRUE; -} - -EGLBoolean eglDisplay::setConfigAttrib(EGLConfig config, EGLint attrib, EGLint value) -{ - //Though it seems that valueFor() is thread-safe, we don't take chanses - pthread_mutex_lock(&m_lock); - EGLBoolean ret = setAttribValue(config, m_attribs.valueFor(attrib), value); - pthread_mutex_unlock(&m_lock); - return ret; -} - - -EGLBoolean eglDisplay::getConfigNativePixelFormat(EGLConfig config, PixelFormat * format) -{ - EGLint redSize, blueSize, greenSize, alphaSize; - - if ( !(getAttribValue(config, m_attribs.valueFor(EGL_RED_SIZE), &redSize) && - getAttribValue(config, m_attribs.valueFor(EGL_BLUE_SIZE), &blueSize) && - getAttribValue(config, m_attribs.valueFor(EGL_GREEN_SIZE), &greenSize) && - getAttribValue(config, m_attribs.valueFor(EGL_ALPHA_SIZE), &alphaSize)) ) - { - ALOGE("Couldn't find value for one of the pixel format attributes"); - return EGL_FALSE; - } - - //calculate the GL internal format - if ((redSize==8)&&(greenSize==8)&&(blueSize==8)&&(alphaSize==8)) *format = PIXEL_FORMAT_RGBA_8888; //XXX: BGR? - else if ((redSize==8)&&(greenSize==8)&&(blueSize==8)&&(alphaSize==0)) *format = PIXEL_FORMAT_RGBX_8888; //XXX or PIXEL_FORMAT_RGB_888 - else if ((redSize==5)&&(greenSize==6)&&(blueSize==5)&&(alphaSize==0)) *format = PIXEL_FORMAT_RGB_565; - else if ((redSize==5)&&(greenSize==5)&&(blueSize==5)&&(alphaSize==1)) *format = PIXEL_FORMAT_RGBA_5551; - else if ((redSize==4)&&(greenSize==4)&&(blueSize==4)&&(alphaSize==4)) *format = PIXEL_FORMAT_RGBA_4444; - else { - return EGL_FALSE; - } - return EGL_TRUE; -} -EGLBoolean eglDisplay::getConfigGLPixelFormat(EGLConfig config, GLenum * format) -{ - EGLint redSize, blueSize, greenSize, alphaSize; - - if ( !(getAttribValue(config, m_attribs.valueFor(EGL_RED_SIZE), &redSize) && - getAttribValue(config, m_attribs.valueFor(EGL_BLUE_SIZE), &blueSize) && - getAttribValue(config, m_attribs.valueFor(EGL_GREEN_SIZE), &greenSize) && - getAttribValue(config, m_attribs.valueFor(EGL_ALPHA_SIZE), &alphaSize)) ) - { - ALOGE("Couldn't find value for one of the pixel format attributes"); - return EGL_FALSE; - } - - //calculate the GL internal format - if ((redSize==8)&&(blueSize==8)&&(blueSize==8)&&(alphaSize==8)) *format = GL_RGBA; - else if ((redSize==8)&&(greenSize==8)&&(blueSize==8)&&(alphaSize==0)) *format = GL_RGB; - else if ((redSize==5)&&(greenSize==6)&&(blueSize==5)&&(alphaSize==0)) *format = GL_RGB565_OES; - else if ((redSize==5)&&(greenSize==5)&&(blueSize==5)&&(alphaSize==1)) *format = GL_RGB5_A1_OES; - else if ((redSize==4)&&(greenSize==4)&&(blueSize==4)&&(alphaSize==4)) *format = GL_RGBA4_OES; - else return EGL_FALSE; - - return EGL_TRUE; -} diff --git a/emulator/opengl/system/egl/eglDisplay.h b/emulator/opengl/system/egl/eglDisplay.h deleted file mode 100644 index 9d979d9..0000000 --- a/emulator/opengl/system/egl/eglDisplay.h +++ /dev/null @@ -1,89 +0,0 @@ -/* -* Copyright (C) 2011 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -#ifndef _SYSTEM_EGL_DISPLAY_H -#define _SYSTEM_EGL_DISPLAY_H - -#include <pthread.h> -#include "glUtils.h" -#include <EGL/egl.h> -#include <EGL/eglext.h> -#include "EGLClientIface.h" -#include <utils/KeyedVector.h> - -#include <ui/PixelFormat.h> - -#define ATTRIBUTE_NONE -1 -//FIXME: are we in this namespace? -using namespace android; - -class eglDisplay -{ -public: - eglDisplay(); - ~eglDisplay(); - - bool initialize(EGLClient_eglInterface *eglIface); - void terminate(); - - int getVersionMajor() const { return m_major; } - int getVersionMinor() const { return m_minor; } - bool initialized() const { return m_initialized; } - - const char *queryString(EGLint name); - - const EGLClient_glesInterface *gles_iface() const { return m_gles_iface; } - const EGLClient_glesInterface *gles2_iface() const { return m_gles2_iface; } - - int getNumConfigs(){ return m_numConfigs; } - EGLBoolean getConfigAttrib(EGLConfig config, EGLint attrib, EGLint * value); - EGLBoolean setConfigAttrib(EGLConfig config, EGLint attrib, EGLint value); - EGLBoolean getConfigGLPixelFormat(EGLConfig config, GLenum * format); - EGLBoolean getConfigNativePixelFormat(EGLConfig config, PixelFormat * format); - - void dumpConfig(EGLConfig config); -private: - EGLClient_glesInterface *loadGLESClientAPI(const char *libName, - EGLClient_eglInterface *eglIface, - void **libHandle); - EGLBoolean getAttribValue(EGLConfig config, EGLint attribIdxi, EGLint * value); - EGLBoolean setAttribValue(EGLConfig config, EGLint attribIdxi, EGLint value); - void processConfigs(); - -private: - pthread_mutex_t m_lock; - bool m_initialized; - int m_major; - int m_minor; - int m_hostRendererVersion; - int m_numConfigs; - int m_numConfigAttribs; - - /* This is the mapping between an attribute name to it's index in any given config */ - DefaultKeyedVector<EGLint, EGLint> m_attribs; - /* This is an array of all config's attributes values stored in the following sequencial fasion (read: v[c,a] = the value of attribute <a> of config <c>) - * v[0,0],..,v[0,m_numConfigAttribs-1], - *... - * v[m_numConfigs-1,0],..,v[m_numConfigs-1,m_numConfigAttribs-1] - */ - EGLint *m_configs; - EGLClient_glesInterface *m_gles_iface; - EGLClient_glesInterface *m_gles2_iface; - char *m_versionString; - char *m_vendorString; - char *m_extensionString; -}; - -#endif diff --git a/emulator/opengl/system/egl/egl_ftable.h b/emulator/opengl/system/egl/egl_ftable.h deleted file mode 100644 index 16d130c..0000000 --- a/emulator/opengl/system/egl/egl_ftable.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -* Copyright (C) 2011 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -static const struct _egl_funcs_by_name { - const char *name; - void *proc; -} egl_funcs_by_name[] = { - {"eglGetError", (void *)eglGetError}, - {"eglGetDisplay", (void *)eglGetDisplay}, - {"eglInitialize", (void *)eglInitialize}, - {"eglTerminate", (void *)eglTerminate}, - {"eglQueryString", (void *)eglQueryString}, - {"eglGetConfigs", (void *)eglGetConfigs}, - {"eglChooseConfig", (void *)eglChooseConfig}, - {"eglGetConfigAttrib", (void *)eglGetConfigAttrib}, - {"eglCreateWindowSurface", (void *)eglCreateWindowSurface}, - {"eglCreatePbufferSurface", (void *)eglCreatePbufferSurface}, - {"eglCreatePixmapSurface", (void *)eglCreatePixmapSurface}, - {"eglDestroySurface", (void *)eglDestroySurface}, - {"eglQuerySurface", (void *)eglQuerySurface}, - {"eglBindAPI", (void *)eglBindAPI}, - {"eglQueryAPI", (void *)eglQueryAPI}, - {"eglWaitClient", (void *)eglWaitClient}, - {"eglReleaseThread", (void *)eglReleaseThread}, - {"eglCreatePbufferFromClientBuffer", (void *)eglCreatePbufferFromClientBuffer}, - {"eglSurfaceAttrib", (void *)eglSurfaceAttrib}, - {"eglBindTexImage", (void *)eglBindTexImage}, - {"eglReleaseTexImage", (void *)eglReleaseTexImage}, - {"eglSwapInterval", (void *)eglSwapInterval}, - {"eglCreateContext", (void *)eglCreateContext}, - {"eglDestroyContext", (void *)eglDestroyContext}, - {"eglMakeCurrent", (void *)eglMakeCurrent}, - {"eglGetCurrentContext", (void *)eglGetCurrentContext}, - {"eglGetCurrentSurface", (void *)eglGetCurrentSurface}, - {"eglGetCurrentDisplay", (void *)eglGetCurrentDisplay}, - {"eglQueryContext", (void *)eglQueryContext}, - {"eglWaitGL", (void *)eglWaitGL}, - {"eglWaitNative", (void *)eglWaitNative}, - {"eglSwapBuffers", (void *)eglSwapBuffers}, - {"eglCopyBuffers", (void *)eglCopyBuffers}, - {"eglGetProcAddress", (void *)eglGetProcAddress}, - {"eglLockSurfaceKHR", (void *)eglLockSurfaceKHR}, - {"eglUnlockSurfaceKHR", (void *)eglUnlockSurfaceKHR}, - {"eglCreateImageKHR", (void *)eglCreateImageKHR}, - {"eglDestroyImageKHR", (void *)eglDestroyImageKHR}, - {"eglCreateSyncKHR", (void *)eglCreateSyncKHR}, - {"eglDestroySyncKHR", (void *)eglDestroySyncKHR}, - {"eglClientWaitSyncKHR", (void *)eglClientWaitSyncKHR}, - {"eglGetSyncAttribKHR", (void *)eglGetSyncAttribKHR} -}; - -static const int egl_num_funcs = sizeof(egl_funcs_by_name) / sizeof(struct _egl_funcs_by_name); diff --git a/emulator/opengl/system/gralloc/Android.mk b/emulator/opengl/system/gralloc/Android.mk deleted file mode 100644 index 8705602..0000000 --- a/emulator/opengl/system/gralloc/Android.mk +++ /dev/null @@ -1,19 +0,0 @@ -ifneq (false,$(BUILD_EMULATOR_OPENGL_DRIVER)) - -LOCAL_PATH := $(call my-dir) - -$(call emugl-begin-shared-library,gralloc.goldfish) -$(call emugl-import,libGLESv1_enc lib_renderControl_enc libOpenglSystemCommon) -$(call emugl-set-shared-library-subpath,hw) - -LOCAL_CFLAGS += -DLOG_TAG=\"gralloc_goldfish\" - -LOCAL_SRC_FILES := gralloc.cpp - -# Need to access the special OPENGL TLS Slot -LOCAL_C_INCLUDES += bionic/libc/private -LOCAL_SHARED_LIBRARIES += libdl - -$(call emugl-end-module) - -endif # BUILD_EMULATOR_OPENGL_DRIVER != false diff --git a/emulator/opengl/system/gralloc/gralloc.cpp b/emulator/opengl/system/gralloc/gralloc.cpp deleted file mode 100644 index 4334835..0000000 --- a/emulator/opengl/system/gralloc/gralloc.cpp +++ /dev/null @@ -1,847 +0,0 @@ -/* -* Copyright (C) 2011 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -#include <string.h> -#include <pthread.h> -#ifdef HAVE_ANDROID_OS // just want PAGE_SIZE define -# include <asm/page.h> -#else -# include <sys/user.h> -#endif -#include <cutils/ashmem.h> -#include <unistd.h> -#include <errno.h> -#include <dlfcn.h> -#include <sys/mman.h> -#include "gralloc_cb.h" -#include "HostConnection.h" -#include "glUtils.h" -#include <cutils/log.h> -#include <cutils/properties.h> - -/* Set to 1 or 2 to enable debug traces */ -#define DEBUG 0 - -#if DEBUG >= 1 -# define D(...) ALOGD(__VA_ARGS__) -#else -# define D(...) ((void)0) -#endif - -#if DEBUG >= 2 -# define DD(...) ALOGD(__VA_ARGS__) -#else -# define DD(...) ((void)0) -#endif - -#define DBG_FUNC DBG("%s\n", __FUNCTION__) -// -// our private gralloc module structure -// -struct private_module_t { - gralloc_module_t base; -}; - -/* If not NULL, this is a pointer to the fallback module. - * This really is gralloc.default, which we'll use if we detect - * that the emulator we're running in does not support GPU emulation. - */ -static gralloc_module_t* sFallback; -static pthread_once_t sFallbackOnce = PTHREAD_ONCE_INIT; - -static void fallback_init(void); // forward - - -typedef struct _alloc_list_node { - buffer_handle_t handle; - _alloc_list_node *next; - _alloc_list_node *prev; -} AllocListNode; - -// -// Our gralloc device structure (alloc interface) -// -struct gralloc_device_t { - alloc_device_t device; - - AllocListNode *allocListHead; // double linked list of allocated buffers - pthread_mutex_t lock; -}; - -// -// Our framebuffer device structure -// -struct fb_device_t { - framebuffer_device_t device; -}; - -static int map_buffer(cb_handle_t *cb, void **vaddr) -{ - if (cb->fd < 0 || cb->ashmemSize <= 0) { - return -EINVAL; - } - - void *addr = mmap(0, cb->ashmemSize, PROT_READ | PROT_WRITE, - MAP_SHARED, cb->fd, 0); - if (addr == MAP_FAILED) { - return -errno; - } - - cb->ashmemBase = intptr_t(addr); - cb->ashmemBasePid = getpid(); - - *vaddr = addr; - return 0; -} - -#define DEFINE_HOST_CONNECTION \ - HostConnection *hostCon = HostConnection::get(); \ - renderControl_encoder_context_t *rcEnc = (hostCon ? hostCon->rcEncoder() : NULL) - -#define DEFINE_AND_VALIDATE_HOST_CONNECTION \ - HostConnection *hostCon = HostConnection::get(); \ - if (!hostCon) { \ - ALOGE("gralloc: Failed to get host connection\n"); \ - return -EIO; \ - } \ - renderControl_encoder_context_t *rcEnc = hostCon->rcEncoder(); \ - if (!rcEnc) { \ - ALOGE("gralloc: Failed to get renderControl encoder context\n"); \ - return -EIO; \ - } - - -// -// gralloc device functions (alloc interface) -// -static int gralloc_alloc(alloc_device_t* dev, - int w, int h, int format, int usage, - buffer_handle_t* pHandle, int* pStride) -{ - D("gralloc_alloc w=%d h=%d usage=0x%x\n", w, h, usage); - - gralloc_device_t *grdev = (gralloc_device_t *)dev; - if (!grdev || !pHandle || !pStride) - return -EINVAL; - - // - // Validate usage: buffer cannot be written both by s/w and h/w access. - // - bool sw_write = (0 != (usage & GRALLOC_USAGE_SW_WRITE_MASK)); - bool hw_write = (usage & GRALLOC_USAGE_HW_RENDER); - if (hw_write && sw_write) { - return -EINVAL; - } - bool sw_read = (0 != (usage & GRALLOC_USAGE_SW_READ_MASK)); - - int ashmem_size = 0; - int stride = w; - - GLenum glFormat = 0; - GLenum glType = 0; - - int bpp = 0; - int align = 1; - switch (format) { - case HAL_PIXEL_FORMAT_RGBA_8888: - case HAL_PIXEL_FORMAT_RGBX_8888: - case HAL_PIXEL_FORMAT_BGRA_8888: - bpp = 4; - glFormat = GL_RGBA; - glType = GL_UNSIGNED_BYTE; - break; - case HAL_PIXEL_FORMAT_RGB_888: - bpp = 3; - glFormat = GL_RGB; - glType = GL_UNSIGNED_BYTE; - break; - case HAL_PIXEL_FORMAT_RGB_565: - bpp = 2; - glFormat = GL_RGB; - glType = GL_UNSIGNED_SHORT_5_6_5; - break; - case HAL_PIXEL_FORMAT_RGBA_5551: - bpp = 2; - glFormat = GL_RGB5_A1_OES; - glType = GL_UNSIGNED_SHORT_5_5_5_1; - break; - case HAL_PIXEL_FORMAT_RGBA_4444: - bpp = 2; - glFormat = GL_RGBA4_OES; - glType = GL_UNSIGNED_SHORT_4_4_4_4; - break; - case HAL_PIXEL_FORMAT_RAW_SENSOR: - bpp = 2; - align = 16*bpp; - if (! (sw_read && sw_write) ) { - // Raw sensor data cannot be used by HW - return -EINVAL; - } - glFormat = GL_LUMINANCE; - glType = GL_UNSIGNED_SHORT; - break; - default: - return -EINVAL; - } - - if (usage & GRALLOC_USAGE_HW_FB) { - // keep space for postCounter - ashmem_size += sizeof(uint32_t); - } - - if (sw_read || sw_write) { - // keep space for image on guest memory if SW access is needed - - size_t bpr = (w*bpp + (align-1)) & ~(align-1); - ashmem_size += (bpr * h); - stride = bpr / bpp; - } - - D("gralloc_alloc ashmem_size=%d, stride=%d, tid %d\n", ashmem_size, stride, - gettid()); - - // - // Allocate space in ashmem if needed - // - int fd = -1; - if (ashmem_size > 0) { - // round to page size; - ashmem_size = (ashmem_size + (PAGE_SIZE-1)) & ~(PAGE_SIZE-1); - - fd = ashmem_create_region("gralloc-buffer", ashmem_size); - if (fd < 0) { - ALOGE("gralloc_alloc failed to create ashmem region: %s\n", - strerror(errno)); - return -errno; - } - } - - cb_handle_t *cb = new cb_handle_t(fd, ashmem_size, usage, - w, h, glFormat, glType); - - if (ashmem_size > 0) { - // - // map ashmem region if exist - // - void *vaddr; - int err = map_buffer(cb, &vaddr); - if (err) { - close(fd); - delete cb; - return err; - } - - cb->setFd(fd); - } - - // - // Allocate ColorBuffer handle on the host (only if h/w access is allowed) - // - if (usage & GRALLOC_USAGE_HW_MASK) { - DEFINE_HOST_CONNECTION; - if (hostCon && rcEnc) { - cb->hostHandle = rcEnc->rcCreateColorBuffer(rcEnc, w, h, glFormat); - D("Created host ColorBuffer 0x%x\n", cb->hostHandle); - } - - if (!cb->hostHandle) { - // Could not create colorbuffer on host !!! - close(fd); - delete cb; - return -EIO; - } - } - - // - // alloc succeeded - insert the allocated handle to the allocated list - // - AllocListNode *node = new AllocListNode(); - pthread_mutex_lock(&grdev->lock); - node->handle = cb; - node->next = grdev->allocListHead; - node->prev = NULL; - if (grdev->allocListHead) { - grdev->allocListHead->prev = node; - } - grdev->allocListHead = node; - pthread_mutex_unlock(&grdev->lock); - - *pHandle = cb; - *pStride = stride; - return 0; -} - -static int gralloc_free(alloc_device_t* dev, - buffer_handle_t handle) -{ - const cb_handle_t *cb = (const cb_handle_t *)handle; - if (!cb_handle_t::validate((cb_handle_t*)cb)) { - ERR("gralloc_free: invalid handle"); - return -EINVAL; - } - - if (cb->hostHandle != 0) { - DEFINE_AND_VALIDATE_HOST_CONNECTION; - D("Closing host ColorBuffer 0x%x\n", cb->hostHandle); - rcEnc->rcCloseColorBuffer(rcEnc, cb->hostHandle); - } - - // - // detach and unmap ashmem area if present - // - if (cb->fd > 0) { - if (cb->ashmemSize > 0 && cb->ashmemBase) { - munmap((void *)cb->ashmemBase, cb->ashmemSize); - } - close(cb->fd); - } - - // remove it from the allocated list - gralloc_device_t *grdev = (gralloc_device_t *)dev; - pthread_mutex_lock(&grdev->lock); - AllocListNode *n = grdev->allocListHead; - while( n && n->handle != cb ) { - n = n->next; - } - if (n) { - // buffer found on list - remove it from list - if (n->next) { - n->next->prev = n->prev; - } - if (n->prev) { - n->prev->next = n->next; - } - else { - grdev->allocListHead = n->next; - } - - delete n; - } - pthread_mutex_unlock(&grdev->lock); - - delete cb; - - return 0; -} - -static int gralloc_device_close(struct hw_device_t *dev) -{ - gralloc_device_t* d = reinterpret_cast<gralloc_device_t*>(dev); - if (d) { - - // free still allocated buffers - while( d->allocListHead != NULL ) { - gralloc_free(&d->device, d->allocListHead->handle); - } - - // free device - free(d); - } - return 0; -} - -static int fb_compositionComplete(struct framebuffer_device_t* dev) -{ - return 0; -} - -// -// Framebuffer device functions -// -static int fb_post(struct framebuffer_device_t* dev, buffer_handle_t buffer) -{ - fb_device_t *fbdev = (fb_device_t *)dev; - cb_handle_t *cb = (cb_handle_t *)buffer; - - if (!fbdev || !cb_handle_t::validate(cb) || !cb->canBePosted()) { - return -EINVAL; - } - - // Make sure we have host connection - DEFINE_AND_VALIDATE_HOST_CONNECTION; - - // increment the post count of the buffer - uint32_t *postCountPtr = (uint32_t *)cb->ashmemBase; - if (!postCountPtr) { - // This should not happen - return -EINVAL; - } - (*postCountPtr)++; - - // send post request to host - rcEnc->rcFBPost(rcEnc, cb->hostHandle); - hostCon->flush(); - - return 0; -} - -static int fb_setUpdateRect(struct framebuffer_device_t* dev, - int l, int t, int w, int h) -{ - fb_device_t *fbdev = (fb_device_t *)dev; - - if (!fbdev) { - return -EINVAL; - } - - // Make sure we have host connection - DEFINE_AND_VALIDATE_HOST_CONNECTION; - - // send request to host - // TODO: XXX - should be implemented - //rcEnc->rc_XXX - - return 0; -} - -static int fb_setSwapInterval(struct framebuffer_device_t* dev, - int interval) -{ - fb_device_t *fbdev = (fb_device_t *)dev; - - if (!fbdev) { - return -EINVAL; - } - - // Make sure we have host connection - DEFINE_AND_VALIDATE_HOST_CONNECTION; - - // send request to host - rcEnc->rcFBSetSwapInterval(rcEnc, interval); - hostCon->flush(); - - return 0; -} - -static int fb_close(struct hw_device_t *dev) -{ - fb_device_t *fbdev = (fb_device_t *)dev; - - delete fbdev; - - return 0; -} - - -// -// gralloc module functions - refcount + locking interface -// -static int gralloc_register_buffer(gralloc_module_t const* module, - buffer_handle_t handle) -{ - pthread_once(&sFallbackOnce, fallback_init); - if (sFallback != NULL) { - return sFallback->registerBuffer(sFallback, handle); - } - - D("gralloc_register_buffer(%p) called", handle); - - private_module_t *gr = (private_module_t *)module; - cb_handle_t *cb = (cb_handle_t *)handle; - if (!gr || !cb_handle_t::validate(cb)) { - ERR("gralloc_register_buffer(%p): invalid buffer", cb); - return -EINVAL; - } - - if (cb->hostHandle != 0) { - DEFINE_AND_VALIDATE_HOST_CONNECTION; - D("Opening host ColorBuffer 0x%x\n", cb->hostHandle); - rcEnc->rcOpenColorBuffer(rcEnc, cb->hostHandle); - } - - // - // if the color buffer has ashmem region and it is not mapped in this - // process map it now. - // - if (cb->ashmemSize > 0 && cb->mappedPid != getpid()) { - void *vaddr; - int err = map_buffer(cb, &vaddr); - if (err) { - ERR("gralloc_register_buffer(%p): map failed: %s", cb, strerror(-err)); - return -err; - } - cb->mappedPid = getpid(); - } - - return 0; -} - -static int gralloc_unregister_buffer(gralloc_module_t const* module, - buffer_handle_t handle) -{ - if (sFallback != NULL) { - return sFallback->unregisterBuffer(sFallback, handle); - } - - private_module_t *gr = (private_module_t *)module; - cb_handle_t *cb = (cb_handle_t *)handle; - if (!gr || !cb_handle_t::validate(cb)) { - ERR("gralloc_unregister_buffer(%p): invalid buffer", cb); - return -EINVAL; - } - - if (cb->hostHandle != 0) { - DEFINE_AND_VALIDATE_HOST_CONNECTION; - D("Closing host ColorBuffer 0x%x\n", cb->hostHandle); - rcEnc->rcCloseColorBuffer(rcEnc, cb->hostHandle); - } - - // - // unmap ashmem region if it was previously mapped in this process - // (through register_buffer) - // - if (cb->ashmemSize > 0 && cb->mappedPid == getpid()) { - void *vaddr; - int err = munmap((void *)cb->ashmemBase, cb->ashmemSize); - if (err) { - ERR("gralloc_unregister_buffer(%p): unmap failed", cb); - return -EINVAL; - } - cb->ashmemBase = NULL; - cb->mappedPid = 0; - } - - D("gralloc_unregister_buffer(%p) done\n", cb); - - return 0; -} - -static int gralloc_lock(gralloc_module_t const* module, - buffer_handle_t handle, int usage, - int l, int t, int w, int h, - void** vaddr) -{ - if (sFallback != NULL) { - return sFallback->lock(sFallback, handle, usage, l, t, w, h, vaddr); - } - - private_module_t *gr = (private_module_t *)module; - cb_handle_t *cb = (cb_handle_t *)handle; - if (!gr || !cb_handle_t::validate(cb)) { - ALOGE("gralloc_lock bad handle\n"); - return -EINVAL; - } - - // Validate usage, - // 1. cannot be locked for hw access - // 2. lock for either sw read or write. - // 3. locked sw access must match usage during alloc time. - bool sw_read = (0 != (usage & GRALLOC_USAGE_SW_READ_MASK)); - bool sw_write = (0 != (usage & GRALLOC_USAGE_SW_WRITE_MASK)); - bool hw_read = (usage & GRALLOC_USAGE_HW_TEXTURE); - bool hw_write = (usage & GRALLOC_USAGE_HW_RENDER); - bool sw_read_allowed = (0 != (cb->usage & GRALLOC_USAGE_SW_READ_MASK)); - bool sw_write_allowed = (0 != (cb->usage & GRALLOC_USAGE_SW_WRITE_MASK)); - - if ( (hw_read || hw_write) || - (!sw_read && !sw_write) || - (sw_read && !sw_read_allowed) || - (sw_write && !sw_write_allowed) ) { - ALOGE("gralloc_lock usage mismatch usage=0x%x cb->usage=0x%x\n", usage, cb->usage); - return -EINVAL; - } - - EGLint postCount = 0; - void *cpu_addr = NULL; - - // - // make sure ashmem area is mapped if needed - // - if (cb->canBePosted() || sw_read || sw_write) { - if (cb->ashmemBasePid != getpid() || !cb->ashmemBase) { - return -EACCES; - } - - if (cb->canBePosted()) { - postCount = *((int *)cb->ashmemBase); - cpu_addr = (void *)(cb->ashmemBase + sizeof(int)); - } - else { - cpu_addr = (void *)(cb->ashmemBase); - } - } - - if (cb->hostHandle) { - // Make sure we have host connection - DEFINE_AND_VALIDATE_HOST_CONNECTION; - - // - // flush color buffer write cache on host and get its sync status. - // - int hostSyncStatus = rcEnc->rcColorBufferCacheFlush(rcEnc, cb->hostHandle, - postCount, - sw_read); - if (hostSyncStatus < 0) { - // host failed the color buffer sync - probably since it was already - // locked for write access. fail the lock. - ALOGE("gralloc_lock cacheFlush failed postCount=%d sw_read=%d\n", - postCount, sw_read); - return -EBUSY; - } - - } - - // - // is virtual address required ? - // - if (sw_read || sw_write) { - *vaddr = cpu_addr; - } - - if (sw_write) { - // - // Keep locked region if locked for s/w write access. - // - cb->lockedLeft = l; - cb->lockedTop = t; - cb->lockedWidth = w; - cb->lockedHeight = h; - } - - return 0; -} - -static int gralloc_unlock(gralloc_module_t const* module, - buffer_handle_t handle) -{ - if (sFallback != NULL) { - return sFallback->unlock(sFallback, handle); - } - - private_module_t *gr = (private_module_t *)module; - cb_handle_t *cb = (cb_handle_t *)handle; - if (!gr || !cb_handle_t::validate(cb)) { - return -EINVAL; - } - - // - // if buffer was locked for s/w write, we need to update the host with - // the updated data - // - if (cb->lockedWidth > 0 && cb->lockedHeight > 0 && cb->hostHandle) { - - // Make sure we have host connection - DEFINE_AND_VALIDATE_HOST_CONNECTION; - - void *cpu_addr; - if (cb->canBePosted()) { - cpu_addr = (void *)(cb->ashmemBase + sizeof(int)); - } - else { - cpu_addr = (void *)(cb->ashmemBase); - } - - if (cb->lockedWidth < cb->width || cb->lockedHeight < cb->height) { - int bpp = glUtilsPixelBitSize(cb->glFormat, cb->glType) >> 3; - char *tmpBuf = new char[cb->lockedWidth * cb->lockedHeight * bpp]; - - int dst_line_len = cb->lockedWidth * bpp; - int src_line_len = cb->width * bpp; - char *src = (char *)cpu_addr + cb->lockedTop*src_line_len + cb->lockedLeft*bpp; - char *dst = tmpBuf; - for (int y=0; y<cb->lockedHeight; y++) { - memcpy(dst, src, dst_line_len); - src += src_line_len; - dst += dst_line_len; - } - - rcEnc->rcUpdateColorBuffer(rcEnc, cb->hostHandle, - cb->lockedLeft, cb->lockedTop, - cb->lockedWidth, cb->lockedHeight, - cb->glFormat, cb->glType, - tmpBuf); - - delete [] tmpBuf; - } - else { - rcEnc->rcUpdateColorBuffer(rcEnc, cb->hostHandle, 0, 0, - cb->width, cb->height, - cb->glFormat, cb->glType, - cpu_addr); - } - } - - cb->lockedWidth = cb->lockedHeight = 0; - return 0; -} - - -static int gralloc_device_open(const hw_module_t* module, - const char* name, - hw_device_t** device) -{ - int status = -EINVAL; - - D("gralloc_device_open %s\n", name); - - pthread_once( &sFallbackOnce, fallback_init ); - if (sFallback != NULL) { - return sFallback->common.methods->open(&sFallback->common, name, device); - } - - if (!strcmp(name, GRALLOC_HARDWARE_GPU0)) { - - // Create host connection and keep it in the TLS. - // return error if connection with host can not be established - HostConnection *hostCon = HostConnection::get(); - if (!hostCon) { - ALOGE("gralloc: failed to get host connection while opening %s\n", name); - return -EIO; - } - - // - // Allocate memory for the gralloc device (alloc interface) - // - gralloc_device_t *dev; - dev = (gralloc_device_t*)malloc(sizeof(gralloc_device_t)); - if (NULL == dev) { - return -ENOMEM; - } - - // Initialize our device structure - // - dev->device.common.tag = HARDWARE_DEVICE_TAG; - dev->device.common.version = 0; - dev->device.common.module = const_cast<hw_module_t*>(module); - dev->device.common.close = gralloc_device_close; - - dev->device.alloc = gralloc_alloc; - dev->device.free = gralloc_free; - dev->allocListHead = NULL; - pthread_mutex_init(&dev->lock, NULL); - - *device = &dev->device.common; - status = 0; - } - else if (!strcmp(name, GRALLOC_HARDWARE_FB0)) { - - // return error if connection with host can not be established - DEFINE_AND_VALIDATE_HOST_CONNECTION; - - // - // Query the host for Framebuffer attributes - // - D("gralloc: query Frabuffer attribs\n"); - EGLint width = rcEnc->rcGetFBParam(rcEnc, FB_WIDTH); - D("gralloc: width=%d\n", width); - EGLint height = rcEnc->rcGetFBParam(rcEnc, FB_HEIGHT); - D("gralloc: height=%d\n", height); - EGLint xdpi = rcEnc->rcGetFBParam(rcEnc, FB_XDPI); - D("gralloc: xdpi=%d\n", xdpi); - EGLint ydpi = rcEnc->rcGetFBParam(rcEnc, FB_YDPI); - D("gralloc: ydpi=%d\n", ydpi); - EGLint fps = rcEnc->rcGetFBParam(rcEnc, FB_FPS); - D("gralloc: fps=%d\n", fps); - EGLint min_si = rcEnc->rcGetFBParam(rcEnc, FB_MIN_SWAP_INTERVAL); - D("gralloc: min_swap=%d\n", min_si); - EGLint max_si = rcEnc->rcGetFBParam(rcEnc, FB_MAX_SWAP_INTERVAL); - D("gralloc: max_swap=%d\n", max_si); - - // - // Allocate memory for the framebuffer device - // - fb_device_t *dev; - dev = (fb_device_t*)malloc(sizeof(fb_device_t)); - if (NULL == dev) { - return -ENOMEM; - } - memset(dev, 0, sizeof(fb_device_t)); - - // Initialize our device structure - // - dev->device.common.tag = HARDWARE_DEVICE_TAG; - dev->device.common.version = 0; - dev->device.common.module = const_cast<hw_module_t*>(module); - dev->device.common.close = fb_close; - dev->device.setSwapInterval = fb_setSwapInterval; - dev->device.post = fb_post; - dev->device.setUpdateRect = 0; //fb_setUpdateRect; - dev->device.compositionComplete = fb_compositionComplete; //XXX: this is a dummy - - const_cast<uint32_t&>(dev->device.flags) = 0; - const_cast<uint32_t&>(dev->device.width) = width; - const_cast<uint32_t&>(dev->device.height) = height; - const_cast<int&>(dev->device.stride) = width; - const_cast<int&>(dev->device.format) = HAL_PIXEL_FORMAT_RGBA_8888; - const_cast<float&>(dev->device.xdpi) = xdpi; - const_cast<float&>(dev->device.ydpi) = ydpi; - const_cast<float&>(dev->device.fps) = fps; - const_cast<int&>(dev->device.minSwapInterval) = min_si; - const_cast<int&>(dev->device.maxSwapInterval) = max_si; - *device = &dev->device.common; - - status = 0; - } - - return status; -} - -// -// define the HMI symbol - our module interface -// -static struct hw_module_methods_t gralloc_module_methods = { - open: gralloc_device_open -}; - -struct private_module_t HAL_MODULE_INFO_SYM = { - base: { - common: { - tag: HARDWARE_MODULE_TAG, - version_major: 1, - version_minor: 0, - id: GRALLOC_HARDWARE_MODULE_ID, - name: "Graphics Memory Allocator Module", - author: "The Android Open Source Project", - methods: &gralloc_module_methods, - dso: NULL, - reserved: {0, } - }, - registerBuffer: gralloc_register_buffer, - unregisterBuffer: gralloc_unregister_buffer, - lock: gralloc_lock, - unlock: gralloc_unlock, - perform: NULL, - reserved_proc : {NULL, } - } -}; - -/* This function is called once to detect whether the emulator supports - * GPU emulation (this is done by looking at the qemu.gles kernel - * parameter, which must be > 0 if this is the case). - * - * If not, then load gralloc.default instead as a fallback. - */ -static void -fallback_init(void) -{ - char prop[PROPERTY_VALUE_MAX]; - void* module; - - property_get("ro.kernel.qemu.gles", prop, "0"); - if (atoi(prop) > 0) { - return; - } - ALOGD("Emulator without GPU emulation detected."); - module = dlopen("/system/lib/hw/gralloc.default.so", RTLD_LAZY|RTLD_LOCAL); - if (module != NULL) { - sFallback = reinterpret_cast<gralloc_module_t*>(dlsym(module, HAL_MODULE_INFO_SYM_AS_STR)); - if (sFallback == NULL) { - dlclose(module); - } - } - if (sFallback == NULL) { - ALOGE("Could not find software fallback module!?"); - } -} diff --git a/emulator/opengl/system/renderControl_enc/Android.mk b/emulator/opengl/system/renderControl_enc/Android.mk deleted file mode 100644 index 96f15a2..0000000 --- a/emulator/opengl/system/renderControl_enc/Android.mk +++ /dev/null @@ -1,7 +0,0 @@ -LOCAL_PATH := $(call my-dir) - -$(call emugl-begin-shared-library,lib_renderControl_enc) -$(call emugl-gen-encoder,$(LOCAL_PATH),renderControl) -$(call emugl-export,C_INCLUDES,$(LOCAL_PATH)) -$(call emugl-import,libOpenglCodecCommon) -$(call emugl-end-module) diff --git a/emulator/opengl/system/renderControl_enc/README b/emulator/opengl/system/renderControl_enc/README deleted file mode 100644 index 2ee1a57..0000000 --- a/emulator/opengl/system/renderControl_enc/README +++ /dev/null @@ -1,136 +0,0 @@ -The renderControl.in file in this directory defines an API which is decoded -on the android guest into a stream and get decoded and executed on the host. -It is used in order to query the host renderer as well as send the host renderer -control commands. - -The following describes each of the entries defined by this renderControl API. - - -GLint rcGetRendererVersion(); - This function queries the host renderer version number. - -EGLint rcGetEGLVersion(EGLint* major, EGLint* minor); - This function queries the host renderer for the EGL version - it supports. returns EGL_FALSE on failure. - -EGLint rcQueryEGLString(EGLenum name, void* buffer, EGLint bufferSize); - This function queries the host for EGL string (.i.e EGL_EXTENSIONS). - if buffer is NULL or the bufferSize is not big enough the return value - is the negative number of bytes required to store the string value - otherwise the string value is copied to buffer and its size is - returned. - -EGLint rcGetNumConfigs(uint32_t* numAttribs); - queries the host for the number of supported EGL configs. - The function returns the number of supported configs and returns in - numAttribs the number of attributes available for each config. - -EGLint rcGetConfigs(uint32_t bufSize, GLuint* buffer); - This function queries the host for the all set of supported configs - with their attribute values. - bufSize is the size of buffer, the size should be at least equal to - (numConfigs + 1) * numAttribs * sizeof(GLuint) - where numConfigs and numAttribs are the values returned in - rcGetNumConfigs. if bufSize is not big enough then the negative number - of required bytes is returned otherwise the function returns the number - of configs and buffer is filled as follows: The first 'numAttribs' - integer values are filled with the EGL enumerant describing a config - attribute, next for each config there are 'numAttribs' integer values - holding the attribute values for that config, the values are specified - in the same order as the attribute vector. - -EGLint rcChooseConfig(EGLint *attribs, uint32_t attribs_size, uint32_t *configs, uint32_t configs_size) - This function triggers an eglChooseConfig on the host, to get a list of - configs matching the given attribs values. - attribs - a list of attribute names followed by the desired values, terminated by EGL_NONE - attribs_size - the size of the list - configs - the returned matching configuration names (same names as familiar to the client in rcGetConfigs) - configs_size - the size of the configs buffers - returns - the actual number of matching configurations (<= configs_size) - -EGLint rcGetFBParam(EGLint param); - queries the host for framebuffer parameter, see renderControl_types.h - for possible values of 'param'. - -uint32_t rcCreateContext(uint32_t config, uint32_t share, uint32_t glVersion); - This function creates a rendering context on the host and returns its - handle. config is the config index for the context, share is either zero - or a handle to a sharing context. glVersion is either 1 or 2 for GLES1 - or GLES2 context respectively. - - -void rcDestroyContext(uint32_t context); - This function destroys a rendering context on the host. - context is a handle returned in rcCreateContext. - -uint32_t rcCreateWindowSurface(uint32_t config, uint32_t width, uint32_t height); - This function creates a 'window' surface on the host which can be then - bind for rendering through rcMakeCurrent. - The function returns a handle to the created window surface. - -void rcDestroyWindowSurface(uint32_t windowSurface); - This function destoys a window surface. - -uint32_t rcCreateColorBuffer(uint32_t width, uint32_t height, GLenum internalFormat); - This function creates a colorBuffer object on the host which can be then - be specified as a render target for a window surface through - rcSetWindowColorBuffer or to be displayed on the framebuffer window - through rcFBPost. - The function returns a handle to the colorBuffer object, with an initial - reference count of 1. - -void rcOpenColorBuffer(uint32_t colorbuffer); - Adds an additional reference to the colorbuffer, typically from a - different Android process than the one which created it. - -void rcCloseColorBuffer(uint32_t colorbuffer); - Removes a reference to the colorbuffer. When the reference count drops - to zero the colorbuffer is automatically destroyed. - -void rcFlushWindowColorBuffer(uint32_t windowSurface, uint32_t colorBuffer); - This flushes the current window color buffer - -void rcSetWindowColorBuffer(uint32_t windowSurface, uint32_t colorBuffer); - This set the target color buffer for a windowSurface, when set the - previous target colorBuffer gets updated before switching to the new - colorBuffer. - -EGLint rcMakeCurrent(uint32_t context, uint32_t drawSurf, uint32_t readSurf); - Binds a windowSurface(s) and current rendering context for the - calling thread. - -void rcFBPost(uint32_t colorBuffer); - This function causes the content of the colorBuffer object to be - displayed on the host framebuffer window. The function returns - immediatly, the buffer will be displayed at the next swap interval. - -void rcFBSetSwapInterval(EGLint interval); - Sets the swap interval for the host framebuffer window. - -void rcBindTexture(uint32_t colorBuffer); - This function instruct the host to bind the content of the specified - colorBuffer to the current binded texture object of the calling thread. - This function should be used to implement eglBindTexImage. - -EGLint rcColorBufferCacheFlush(uint32_t colorbuffer, EGLint postCount, int forRead); - This function returns only after all rendering requests for the specified - colorBuffer rendering target has been processed and after all 'postCount' - posts for the buffer requested previously through rcFBPost has been - processed. - if 'forRead' is not-zero, the function returns positive value in case - there was rendering done to the buffer since the last CacheFlush request - with non-zero 'forRead' value, otherwise the function returns zero or - negative value on failure. - -void rcReadColorBuffer(uint32_t colorbuffer, GLint x, GLint y, - GLint width, GLint height, GLenum format, - GLenum type, void* pixels); - This function queries the host for the pixel content of a colorBuffer's - subregion. It act the same as OpenGL glReadPixels however pixels - are always packed with alignment of 1. - -void rcUpdateColorBuffer(uint32_t colorbuffer, GLint x, GLint y, - GLint width, GLint height, GLenum format, - GLenum type, void* pixels); - Updates the content of a subregion of a colorBuffer object. - pixels are always unpacked with alignment of 1. diff --git a/emulator/opengl/tests/gles_android_wrapper/Android.mk b/emulator/opengl/tests/gles_android_wrapper/Android.mk deleted file mode 100644 index f5254b7..0000000 --- a/emulator/opengl/tests/gles_android_wrapper/Android.mk +++ /dev/null @@ -1,80 +0,0 @@ -LOCAL_PATH := $(call my-dir) - -#### libGLESv1_CM_emul.so -$(call emugl-begin-shared-library,libGLESv1_CM_emul) -$(call emugl-import,libGLESv1_enc) -$(call emugl-gen-wrapper,$(EMUGL_PATH)/system/GLESv1_enc,gl) -$(call emugl-set-shared-library-subpath,egl) - -LOCAL_SRC_FILES += glesv1_emul_ifc.cpp - -$(call emugl-end-module) - -emulatorOpengl := $(LOCAL_PATH)/../.. -logTag := -DLOG_TAG=\"eglWrapper\" -EMUGEN = $(BUILD_OUT_EXECUTABLES)/emugen -## comment for no debug -#debugFlags = -g -O0 - -#### libGLESv2_CM_emul.so -$(call emugl-begin-shared-library, libGLESv2_emul) -$(call emugl-import,libGLESv2_enc) -$(call emugl-gen-wrapper,$(EMUGL_PATH)/system/GLESv2_enc,gl2) -LOCAL_SRC_FILES += glesv2_emul_ifc.cpp -$(call emugl-set-shared-library-subpath,egl) -$(call emugl-end-module) - -##### libEGL_emul.so ########### - -# THE FOLLOWING DOESN'T WORK YET -# -$(call emugl-begin-shared-library,libEGL_emul) -$(call emugl-import,libut_rendercontrol_enc libGLESv1_CM_emul libGLESv2_emul libOpenglSystemCommon) - -$(call emugl-set-shared-library-subpath,egl) -LOCAL_CFLAGS += $(logTag) - -LOCAL_SRC_FILES := \ - egl.cpp \ - egl_dispatch.cpp \ - ServerConnection.cpp \ - ThreadInfo.cpp - -$(call emugl-end-module) - -#### egl.cfg #### - -# Ensure that this file is only copied to emulator-specific builds. -# Other builds are device-specific and will provide their own -# version of this file to point to the appropriate HW EGL libraries. -# -ifneq (,$(filter full full_x86 full_mips sdk sdk_x86 sdk_mips,$(TARGET_PRODUCT))) -ifeq (,$(BUILD_EMULATOR_OPENGL_DRIVER)) -include $(CLEAR_VARS) - -LOCAL_MODULE := egl.cfg -LOCAL_SRC_FILES := $(LOCAL_MODULE) - -LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/egl -LOCAL_MODULE_TAGS := debug -LOCAL_MODULE_CLASS := ETC - -include $(BUILD_PREBUILT) -endif # building 'real' driver BUILD_EMULATOR_OPENGL_DRIVER -endif # TARGET_PRODUCT in 'full sdk full_x86 sdk_x86 full_mips sdk_mips' - -#### gles_emul.cfg #### -include $(CLEAR_VARS) - -LOCAL_MODULE := gles_emul.cfg -LOCAL_SRC_FILES := $(LOCAL_MODULE) - -LOCAL_MODULE_PATH := $(TARGET_OUT)/etc -LOCAL_MODULE_TAGS := debug -LOCAL_MODULE_CLASS := ETC - -include $(BUILD_PREBUILT) - - - - diff --git a/emulator/opengl/tests/gles_android_wrapper/ApiInitializer.h b/emulator/opengl/tests/gles_android_wrapper/ApiInitializer.h deleted file mode 100644 index 793c735..0000000 --- a/emulator/opengl/tests/gles_android_wrapper/ApiInitializer.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -* Copyright 2011 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef _API_INITIALIZER_H_ -#define _API_INITIALIZER_H_ -#include <stdlib.h> -#include <dlfcn.h> - -class ApiInitializer { -public: - ApiInitializer(void *dso) : - m_dso(dso) { - } - static void *s_getProc(const char *name, void *userData) { - ApiInitializer *self = (ApiInitializer *)userData; - return self->getProc(name); - } -private: - void *m_dso; - void *getProc(const char *name) { - void *symbol = NULL; - if (m_dso) { - symbol = dlsym(m_dso, name); - } - return symbol; - } -}; - -#endif diff --git a/emulator/opengl/tests/gles_android_wrapper/CleanSpec.mk b/emulator/opengl/tests/gles_android_wrapper/CleanSpec.mk deleted file mode 100644 index f56383a..0000000 --- a/emulator/opengl/tests/gles_android_wrapper/CleanSpec.mk +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright (C) 2007 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# If you don't need to do a full clean build but would like to touch -# a file or delete some intermediate files, add a clean step to the end -# of the list. These steps will only be run once, if they haven't been -# run before. -# -# E.g.: -# $(call add-clean-step, touch -c external/sqlite/sqlite3.h) -# $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates) -# -# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with -# files that are missing or have been moved. -# -# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory. -# Use $(OUT_DIR) to refer to the "out" directory. -# -# If you need to re-do something that's already mentioned, just copy -# the command and add it to the bottom of the list. E.g., if a change -# that you made last week required touching a file and a change you -# made today requires touching the same file, just copy the old -# touch step and add it to the end of the list. -# -# ************************************************ -# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST -# ************************************************ - -# For example: -#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates) -#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates) -#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f) -#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*) - -# ************************************************ -# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST -# ************************************************ -$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/SHARED_LIBRARIES/libGLES_emul_intermediates) diff --git a/emulator/opengl/tests/gles_android_wrapper/ServerConnection.cpp b/emulator/opengl/tests/gles_android_wrapper/ServerConnection.cpp deleted file mode 100644 index ff4e390..0000000 --- a/emulator/opengl/tests/gles_android_wrapper/ServerConnection.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* -* Copyright (C) 2011 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -#include <stdio.h> -#include <stdlib.h> -#include "ServerConnection.h" -#include "TcpStream.h" -#include "QemuPipeStream.h" -#include <cutils/log.h> -#include "ThreadInfo.h" - -gl_client_context_t *ServerConnection::s_getGlContext() -{ - EGLThreadInfo *ti = getEGLThreadInfo(); - if (ti->serverConn) { - return ti->serverConn->m_glEnc; - } - return NULL; -} - -gl2_client_context_t *ServerConnection::s_getGl2Context() -{ - EGLThreadInfo *ti = getEGLThreadInfo(); - if (ti->serverConn) { - return ti->serverConn->m_gl2Enc; - } - return NULL; -} - -ServerConnection *ServerConnection::s_getServerConnection() -{ - EGLThreadInfo *ti = getEGLThreadInfo(); - if (!ti->serverConn) - { - ti->serverConn = new ServerConnection(); - if (ti->serverConn->create() < 0) { - delete ti->serverConn; - ti->serverConn = NULL; - } - } - - return ti->serverConn; -} - - -ServerConnection::ServerConnection() : - m_stream(NULL), - m_glEnc(NULL), - m_ut_enc(NULL) -{ -} - -ServerConnection::~ServerConnection() -{ - delete m_ut_enc; - delete m_glEnc; - delete m_stream; -} - - - -int ServerConnection::create(size_t bufsize, - const char *defaultServer) -{ - /* XXX: Make configurable through system property */ - int useQemuPipe = 1; - - if (m_stream != NULL) delete(m_stream); - - if (useQemuPipe) { - QemuPipeStream* pipeStream = new QemuPipeStream(bufsize); - - if (pipeStream->connect() < 0) { - ALOGE("couldn't connect to host server\n"); - delete pipeStream; - return -1; - } - m_stream = pipeStream; - } - else /* !useQemuPipe */ - { - TcpStream* tcpStream = new TcpStream(bufsize); - - char *s = getenv(ENV_RGL_SERVER); - char *hostname; - if (s == NULL) { - hostname = strdup(defaultServer); - } else { - hostname = strdup(s); - } - - if (tcpStream->connect(hostname, CODEC_SERVER_PORT) < 0) { - ALOGE("couldn't connect to %s\n", hostname); - free(hostname); - delete tcpStream; - return -1; - } - LOGI("connecting to server %s\n", hostname); - free(hostname); - - m_stream = tcpStream; - } - - m_glEnc = new GLEncoder(m_stream); - m_glEnc->setContextAccessor(s_getGlContext); - - m_gl2Enc = new GL2Encoder(m_stream); - m_gl2Enc->setContextAccessor(s_getGl2Context); - - m_ut_enc = new ut_rendercontrol_encoder_context_t(m_stream); - return 0; -} - diff --git a/emulator/opengl/tests/gles_android_wrapper/ServerConnection.h b/emulator/opengl/tests/gles_android_wrapper/ServerConnection.h deleted file mode 100644 index 84f40d8..0000000 --- a/emulator/opengl/tests/gles_android_wrapper/ServerConnection.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -* Copyright (C) 2011 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -#ifndef _SERVER_CONNECTION_H -#define _SERVER_CONNECTION_H - -#include "GLEncoder.h" -#include "GL2Encoder.h" -#include "IOStream.h" -#include "codec_defs.h" -#include "ut_rendercontrol_enc.h" -#include <pthread.h> - -#define ENV_RGL_SERVER "RGL_SERVER" -#define RGL_DEFAULT_SERVER "10.0.2.2" - -class ServerConnection { -public: - ~ServerConnection(); - int create(size_t buf_size = 4 * 1024 * 1024, const char *defaultServer = RGL_DEFAULT_SERVER); - static gl_client_context_t *s_getGlContext(); - static ServerConnection *s_getServerConnection(); - static gl2_client_context_t *s_getGl2Context(); - GLEncoder *glEncoder() { return m_glEnc; } - GL2Encoder *gl2Encoder() { return m_gl2Enc; } - ut_rendercontrol_encoder_context_t * utEnc() { return m_ut_enc; } - -private: - ServerConnection(); - -private: - static pthread_key_t s_glKey; - static pthread_key_t s_connectionKey; - static void s_initKeys(); - IOStream *m_stream; - GLEncoder *m_glEnc; - GL2Encoder *m_gl2Enc; - ut_rendercontrol_encoder_context_t *m_ut_enc; - -}; - - -#endif diff --git a/emulator/opengl/tests/gles_android_wrapper/ThreadInfo.cpp b/emulator/opengl/tests/gles_android_wrapper/ThreadInfo.cpp deleted file mode 100644 index 5bf6a7d..0000000 --- a/emulator/opengl/tests/gles_android_wrapper/ThreadInfo.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* -* Copyright (C) 2011 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -#include "ThreadInfo.h" -#include "cutils/threads.h" - -thread_store_t s_tls = THREAD_STORE_INITIALIZER; - -static void tlsDestruct(void *ptr) -{ - if (ptr) { - EGLThreadInfo *ti = (EGLThreadInfo *)ptr; - delete ti->serverConn; - delete ti; - } -} - -EGLThreadInfo *getEGLThreadInfo() -{ - EGLThreadInfo *ti = (EGLThreadInfo *)thread_store_get(&s_tls); - if (ti) return ti; - - ti = new EGLThreadInfo(); - thread_store_set(&s_tls, ti, tlsDestruct); - - return ti; -} diff --git a/emulator/opengl/tests/gles_android_wrapper/ThreadInfo.h b/emulator/opengl/tests/gles_android_wrapper/ThreadInfo.h deleted file mode 100644 index f748a39..0000000 --- a/emulator/opengl/tests/gles_android_wrapper/ThreadInfo.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -* Copyright (C) 2011 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -#ifndef _THREAD_INFO_H -#define _THREAD_INFO_H - -#include "ServerConnection.h" -#include <EGL/egl.h> - -struct EGLWrapperContext -{ - EGLWrapperContext(EGLContext p_aglContext, int _version) { - aglContext = p_aglContext; - clientState = NULL; - version = _version; - } - - ~EGLWrapperContext() { - delete clientState; - } - - EGLContext aglContext; - GLClientState *clientState; - int version; -}; - -struct EGLThreadInfo -{ - EGLThreadInfo() : currentContext(NULL), serverConn(NULL) {} - - EGLWrapperContext *currentContext; - ServerConnection *serverConn; -}; - - -EGLThreadInfo *getEGLThreadInfo(); -#endif diff --git a/emulator/opengl/tests/gles_android_wrapper/egl.cfg b/emulator/opengl/tests/gles_android_wrapper/egl.cfg deleted file mode 100644 index 891b07d..0000000 --- a/emulator/opengl/tests/gles_android_wrapper/egl.cfg +++ /dev/null @@ -1 +0,0 @@ -0 0 emul
\ No newline at end of file diff --git a/emulator/opengl/tests/gles_android_wrapper/egl.cpp b/emulator/opengl/tests/gles_android_wrapper/egl.cpp deleted file mode 100644 index 1e2e456..0000000 --- a/emulator/opengl/tests/gles_android_wrapper/egl.cpp +++ /dev/null @@ -1,663 +0,0 @@ -/* -* Copyright (C) 2011 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// -// WARNING -------------------------- WARNING -// This code meant to be used for testing purposes only. It is not production -// level quality. -// Use on your own risk !! -// - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <dlfcn.h> -#include "egl_dispatch.h" -#include "egl_ftable.h" -#include <cutils/process_name.h> -#include <cutils/log.h> -#include "ServerConnection.h" -#include "ThreadInfo.h" -#include <pthread.h> -#include "gl_wrapper_context.h" -#include "gl2_wrapper_context.h" - -#define GLES_EMUL_TARGETS_FILE "/system/etc/gles_emul.cfg" -// implementation libraries; -#define GLESv1_enc_LIB "/system/lib/libGLESv1_enc.so" -#define GLESv2_enc_LIB "/system/lib/libGLESv2_enc.so" -#define GLES_android_LIB "/system/lib/egl/libGLES_android.so" -// driver libraries; -#define GLESv1_DRIVER "/system/lib/egl/libGLESv1_CM_emul.so" -#define GLESv2_DRIVER "/system/lib/egl/libGLESv2_emul.so" - - -static struct egl_dispatch *s_dispatch = NULL; -pthread_once_t dispatchTablesInitialized = PTHREAD_ONCE_INIT; - -static bool s_needEncode = false; - -static gl_wrapper_context_t *g_gl_dispatch = NULL; -static gl2_wrapper_context_t *g_gl2_dispatch = NULL; - -template <class T> -int initApi(const char *driverLibName, const char *implLibName, T **dispatchTable, T *(*accessor)()) -{ - void *driverLib = dlopen(driverLibName, RTLD_NOW | RTLD_LOCAL); - if (driverLib == NULL) { - ALOGE("failed to load %s : %s\n", driverLibName, dlerror()); - return -1; - } - - typedef T *(*createFcn_t)(void *, T *(*accessor)()); - createFcn_t createFcn; - createFcn = (createFcn_t) dlsym(driverLib, "createFromLib"); - if (createFcn == NULL) { - ALOGE("failed to load createFromLib constructor function\n"); - return -1; - } - - void *implLib = dlopen(implLibName, RTLD_NOW | RTLD_LOCAL); - if (implLib == NULL) { - ALOGE("couldn't open %s", implLibName); - return -2; - } - *dispatchTable = createFcn(implLib, accessor); - if (*dispatchTable == NULL) { - return -3; - } - - // XXX - we do close the impl library since it doesn't have data, as far as we concern. - dlclose(implLib); - - // XXX - we do not dlclose the driver library, so its not initialized when - // later loaded by android - is this required? - ALOGD("loading %s into %s complete\n", implLibName, driverLibName); - return 0; - -} - -static gl_wrapper_context_t *getGLContext() -{ - return g_gl_dispatch; -} - -static gl2_wrapper_context_t *getGL2Context() -{ - return g_gl2_dispatch; -} - -const char *getProcName() -{ - static const char *procname = NULL; - - if (procname == NULL) { - const char *str = get_process_name(); - if (strcmp(str, "unknown") != 0) { - procname = str; - } else { - // we need to obtain our process name from the command line; - FILE *fp = fopen("/proc/self/cmdline", "rt"); - if (fp == NULL) { - ALOGE("couldn't open /proc/self/cmdline\n"); - return NULL; - } - - char line[1000]; - if (fgets(line, sizeof(line), fp) == NULL) { - ALOGE("couldn't read the self cmdline from \n"); - fclose(fp); - return NULL; - } - fclose(fp); - - if (line[0] == '\0') { - ALOGE("cmdline is empty\n"); - return NULL; - } - - //obtain the basename; - line[sizeof(line) - 1] = '\0'; - char *p = line; - while (*p != '\0' && - *p != '\t' && - *p != ' ' && - *p != '\n') { - p++; - } - - *p = '\0'; p--; - while (p > line && *p != '/') p--; - if (*p == '/') p++; - procname = strdup(p); - } - } - - return procname; -} - - - -bool isNeedEncode() -{ - const char *procname = getProcName(); - if (procname == NULL) return false; - ALOGD("isNeedEncode? for %s\n", procname); - // check on our whitelist - FILE *fp = fopen(GLES_EMUL_TARGETS_FILE, "rt"); - if (fp == NULL) { - ALOGE("couldn't open %s\n", GLES_EMUL_TARGETS_FILE); - return false; - } - - char line[100]; - bool found = false; - size_t procnameLen = strlen(procname); - - while (fgets(line, sizeof(line), fp) != NULL) { - if (strlen(line) >= procnameLen && - !strncmp(procname, line, procnameLen)) { - char c = line[procnameLen]; - if (c == '\0' || c == ' ' || c == '\t' || c == '\n') { - found = true; - ALOGD("should use encoder for %s\n", procname); - break; - } - } - } - fclose(fp); - return found; -} - -void initDispatchTables() -{ - // - // Load our back-end implementation of EGL/GLES - // - ALOGD("Loading egl dispatch for %s\n", getProcName()); - - void *gles_android = dlopen("/system/lib/egl/libGLES_android.so", RTLD_NOW | RTLD_LOCAL); - if (!gles_android) { - fprintf(stderr,"FATAL ERROR: Could not load libGLES_android lib\n"); - exit(-1); - } - - // - // Load back-end EGL implementation library - // - s_dispatch = create_egl_dispatch( gles_android ); - if (!s_dispatch) { - fprintf(stderr,"FATAL ERROR: Could not create egl dispatch\n"); - exit(-1); - } - - // - // initialize gles - // - s_needEncode = isNeedEncode(); - void *gles_encoder = NULL; - if (s_needEncode) { - // initialize a connection to the server, and the GLESv1/v2 encoders; - ServerConnection * connection = ServerConnection::s_getServerConnection(); - if (connection == NULL) { - ALOGE("couldn't create server connection\n"); - s_needEncode = false; - } - } - - // init dispatch tabels for GLESv1 & GLESv2 - if (s_needEncode) { - // XXX - we do not check the retrun value because there isn't much we can do here on failure. - - if (initApi<gl_wrapper_context_t>(GLESv1_DRIVER, GLESv1_enc_LIB, &g_gl_dispatch, getGLContext) < 0) { - // fallback to android on faluire - s_needEncode = false; - } else { - initApi<gl2_wrapper_context_t>(GLESv2_DRIVER, GLESv2_enc_LIB, &g_gl2_dispatch, getGL2Context); - } - } - - if (!s_needEncode) { - ALOGD("Initializing native opengl for %s\n", getProcName()); - initApi<gl_wrapper_context_t>(GLESv1_DRIVER, GLES_android_LIB, &g_gl_dispatch, getGLContext); - // try to initialize gl2 from GLES, though its probably going to fail - initApi<gl2_wrapper_context_t>(GLESv2_DRIVER, GLES_android_LIB, &g_gl2_dispatch, getGL2Context); - } -} - -static struct egl_dispatch *getDispatch() -{ - pthread_once(&dispatchTablesInitialized, initDispatchTables); - return s_dispatch; -} - -__eglMustCastToProperFunctionPointerType eglGetProcAddress(const char *procname) -{ - - // search in EGL function table - for (int i=0; i<egl_num_funcs; i++) { - if (!strcmp(egl_funcs_by_name[i].name, procname)) { - return (__eglMustCastToProperFunctionPointerType)egl_funcs_by_name[i].proc; - } - } - - // we do not support eglGetProcAddress for GLESv1 & GLESv2. The loader - // should be able to find this function through dynamic loading. - return NULL; -} - -//////////////// Path through functions ////////// - -EGLint eglGetError() -{ - return getDispatch()->eglGetError(); -} - -EGLDisplay eglGetDisplay(EGLNativeDisplayType display_id) -{ - return getDispatch()->eglGetDisplay(display_id); -} - -EGLBoolean eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor) -{ - return getDispatch()->eglInitialize(dpy, major, minor); -} - -EGLBoolean eglTerminate(EGLDisplay dpy) -{ - return getDispatch()->eglTerminate(dpy); -} - -const char* eglQueryString(EGLDisplay dpy, EGLint name) -{ - return getDispatch()->eglQueryString(dpy, name); -} - -EGLBoolean eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config) -{ - return getDispatch()->eglGetConfigs(dpy, configs, config_size, num_config); -} - -static EGLint * filter_es2_bit(const EGLint *attrib_list, bool *isES2) -{ - if (attrib_list == NULL) { - if (isES2 != NULL) *isES2 = false; - return NULL; - } - - EGLint *attribs = NULL; - int nAttribs = 0; - while(attrib_list[nAttribs] != EGL_NONE) nAttribs++; - nAttribs++; - - attribs = new EGLint[nAttribs]; - memcpy(attribs, attrib_list, nAttribs * sizeof(EGLint)); - if (isES2 != NULL) *isES2 = false; - - // scan the attribute list for ES2 request and replace with ES1. - for (int i = 0; i < nAttribs; i++) { - if (attribs[i] == EGL_RENDERABLE_TYPE) { - if (attribs[i + 1] & EGL_OPENGL_ES2_BIT) { - attribs[i + 1] &= ~EGL_OPENGL_ES2_BIT; - attribs[i + 1] |= EGL_OPENGL_ES_BIT; - ALOGD("removing ES2 bit 0x%x\n", attribs[i + 1]); - if (isES2 != NULL) *isES2 = true; - } - } - } - return attribs; -} - -EGLBoolean eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config) -{ - EGLBoolean res; - if (s_needEncode) { - EGLint *attribs = filter_es2_bit(attrib_list, NULL); - res = getDispatch()->eglChooseConfig(dpy, - attribs, - configs, - config_size, - num_config); - ALOGD("eglChooseConfig: %d configs found\n", *num_config); - if (*num_config == 0 && attribs != NULL) { - ALOGD("requested attributes:\n"); - for (int i = 0; attribs[i] != EGL_NONE; i++) { - ALOGD("%d: 0x%x\n", i, attribs[i]); - } - } - - delete attribs; - } else { - res = getDispatch()->eglChooseConfig(dpy, attrib_list, configs, config_size, num_config); - } - return res; -} - -EGLBoolean eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value) -{ - if (s_needEncode && attribute == EGL_RENDERABLE_TYPE) { - *value = EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT; - return EGL_TRUE; - } else { - return getDispatch()->eglGetConfigAttrib(dpy, config, attribute, value); - } -} - -EGLSurface eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list) -{ - EGLSurface surface = getDispatch()->eglCreateWindowSurface(dpy, config, win, attrib_list); - if (surface != EGL_NO_SURFACE) { - ServerConnection *server; - if (s_needEncode && (server = ServerConnection::s_getServerConnection()) != NULL) { - server->utEnc()->createSurface(server->utEnc(), getpid(), (uint32_t)surface); - } - } - return surface; -} - -EGLSurface eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list) -{ - EGLSurface surface = getDispatch()->eglCreatePbufferSurface(dpy, config, attrib_list); - if (surface != EGL_NO_SURFACE) { - ServerConnection *server; - if (s_needEncode && (server = ServerConnection::s_getServerConnection()) != NULL) { - server->utEnc()->createSurface(server->utEnc(), getpid(), (uint32_t)surface); - } - } - return surface; -} - -EGLSurface eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list) -{ - EGLSurface surface = getDispatch()->eglCreatePixmapSurface(dpy, config, pixmap, attrib_list); - if (surface != EGL_NO_SURFACE) { - ServerConnection *server; - if (s_needEncode && (server = ServerConnection::s_getServerConnection()) != NULL) { - server->utEnc()->createSurface(server->utEnc(), getpid(), (uint32_t)surface); - } - } - return surface; -} - -EGLBoolean eglDestroySurface(EGLDisplay dpy, EGLSurface surface) -{ - EGLBoolean res = getDispatch()->eglDestroySurface(dpy, surface); - if (res && surface != EGL_NO_SURFACE) { - ServerConnection *server; - if (s_needEncode && (server = ServerConnection::s_getServerConnection()) != NULL) { - server->utEnc()->destroySurface(server->utEnc(), getpid(), (uint32_t)surface); - } - } - return res; -} - -EGLBoolean eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value) -{ - EGLBoolean res = getDispatch()->eglQuerySurface(dpy, surface, attribute, value); - if (res && attribute == EGL_RENDERABLE_TYPE) { - *value |= EGL_OPENGL_ES2_BIT; - } - return res; -} - -EGLBoolean eglBindAPI(EGLenum api) -{ - return getDispatch()->eglBindAPI(api); -} - -EGLenum eglQueryAPI() -{ - return getDispatch()->eglQueryAPI(); -} - -EGLBoolean eglWaitClient() -{ - return getDispatch()->eglWaitClient(); -} - -EGLBoolean eglReleaseThread() -{ - return getDispatch()->eglReleaseThread(); -} - -EGLSurface eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list) -{ - return getDispatch()->eglCreatePbufferFromClientBuffer(dpy, buftype, buffer, config, attrib_list); -} - -EGLBoolean eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value) -{ - return getDispatch()->eglSurfaceAttrib(dpy, surface, attribute, value); -} - -EGLBoolean eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) -{ - return getDispatch()->eglBindTexImage(dpy, surface, buffer); -} - -EGLBoolean eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) -{ - return getDispatch()->eglReleaseTexImage(dpy, surface, buffer); -} - -EGLBoolean eglSwapInterval(EGLDisplay dpy, EGLint interval) -{ - return getDispatch()->eglSwapInterval(dpy, interval); -} - -EGLContext eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list) -{ - - EGLContext share = share_context; - if (share) share = ((EGLWrapperContext *)share_context)->aglContext; - - // check if are ES2, and convert it to ES1. - int nAttribs = 0; - if (attrib_list != NULL) { - while(attrib_list[nAttribs] != EGL_NONE) { - nAttribs++; - } - nAttribs++; - } - - EGLint *attrib = NULL; - if (nAttribs > 0) { - attrib = new EGLint[nAttribs]; - memcpy(attrib, attrib_list, nAttribs * sizeof(EGLint)); - } - - int version = 1; - for (int i = 0; i < nAttribs; i++) { - if (attrib[i] == EGL_CONTEXT_CLIENT_VERSION && - attrib[i + 1] == 2) { - version = 2; - attrib[i + 1] = 1; // replace to version 1 - } - } - - EGLContext ctx = getDispatch()->eglCreateContext(dpy, config, share, attrib); - delete attrib; - EGLWrapperContext *wctx = new EGLWrapperContext(ctx, version); - if (ctx != EGL_NO_CONTEXT) { - ServerConnection *server; - if (s_needEncode && (server = ServerConnection::s_getServerConnection()) != NULL) { - wctx->clientState = new GLClientState(); - server->utEnc()->createContext(server->utEnc(), getpid(), - (uint32_t)wctx, - (uint32_t)(share_context == EGL_NO_CONTEXT ? 0 : share_context), wctx->version); - } - } - return (EGLContext)wctx; -} - -EGLBoolean eglDestroyContext(EGLDisplay dpy, EGLContext ctx) -{ - EGLWrapperContext *wctx = (EGLWrapperContext *)ctx; - EGLBoolean res = EGL_FALSE; - - if (ctx && ctx != EGL_NO_CONTEXT) { - res = getDispatch()->eglDestroyContext(dpy, wctx->aglContext); - if (res) { - EGLThreadInfo *ti = getEGLThreadInfo(); - ServerConnection *server; - if (s_needEncode && (server = ServerConnection::s_getServerConnection())) { - server->utEnc()->destroyContext(ti->serverConn->utEnc(), getpid(), (uint32_t)ctx); - } - if (ti->currentContext == wctx) ti->currentContext = NULL; - delete wctx; - } - } - - return res; -} - -EGLBoolean eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx) -{ - EGLWrapperContext *wctx = (EGLWrapperContext *)ctx; - EGLContext aglContext = (ctx == EGL_NO_CONTEXT ? EGL_NO_CONTEXT : wctx->aglContext); - EGLThreadInfo *ti = getEGLThreadInfo(); - EGLBoolean res = getDispatch()->eglMakeCurrent(dpy, draw, read, aglContext); - if (res ) { - // NOTE - we do get a pointer to the server connection, (rather then using ti->serverConn) - // for cases that this is the first egl call of the current thread. - - ServerConnection *server; - if (s_needEncode && (server = ServerConnection::s_getServerConnection())) { - server->utEnc()->makeCurrentContext(server->utEnc(), getpid(), - (uint32_t) (draw == EGL_NO_SURFACE ? 0 : draw), - (uint32_t) (read == EGL_NO_SURFACE ? 0 : read), - (uint32_t) (ctx == EGL_NO_CONTEXT ? 0 : ctx)); - server->glEncoder()->setClientState( wctx ? wctx->clientState : NULL ); - server->gl2Encoder()->setClientState( wctx ? wctx->clientState : NULL ); - } - - // set current context in our thread info - ti->currentContext = wctx; - } - return res; - -} - -EGLContext eglGetCurrentContext() -{ - EGLThreadInfo *ti = getEGLThreadInfo(); - return (ti->currentContext ? ti->currentContext : EGL_NO_CONTEXT); -} - -EGLSurface eglGetCurrentSurface(EGLint readdraw) -{ - return getDispatch()->eglGetCurrentSurface(readdraw); -} - -EGLDisplay eglGetCurrentDisplay() -{ - return getDispatch()->eglGetCurrentDisplay(); -} - -EGLBoolean eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value) -{ - EGLWrapperContext *wctx = (EGLWrapperContext *)ctx; - if (wctx) { - if (attribute == EGL_CONTEXT_CLIENT_VERSION) { - *value = wctx->version; - return EGL_TRUE; - } else { - return getDispatch()->eglQueryContext(dpy, wctx->aglContext, attribute, value); - } - } - else { - return EGL_BAD_CONTEXT; - } -} - -EGLBoolean eglWaitGL() -{ - return getDispatch()->eglWaitGL(); -} - -EGLBoolean eglWaitNative(EGLint engine) -{ - return getDispatch()->eglWaitNative(engine); -} - -EGLBoolean eglSwapBuffers(EGLDisplay dpy, EGLSurface surface) -{ - ServerConnection *server; - if (s_needEncode && (server = ServerConnection::s_getServerConnection()) != NULL) { - server->utEnc()->swapBuffers(server->utEnc(), getpid(), (uint32_t)surface); - server->glEncoder()->flush(); - server->gl2Encoder()->flush(); - return 1; - } - return getDispatch()->eglSwapBuffers(dpy, surface); -} - -EGLBoolean eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target) -{ - return getDispatch()->eglCopyBuffers(dpy, surface, target); -} - -EGLBoolean eglLockSurfaceKHR(EGLDisplay display, EGLSurface surface, const EGLint *attrib_list) -{ - return getDispatch()->eglLockSurfaceKHR(display, surface, attrib_list); -} - -EGLBoolean eglUnlockSurfaceKHR(EGLDisplay display, EGLSurface surface) -{ - return getDispatch()->eglUnlockSurfaceKHR(display, surface); -} - -EGLImageKHR eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list) -{ - EGLWrapperContext *wctx = (EGLWrapperContext *)ctx; - EGLContext aglContext = (wctx ? wctx->aglContext : EGL_NO_CONTEXT); - return getDispatch()->eglCreateImageKHR(dpy, aglContext, target, buffer, attrib_list); -} - -EGLBoolean eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR image) -{ - return getDispatch()->eglDestroyImageKHR(dpy, image); -} - -EGLSyncKHR eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list) -{ - return getDispatch()->eglCreateSyncKHR(dpy, type, attrib_list); -} - -EGLBoolean eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync) -{ - return getDispatch()->eglDestroySyncKHR(dpy, sync); -} - -EGLint eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout) -{ - return getDispatch()->eglClientWaitSyncKHR(dpy, sync, flags, timeout); -} - -EGLBoolean eglSignalSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode) -{ - return getDispatch()->eglSignalSyncKHR(dpy, sync, mode); -} - -EGLBoolean eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value) -{ - return getDispatch()->eglGetSyncAttribKHR(dpy, sync, attribute, value); -} - -EGLBoolean eglSetSwapRectangleANDROID(EGLDisplay dpy, EGLSurface draw, EGLint left, EGLint top, EGLint width, EGLint height) -{ - return getDispatch()->eglSetSwapRectangleANDROID(dpy, draw, left, top, width, height); -} diff --git a/emulator/opengl/tests/gles_android_wrapper/egl_dispatch.cpp b/emulator/opengl/tests/gles_android_wrapper/egl_dispatch.cpp deleted file mode 100644 index f69ca61..0000000 --- a/emulator/opengl/tests/gles_android_wrapper/egl_dispatch.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* -* Copyright (C) 2011 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -#include <stdio.h> -#include "egl_dispatch.h" -#include <dlfcn.h> - -egl_dispatch *create_egl_dispatch(void *gles_android) -{ - egl_dispatch *disp = new egl_dispatch; - - void *ptr; - ptr = dlsym(gles_android,"eglGetError"); disp->set_eglGetError((eglGetError_t)ptr); - ptr = dlsym(gles_android,"eglGetDisplay"); disp->set_eglGetDisplay((eglGetDisplay_t)ptr); - ptr = dlsym(gles_android,"eglInitialize"); disp->set_eglInitialize((eglInitialize_t)ptr); - ptr = dlsym(gles_android,"eglTerminate"); disp->set_eglTerminate((eglTerminate_t)ptr); - ptr = dlsym(gles_android,"eglQueryString"); disp->set_eglQueryString((eglQueryString_t)ptr); - ptr = dlsym(gles_android,"eglGetConfigs"); disp->set_eglGetConfigs((eglGetConfigs_t)ptr); - ptr = dlsym(gles_android,"eglChooseConfig"); disp->set_eglChooseConfig((eglChooseConfig_t)ptr); - ptr = dlsym(gles_android,"eglGetConfigAttrib"); disp->set_eglGetConfigAttrib((eglGetConfigAttrib_t)ptr); - ptr = dlsym(gles_android,"eglCreateWindowSurface"); disp->set_eglCreateWindowSurface((eglCreateWindowSurface_t)ptr); - ptr = dlsym(gles_android,"eglCreatePbufferSurface"); disp->set_eglCreatePbufferSurface((eglCreatePbufferSurface_t)ptr); - ptr = dlsym(gles_android,"eglCreatePixmapSurface"); disp->set_eglCreatePixmapSurface((eglCreatePixmapSurface_t)ptr); - ptr = dlsym(gles_android,"eglDestroySurface"); disp->set_eglDestroySurface((eglDestroySurface_t)ptr); - ptr = dlsym(gles_android,"eglQuerySurface"); disp->set_eglQuerySurface((eglQuerySurface_t)ptr); - ptr = dlsym(gles_android,"eglBindAPI"); disp->set_eglBindAPI((eglBindAPI_t)ptr); - ptr = dlsym(gles_android,"eglQueryAPI"); disp->set_eglQueryAPI((eglQueryAPI_t)ptr); - ptr = dlsym(gles_android,"eglWaitClient"); disp->set_eglWaitClient((eglWaitClient_t)ptr); - ptr = dlsym(gles_android,"eglReleaseThread"); disp->set_eglReleaseThread((eglReleaseThread_t)ptr); - ptr = dlsym(gles_android,"eglCreatePbufferFromClientBuffer"); disp->set_eglCreatePbufferFromClientBuffer((eglCreatePbufferFromClientBuffer_t)ptr); - ptr = dlsym(gles_android,"eglSurfaceAttrib"); disp->set_eglSurfaceAttrib((eglSurfaceAttrib_t)ptr); - ptr = dlsym(gles_android,"eglBindTexImage"); disp->set_eglBindTexImage((eglBindTexImage_t)ptr); - ptr = dlsym(gles_android,"eglReleaseTexImage"); disp->set_eglReleaseTexImage((eglReleaseTexImage_t)ptr); - ptr = dlsym(gles_android,"eglSwapInterval"); disp->set_eglSwapInterval((eglSwapInterval_t)ptr); - ptr = dlsym(gles_android,"eglCreateContext"); disp->set_eglCreateContext((eglCreateContext_t)ptr); - ptr = dlsym(gles_android,"eglDestroyContext"); disp->set_eglDestroyContext((eglDestroyContext_t)ptr); - ptr = dlsym(gles_android,"eglMakeCurrent"); disp->set_eglMakeCurrent((eglMakeCurrent_t)ptr); - ptr = dlsym(gles_android,"eglGetCurrentContext"); disp->set_eglGetCurrentContext((eglGetCurrentContext_t)ptr); - ptr = dlsym(gles_android,"eglGetCurrentSurface"); disp->set_eglGetCurrentSurface((eglGetCurrentSurface_t)ptr); - ptr = dlsym(gles_android,"eglGetCurrentDisplay"); disp->set_eglGetCurrentDisplay((eglGetCurrentDisplay_t)ptr); - ptr = dlsym(gles_android,"eglQueryContext"); disp->set_eglQueryContext((eglQueryContext_t)ptr); - ptr = dlsym(gles_android,"eglWaitGL"); disp->set_eglWaitGL((eglWaitGL_t)ptr); - ptr = dlsym(gles_android,"eglWaitNative"); disp->set_eglWaitNative((eglWaitNative_t)ptr); - ptr = dlsym(gles_android,"eglSwapBuffers"); disp->set_eglSwapBuffers((eglSwapBuffers_t)ptr); - ptr = dlsym(gles_android,"eglCopyBuffers"); disp->set_eglCopyBuffers((eglCopyBuffers_t)ptr); - ptr = dlsym(gles_android,"eglGetProcAddress"); disp->set_eglGetProcAddress((eglGetProcAddress_t)ptr); - ptr = dlsym(gles_android,"eglLockSurfaceKHR"); disp->set_eglLockSurfaceKHR((eglLockSurfaceKHR_t)ptr); - ptr = dlsym(gles_android,"eglUnlockSurfaceKHR"); disp->set_eglUnlockSurfaceKHR((eglUnlockSurfaceKHR_t)ptr); - ptr = dlsym(gles_android,"eglCreateImageKHR"); disp->set_eglCreateImageKHR((eglCreateImageKHR_t)ptr); - ptr = dlsym(gles_android,"eglDestroyImageKHR"); disp->set_eglDestroyImageKHR((eglDestroyImageKHR_t)ptr); - ptr = dlsym(gles_android,"eglCreateSyncKHR"); disp->set_eglCreateSyncKHR((eglCreateSyncKHR_t)ptr); - ptr = dlsym(gles_android,"eglDestroySyncKHR"); disp->set_eglDestroySyncKHR((eglDestroySyncKHR_t)ptr); - ptr = dlsym(gles_android,"eglClientWaitSyncKHR"); disp->set_eglClientWaitSyncKHR((eglClientWaitSyncKHR_t)ptr); - ptr = dlsym(gles_android,"eglSignalSyncKHR"); disp->set_eglSignalSyncKHR((eglSignalSyncKHR_t)ptr); - ptr = dlsym(gles_android,"eglGetSyncAttribKHR"); disp->set_eglGetSyncAttribKHR((eglGetSyncAttribKHR_t)ptr); - ptr = dlsym(gles_android,"eglSetSwapRectangleANDROID"); disp->set_eglSetSwapRectangleANDROID((eglSetSwapRectangleANDROID_t)ptr); - - return disp; -} diff --git a/emulator/opengl/tests/gles_android_wrapper/egl_dispatch.h b/emulator/opengl/tests/gles_android_wrapper/egl_dispatch.h deleted file mode 100644 index 1b8de0d..0000000 --- a/emulator/opengl/tests/gles_android_wrapper/egl_dispatch.h +++ /dev/null @@ -1,115 +0,0 @@ -/* -* Copyright (C) 2011 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -#ifndef _EGL_DISPATCH_H -#define _EGL_DISPATCH_H - -#include "egl_proc.h" - -struct egl_dispatch { - eglGetError_t eglGetError; - eglGetDisplay_t eglGetDisplay; - eglInitialize_t eglInitialize; - eglTerminate_t eglTerminate; - eglQueryString_t eglQueryString; - eglGetConfigs_t eglGetConfigs; - eglChooseConfig_t eglChooseConfig; - eglGetConfigAttrib_t eglGetConfigAttrib; - eglCreateWindowSurface_t eglCreateWindowSurface; - eglCreatePbufferSurface_t eglCreatePbufferSurface; - eglCreatePixmapSurface_t eglCreatePixmapSurface; - eglDestroySurface_t eglDestroySurface; - eglQuerySurface_t eglQuerySurface; - eglBindAPI_t eglBindAPI; - eglQueryAPI_t eglQueryAPI; - eglWaitClient_t eglWaitClient; - eglReleaseThread_t eglReleaseThread; - eglCreatePbufferFromClientBuffer_t eglCreatePbufferFromClientBuffer; - eglSurfaceAttrib_t eglSurfaceAttrib; - eglBindTexImage_t eglBindTexImage; - eglReleaseTexImage_t eglReleaseTexImage; - eglSwapInterval_t eglSwapInterval; - eglCreateContext_t eglCreateContext; - eglDestroyContext_t eglDestroyContext; - eglMakeCurrent_t eglMakeCurrent; - eglGetCurrentContext_t eglGetCurrentContext; - eglGetCurrentSurface_t eglGetCurrentSurface; - eglGetCurrentDisplay_t eglGetCurrentDisplay; - eglQueryContext_t eglQueryContext; - eglWaitGL_t eglWaitGL; - eglWaitNative_t eglWaitNative; - eglSwapBuffers_t eglSwapBuffers; - eglCopyBuffers_t eglCopyBuffers; - eglGetProcAddress_t eglGetProcAddress; - eglLockSurfaceKHR_t eglLockSurfaceKHR; - eglUnlockSurfaceKHR_t eglUnlockSurfaceKHR; - eglCreateImageKHR_t eglCreateImageKHR; - eglDestroyImageKHR_t eglDestroyImageKHR; - eglCreateSyncKHR_t eglCreateSyncKHR; - eglDestroySyncKHR_t eglDestroySyncKHR; - eglClientWaitSyncKHR_t eglClientWaitSyncKHR; - eglSignalSyncKHR_t eglSignalSyncKHR; - eglGetSyncAttribKHR_t eglGetSyncAttribKHR; - eglSetSwapRectangleANDROID_t eglSetSwapRectangleANDROID; - //Accessors - eglGetError_t set_eglGetError(eglGetError_t f) { eglGetError_t retval = eglGetError; eglGetError = f; return retval;} - eglGetDisplay_t set_eglGetDisplay(eglGetDisplay_t f) { eglGetDisplay_t retval = eglGetDisplay; eglGetDisplay = f; return retval;} - eglInitialize_t set_eglInitialize(eglInitialize_t f) { eglInitialize_t retval = eglInitialize; eglInitialize = f; return retval;} - eglTerminate_t set_eglTerminate(eglTerminate_t f) { eglTerminate_t retval = eglTerminate; eglTerminate = f; return retval;} - eglQueryString_t set_eglQueryString(eglQueryString_t f) { eglQueryString_t retval = eglQueryString; eglQueryString = f; return retval;} - eglGetConfigs_t set_eglGetConfigs(eglGetConfigs_t f) { eglGetConfigs_t retval = eglGetConfigs; eglGetConfigs = f; return retval;} - eglChooseConfig_t set_eglChooseConfig(eglChooseConfig_t f) { eglChooseConfig_t retval = eglChooseConfig; eglChooseConfig = f; return retval;} - eglGetConfigAttrib_t set_eglGetConfigAttrib(eglGetConfigAttrib_t f) { eglGetConfigAttrib_t retval = eglGetConfigAttrib; eglGetConfigAttrib = f; return retval;} - eglCreateWindowSurface_t set_eglCreateWindowSurface(eglCreateWindowSurface_t f) { eglCreateWindowSurface_t retval = eglCreateWindowSurface; eglCreateWindowSurface = f; return retval;} - eglCreatePbufferSurface_t set_eglCreatePbufferSurface(eglCreatePbufferSurface_t f) { eglCreatePbufferSurface_t retval = eglCreatePbufferSurface; eglCreatePbufferSurface = f; return retval;} - eglCreatePixmapSurface_t set_eglCreatePixmapSurface(eglCreatePixmapSurface_t f) { eglCreatePixmapSurface_t retval = eglCreatePixmapSurface; eglCreatePixmapSurface = f; return retval;} - eglDestroySurface_t set_eglDestroySurface(eglDestroySurface_t f) { eglDestroySurface_t retval = eglDestroySurface; eglDestroySurface = f; return retval;} - eglQuerySurface_t set_eglQuerySurface(eglQuerySurface_t f) { eglQuerySurface_t retval = eglQuerySurface; eglQuerySurface = f; return retval;} - eglBindAPI_t set_eglBindAPI(eglBindAPI_t f) { eglBindAPI_t retval = eglBindAPI; eglBindAPI = f; return retval;} - eglQueryAPI_t set_eglQueryAPI(eglQueryAPI_t f) { eglQueryAPI_t retval = eglQueryAPI; eglQueryAPI = f; return retval;} - eglWaitClient_t set_eglWaitClient(eglWaitClient_t f) { eglWaitClient_t retval = eglWaitClient; eglWaitClient = f; return retval;} - eglReleaseThread_t set_eglReleaseThread(eglReleaseThread_t f) { eglReleaseThread_t retval = eglReleaseThread; eglReleaseThread = f; return retval;} - eglCreatePbufferFromClientBuffer_t set_eglCreatePbufferFromClientBuffer(eglCreatePbufferFromClientBuffer_t f) { eglCreatePbufferFromClientBuffer_t retval = eglCreatePbufferFromClientBuffer; eglCreatePbufferFromClientBuffer = f; return retval;} - eglSurfaceAttrib_t set_eglSurfaceAttrib(eglSurfaceAttrib_t f) { eglSurfaceAttrib_t retval = eglSurfaceAttrib; eglSurfaceAttrib = f; return retval;} - eglBindTexImage_t set_eglBindTexImage(eglBindTexImage_t f) { eglBindTexImage_t retval = eglBindTexImage; eglBindTexImage = f; return retval;} - eglReleaseTexImage_t set_eglReleaseTexImage(eglReleaseTexImage_t f) { eglReleaseTexImage_t retval = eglReleaseTexImage; eglReleaseTexImage = f; return retval;} - eglSwapInterval_t set_eglSwapInterval(eglSwapInterval_t f) { eglSwapInterval_t retval = eglSwapInterval; eglSwapInterval = f; return retval;} - eglCreateContext_t set_eglCreateContext(eglCreateContext_t f) { eglCreateContext_t retval = eglCreateContext; eglCreateContext = f; return retval;} - eglDestroyContext_t set_eglDestroyContext(eglDestroyContext_t f) { eglDestroyContext_t retval = eglDestroyContext; eglDestroyContext = f; return retval;} - eglMakeCurrent_t set_eglMakeCurrent(eglMakeCurrent_t f) { eglMakeCurrent_t retval = eglMakeCurrent; eglMakeCurrent = f; return retval;} - eglGetCurrentContext_t set_eglGetCurrentContext(eglGetCurrentContext_t f) { eglGetCurrentContext_t retval = eglGetCurrentContext; eglGetCurrentContext = f; return retval;} - eglGetCurrentSurface_t set_eglGetCurrentSurface(eglGetCurrentSurface_t f) { eglGetCurrentSurface_t retval = eglGetCurrentSurface; eglGetCurrentSurface = f; return retval;} - eglGetCurrentDisplay_t set_eglGetCurrentDisplay(eglGetCurrentDisplay_t f) { eglGetCurrentDisplay_t retval = eglGetCurrentDisplay; eglGetCurrentDisplay = f; return retval;} - eglQueryContext_t set_eglQueryContext(eglQueryContext_t f) { eglQueryContext_t retval = eglQueryContext; eglQueryContext = f; return retval;} - eglWaitGL_t set_eglWaitGL(eglWaitGL_t f) { eglWaitGL_t retval = eglWaitGL; eglWaitGL = f; return retval;} - eglWaitNative_t set_eglWaitNative(eglWaitNative_t f) { eglWaitNative_t retval = eglWaitNative; eglWaitNative = f; return retval;} - eglSwapBuffers_t set_eglSwapBuffers(eglSwapBuffers_t f) { eglSwapBuffers_t retval = eglSwapBuffers; eglSwapBuffers = f; return retval;} - eglCopyBuffers_t set_eglCopyBuffers(eglCopyBuffers_t f) { eglCopyBuffers_t retval = eglCopyBuffers; eglCopyBuffers = f; return retval;} - eglGetProcAddress_t set_eglGetProcAddress(eglGetProcAddress_t f) { eglGetProcAddress_t retval = eglGetProcAddress; eglGetProcAddress = f; return retval;} - eglLockSurfaceKHR_t set_eglLockSurfaceKHR(eglLockSurfaceKHR_t f) { eglLockSurfaceKHR_t retval = eglLockSurfaceKHR; eglLockSurfaceKHR = f; return retval;} - eglUnlockSurfaceKHR_t set_eglUnlockSurfaceKHR(eglUnlockSurfaceKHR_t f) { eglUnlockSurfaceKHR_t retval = eglUnlockSurfaceKHR; eglUnlockSurfaceKHR = f; return retval;} - eglCreateImageKHR_t set_eglCreateImageKHR(eglCreateImageKHR_t f) { eglCreateImageKHR_t retval = eglCreateImageKHR; eglCreateImageKHR = f; return retval;} - eglDestroyImageKHR_t set_eglDestroyImageKHR(eglDestroyImageKHR_t f) { eglDestroyImageKHR_t retval = eglDestroyImageKHR; eglDestroyImageKHR = f; return retval;} - eglCreateSyncKHR_t set_eglCreateSyncKHR(eglCreateSyncKHR_t f) { eglCreateSyncKHR_t retval = eglCreateSyncKHR; eglCreateSyncKHR = f; return retval;} - eglDestroySyncKHR_t set_eglDestroySyncKHR(eglDestroySyncKHR_t f) { eglDestroySyncKHR_t retval = eglDestroySyncKHR; eglDestroySyncKHR = f; return retval;} - eglClientWaitSyncKHR_t set_eglClientWaitSyncKHR(eglClientWaitSyncKHR_t f) { eglClientWaitSyncKHR_t retval = eglClientWaitSyncKHR; eglClientWaitSyncKHR = f; return retval;} - eglSignalSyncKHR_t set_eglSignalSyncKHR(eglSignalSyncKHR_t f) { eglSignalSyncKHR_t retval = eglSignalSyncKHR; eglSignalSyncKHR = f; return retval;} - eglGetSyncAttribKHR_t set_eglGetSyncAttribKHR(eglGetSyncAttribKHR_t f) { eglGetSyncAttribKHR_t retval = eglGetSyncAttribKHR; eglGetSyncAttribKHR = f; return retval;} - eglSetSwapRectangleANDROID_t set_eglSetSwapRectangleANDROID(eglSetSwapRectangleANDROID_t f) { eglSetSwapRectangleANDROID_t retval = eglSetSwapRectangleANDROID; eglSetSwapRectangleANDROID = f; return retval;} -}; - -egl_dispatch *create_egl_dispatch(void *gles_andorid); - -#endif diff --git a/emulator/opengl/tests/gles_android_wrapper/egl_ftable.h b/emulator/opengl/tests/gles_android_wrapper/egl_ftable.h deleted file mode 100644 index ee40585..0000000 --- a/emulator/opengl/tests/gles_android_wrapper/egl_ftable.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -* Copyright (C) 2011 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -static struct _egl_funcs_by_name { - const char *name; - void *proc; -} egl_funcs_by_name[] = { - {"eglGetError", (void *)eglGetError}, - {"eglGetDisplay", (void *)eglGetDisplay}, - {"eglInitialize", (void *)eglInitialize}, - {"eglTerminate", (void *)eglTerminate}, - {"eglQueryString", (void *)eglQueryString}, - {"eglGetConfigs", (void *)eglGetConfigs}, - {"eglChooseConfig", (void *)eglChooseConfig}, - {"eglGetConfigAttrib", (void *)eglGetConfigAttrib}, - {"eglCreateWindowSurface", (void *)eglCreateWindowSurface}, - {"eglCreatePbufferSurface", (void *)eglCreatePbufferSurface}, - {"eglCreatePixmapSurface", (void *)eglCreatePixmapSurface}, - {"eglDestroySurface", (void *)eglDestroySurface}, - {"eglQuerySurface", (void *)eglQuerySurface}, - {"eglBindAPI", (void *)eglBindAPI}, - {"eglQueryAPI", (void *)eglQueryAPI}, - {"eglWaitClient", (void *)eglWaitClient}, - {"eglReleaseThread", (void *)eglReleaseThread}, - {"eglCreatePbufferFromClientBuffer", (void *)eglCreatePbufferFromClientBuffer}, - {"eglSurfaceAttrib", (void *)eglSurfaceAttrib}, - {"eglBindTexImage", (void *)eglBindTexImage}, - {"eglReleaseTexImage", (void *)eglReleaseTexImage}, - {"eglSwapInterval", (void *)eglSwapInterval}, - {"eglCreateContext", (void *)eglCreateContext}, - {"eglDestroyContext", (void *)eglDestroyContext}, - {"eglMakeCurrent", (void *)eglMakeCurrent}, - {"eglGetCurrentContext", (void *)eglGetCurrentContext}, - {"eglGetCurrentSurface", (void *)eglGetCurrentSurface}, - {"eglGetCurrentDisplay", (void *)eglGetCurrentDisplay}, - {"eglQueryContext", (void *)eglQueryContext}, - {"eglWaitGL", (void *)eglWaitGL}, - {"eglWaitNative", (void *)eglWaitNative}, - {"eglSwapBuffers", (void *)eglSwapBuffers}, - {"eglCopyBuffers", (void *)eglCopyBuffers}, - {"eglGetProcAddress", (void *)eglGetProcAddress}, - {"eglLockSurfaceKHR", (void *)eglLockSurfaceKHR}, - {"eglUnlockSurfaceKHR", (void *)eglUnlockSurfaceKHR}, - {"eglCreateImageKHR", (void *)eglCreateImageKHR}, - {"eglDestroyImageKHR", (void *)eglDestroyImageKHR}, - {"eglCreateSyncKHR", (void *)eglCreateSyncKHR}, - {"eglDestroySyncKHR", (void *)eglDestroySyncKHR}, - {"eglClientWaitSyncKHR", (void *)eglClientWaitSyncKHR}, - {"eglSignalSyncKHR", (void *)eglSignalSyncKHR}, - {"eglGetSyncAttribKHR", (void *)eglGetSyncAttribKHR}, - {"eglSetSwapRectangleANDROID", (void *)eglSetSwapRectangleANDROID} -}; - -static int egl_num_funcs = sizeof(egl_funcs_by_name) / sizeof(struct _egl_funcs_by_name); diff --git a/emulator/opengl/tests/gles_android_wrapper/egl_proc.h b/emulator/opengl/tests/gles_android_wrapper/egl_proc.h deleted file mode 100644 index 140c030..0000000 --- a/emulator/opengl/tests/gles_android_wrapper/egl_proc.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -* Copyright (C) 2011 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -#ifndef _EGL_PROC_H -#define _EGL_PROC_H - -#include <EGL/egl.h> -#define EGL_EGLEXT_PROTOTYPES -#include <EGL/eglext.h> - -typedef EGLint (* eglGetError_t) (); -typedef EGLDisplay (* eglGetDisplay_t) (EGLNativeDisplayType); -typedef EGLBoolean (* eglInitialize_t) (EGLDisplay, EGLint*, EGLint*); -typedef EGLBoolean (* eglTerminate_t) (EGLDisplay); -typedef char* (* eglQueryString_t) (EGLDisplay, EGLint); -typedef EGLBoolean (* eglGetConfigs_t) (EGLDisplay, EGLConfig*, EGLint, EGLint*); -typedef EGLBoolean (* eglChooseConfig_t) (EGLDisplay, const EGLint*, EGLConfig*, EGLint, EGLint*); -typedef EGLBoolean (* eglGetConfigAttrib_t) (EGLDisplay, EGLConfig, EGLint, EGLint*); -typedef EGLSurface (* eglCreateWindowSurface_t) (EGLDisplay, EGLConfig, EGLNativeWindowType, const EGLint*); -typedef EGLSurface (* eglCreatePbufferSurface_t) (EGLDisplay, EGLConfig, const EGLint*); -typedef EGLSurface (* eglCreatePixmapSurface_t) (EGLDisplay, EGLConfig, EGLNativePixmapType, const EGLint*); -typedef EGLBoolean (* eglDestroySurface_t) (EGLDisplay, EGLSurface); -typedef EGLBoolean (* eglQuerySurface_t) (EGLDisplay, EGLSurface, EGLint, EGLint*); -typedef EGLBoolean (* eglBindAPI_t) (EGLenum); -typedef EGLenum (* eglQueryAPI_t) (); -typedef EGLBoolean (* eglWaitClient_t) (); -typedef EGLBoolean (* eglReleaseThread_t) (); -typedef EGLSurface (* eglCreatePbufferFromClientBuffer_t) (EGLDisplay, EGLenum, EGLClientBuffer, EGLConfig, const EGLint*); -typedef EGLBoolean (* eglSurfaceAttrib_t) (EGLDisplay, EGLSurface, EGLint, EGLint); -typedef EGLBoolean (* eglBindTexImage_t) (EGLDisplay, EGLSurface, EGLint); -typedef EGLBoolean (* eglReleaseTexImage_t) (EGLDisplay, EGLSurface, EGLint); -typedef EGLBoolean (* eglSwapInterval_t) (EGLDisplay, EGLint); -typedef EGLContext (* eglCreateContext_t) (EGLDisplay, EGLConfig, EGLContext, const EGLint*); -typedef EGLBoolean (* eglDestroyContext_t) (EGLDisplay, EGLContext); -typedef EGLBoolean (* eglMakeCurrent_t) (EGLDisplay, EGLSurface, EGLSurface, EGLContext); -typedef EGLContext (* eglGetCurrentContext_t) (); -typedef EGLSurface (* eglGetCurrentSurface_t) (EGLint); -typedef EGLDisplay (* eglGetCurrentDisplay_t) (); -typedef EGLBoolean (* eglQueryContext_t) (EGLDisplay, EGLContext, EGLint, EGLint*); -typedef EGLBoolean (* eglWaitGL_t) (); -typedef EGLBoolean (* eglWaitNative_t) (EGLint); -typedef EGLBoolean (* eglSwapBuffers_t) (EGLDisplay, EGLSurface); -typedef EGLBoolean (* eglCopyBuffers_t) (EGLDisplay, EGLSurface, EGLNativePixmapType); -typedef __eglMustCastToProperFunctionPointerType (* eglGetProcAddress_t) (const char*); -typedef EGLBoolean (* eglLockSurfaceKHR_t) (EGLDisplay, EGLSurface, const EGLint*); -typedef EGLBoolean (* eglUnlockSurfaceKHR_t) (EGLDisplay, EGLSurface); -typedef EGLImageKHR (* eglCreateImageKHR_t) (EGLDisplay, EGLContext, EGLenum, EGLClientBuffer, const EGLint*); -typedef EGLBoolean (* eglDestroyImageKHR_t) (EGLDisplay, EGLImageKHR image); -typedef EGLSyncKHR (* eglCreateSyncKHR_t) (EGLDisplay, EGLenum, const EGLint*); -typedef EGLBoolean (* eglDestroySyncKHR_t) (EGLDisplay, EGLSyncKHR sync); -typedef EGLint (* eglClientWaitSyncKHR_t) (EGLDisplay, EGLSyncKHR, EGLint, EGLTimeKHR timeout); -typedef EGLBoolean (* eglSignalSyncKHR_t) (EGLDisplay, EGLSyncKHR, EGLenum); -typedef EGLBoolean (* eglGetSyncAttribKHR_t) (EGLDisplay, EGLSyncKHR, EGLint, EGLint*); -typedef EGLBoolean (* eglSetSwapRectangleANDROID_t) (EGLDisplay, EGLSurface, EGLint, EGLint, EGLint, EGLint); - -#endif // of _EGL_PROC_H diff --git a/emulator/opengl/tests/gles_android_wrapper/gles.cpp b/emulator/opengl/tests/gles_android_wrapper/gles.cpp deleted file mode 100644 index c0949c8..0000000 --- a/emulator/opengl/tests/gles_android_wrapper/gles.cpp +++ /dev/null @@ -1,1410 +0,0 @@ -/* -* Copyright (C) 2011 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include "gles_dispatch.h" -#include "gles_ftable.h" -#include <EGL/egl.h> -#include <cutils/log.h> - -static struct gles_dispatch *s_dispatch = NULL; - -void init_gles(void *gles_android) -{ - s_dispatch = create_gles_dispatch(gles_android); - if (s_dispatch == NULL) { - ALOGE("failed to create gles dispatch\n"); - } -} - -static struct gles_dispatch *getDispatch() -{ - if (!s_dispatch) { - fprintf(stderr,"FATAL ERROR: GLES has not been initialized\n"); - exit(-1); - } - - return s_dispatch; -} - -__eglMustCastToProperFunctionPointerType gles_getProcAddress(const char *procname) -{ - for (int i=0; i<gles_num_funcs; i++) { - if (!strcmp(gles_funcs_by_name[i].name, procname)) { - return (__eglMustCastToProperFunctionPointerType)gles_funcs_by_name[i].proc; - } - } - - return NULL; -} - -///////////// Path-through functions /////////////// -void glAlphaFunc(GLenum func, GLclampf ref) -{ - getDispatch()->glAlphaFunc(func, ref); -} - -void glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) -{ - getDispatch()->glClearColor(red, green, blue, alpha); -} - -void glClearDepthf(GLclampf depth) -{ - getDispatch()->glClearDepthf(depth); -} - -void glClipPlanef(GLenum plane, const GLfloat *equation) -{ - getDispatch()->glClipPlanef(plane, equation); -} - -void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) -{ - getDispatch()->glColor4f(red, green, blue, alpha); -} - -void glDepthRangef(GLclampf zNear, GLclampf zFar) -{ - getDispatch()->glDepthRangef(zNear, zFar); -} - -void glFogf(GLenum pname, GLfloat param) -{ - getDispatch()->glFogf(pname, param); -} - -void glFogfv(GLenum pname, const GLfloat *params) -{ - getDispatch()->glFogfv(pname, params); -} - -void glFrustumf(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) -{ - getDispatch()->glFrustumf(left, right, bottom, top, zNear, zFar); -} - -void glGetClipPlanef(GLenum pname, GLfloat eqn[4]) -{ - getDispatch()->glGetClipPlanef(pname, eqn); -} - -void glGetFloatv(GLenum pname, GLfloat *params) -{ - getDispatch()->glGetFloatv(pname, params); -} - -void glGetLightfv(GLenum light, GLenum pname, GLfloat *params) -{ - getDispatch()->glGetLightfv(light, pname, params); -} - -void glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params) -{ - getDispatch()->glGetMaterialfv(face, pname, params); -} - -void glGetTexEnvfv(GLenum env, GLenum pname, GLfloat *params) -{ - getDispatch()->glGetTexEnvfv(env, pname, params); -} - -void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params) -{ - getDispatch()->glGetTexParameterfv(target, pname, params); -} - -void glLightModelf(GLenum pname, GLfloat param) -{ - getDispatch()->glLightModelf(pname, param); -} - -void glLightModelfv(GLenum pname, const GLfloat *params) -{ - getDispatch()->glLightModelfv(pname, params); -} - -void glLightf(GLenum light, GLenum pname, GLfloat param) -{ - getDispatch()->glLightf(light, pname, param); -} - -void glLightfv(GLenum light, GLenum pname, const GLfloat *params) -{ - getDispatch()->glLightfv(light, pname, params); -} - -void glLineWidth(GLfloat width) -{ - getDispatch()->glLineWidth(width); -} - -void glLoadMatrixf(const GLfloat *m) -{ - getDispatch()->glLoadMatrixf(m); -} - -void glMaterialf(GLenum face, GLenum pname, GLfloat param) -{ - getDispatch()->glMaterialf(face, pname, param); -} - -void glMaterialfv(GLenum face, GLenum pname, const GLfloat *params) -{ - getDispatch()->glMaterialfv(face, pname, params); -} - -void glMultMatrixf(const GLfloat *m) -{ - getDispatch()->glMultMatrixf(m); -} - -void glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) -{ - getDispatch()->glMultiTexCoord4f(target, s, t, r, q); -} - -void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz) -{ - getDispatch()->glNormal3f(nx, ny, nz); -} - -void glOrthof(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) -{ - getDispatch()->glOrthof(left, right, bottom, top, zNear, zFar); -} - -void glPointParameterf(GLenum pname, GLfloat param) -{ - getDispatch()->glPointParameterf(pname, param); -} - -void glPointParameterfv(GLenum pname, const GLfloat *params) -{ - getDispatch()->glPointParameterfv(pname, params); -} - -void glPointSize(GLfloat size) -{ - getDispatch()->glPointSize(size); -} - -void glPolygonOffset(GLfloat factor, GLfloat units) -{ - getDispatch()->glPolygonOffset(factor, units); -} - -void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) -{ - getDispatch()->glRotatef(angle, x, y, z); -} - -void glScalef(GLfloat x, GLfloat y, GLfloat z) -{ - getDispatch()->glScalef(x, y, z); -} - -void glTexEnvf(GLenum target, GLenum pname, GLfloat param) -{ - getDispatch()->glTexEnvf(target, pname, param); -} - -void glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params) -{ - getDispatch()->glTexEnvfv(target, pname, params); -} - -void glTexParameterf(GLenum target, GLenum pname, GLfloat param) -{ - getDispatch()->glTexParameterf(target, pname, param); -} - -void glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params) -{ - getDispatch()->glTexParameterfv(target, pname, params); -} - -void glTranslatef(GLfloat x, GLfloat y, GLfloat z) -{ - getDispatch()->glTranslatef(x, y, z); -} - -void glActiveTexture(GLenum texture) -{ - getDispatch()->glActiveTexture(texture); -} - -void glAlphaFuncx(GLenum func, GLclampx ref) -{ - getDispatch()->glAlphaFuncx(func, ref); -} - -void glBindBuffer(GLenum target, GLuint buffer) -{ - getDispatch()->glBindBuffer(target, buffer); -} - -void glBindTexture(GLenum target, GLuint texture) -{ - getDispatch()->glBindTexture(target, texture); -} - -void glBlendFunc(GLenum sfactor, GLenum dfactor) -{ - getDispatch()->glBlendFunc(sfactor, dfactor); -} - -void glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage) -{ - getDispatch()->glBufferData(target, size, data, usage); -} - -void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data) -{ - getDispatch()->glBufferSubData(target, offset, size, data); -} - -void glClear(GLbitfield mask) -{ - getDispatch()->glClear(mask); -} - -void glClearColorx(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha) -{ - getDispatch()->glClearColorx(red, green, blue, alpha); -} - -void glClearDepthx(GLclampx depth) -{ - getDispatch()->glClearDepthx(depth); -} - -void glClearStencil(GLint s) -{ - getDispatch()->glClearStencil(s); -} - -void glClientActiveTexture(GLenum texture) -{ - getDispatch()->glClientActiveTexture(texture); -} - -void glClipPlanex(GLenum plane, const GLfixed *equation) -{ - getDispatch()->glClipPlanex(plane, equation); -} - -void glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) -{ - getDispatch()->glColor4ub(red, green, blue, alpha); -} - -void glColor4x(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) -{ - getDispatch()->glColor4x(red, green, blue, alpha); -} - -void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) -{ - getDispatch()->glColorMask(red, green, blue, alpha); -} - -void glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) -{ - getDispatch()->glColorPointer(size, type, stride, pointer); -} - -void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data) -{ - getDispatch()->glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data); -} - -void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data) -{ - getDispatch()->glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data); -} - -void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) -{ - getDispatch()->glCopyTexImage2D(target, level, internalformat, x, y, width, height, border); -} - -void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) -{ - getDispatch()->glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); -} - -void glCullFace(GLenum mode) -{ - getDispatch()->glCullFace(mode); -} - -void glDeleteBuffers(GLsizei n, const GLuint *buffers) -{ - getDispatch()->glDeleteBuffers(n, buffers); -} - -void glDeleteTextures(GLsizei n, const GLuint *textures) -{ - getDispatch()->glDeleteTextures(n, textures); -} - -void glDepthFunc(GLenum func) -{ - getDispatch()->glDepthFunc(func); -} - -void glDepthMask(GLboolean flag) -{ - getDispatch()->glDepthMask(flag); -} - -void glDepthRangex(GLclampx zNear, GLclampx zFar) -{ - getDispatch()->glDepthRangex(zNear, zFar); -} - -void glDisable(GLenum cap) -{ - getDispatch()->glDisable(cap); -} - -void glDisableClientState(GLenum array) -{ - getDispatch()->glDisableClientState(array); -} - -void glDrawArrays(GLenum mode, GLint first, GLsizei count) -{ - getDispatch()->glDrawArrays(mode, first, count); -} - -void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices) -{ - getDispatch()->glDrawElements(mode, count, type, indices); -} - -void glEnable(GLenum cap) -{ - getDispatch()->glEnable(cap); -} - -void glEnableClientState(GLenum array) -{ - getDispatch()->glEnableClientState(array); -} - -void glFinish() -{ - getDispatch()->glFinish(); -} - -void glFlush() -{ - getDispatch()->glFlush(); -} - -void glFogx(GLenum pname, GLfixed param) -{ - getDispatch()->glFogx(pname, param); -} - -void glFogxv(GLenum pname, const GLfixed *params) -{ - getDispatch()->glFogxv(pname, params); -} - -void glFrontFace(GLenum mode) -{ - getDispatch()->glFrontFace(mode); -} - -void glFrustumx(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) -{ - getDispatch()->glFrustumx(left, right, bottom, top, zNear, zFar); -} - -void glGetBooleanv(GLenum pname, GLboolean *params) -{ - getDispatch()->glGetBooleanv(pname, params); -} - -void glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params) -{ - getDispatch()->glGetBufferParameteriv(target, pname, params); -} - -void glGetClipPlanex(GLenum pname, GLfixed eqn[4]) -{ - getDispatch()->glGetClipPlanex(pname, eqn); -} - -void glGenBuffers(GLsizei n, GLuint *buffers) -{ - getDispatch()->glGenBuffers(n, buffers); -} - -void glGenTextures(GLsizei n, GLuint *textures) -{ - getDispatch()->glGenTextures(n, textures); -} - -GLenum glGetError() -{ - return getDispatch()->glGetError(); -} - -void glGetFixedv(GLenum pname, GLfixed *params) -{ - getDispatch()->glGetFixedv(pname, params); -} - -void glGetIntegerv(GLenum pname, GLint *params) -{ - getDispatch()->glGetIntegerv(pname, params); -} - -void glGetLightxv(GLenum light, GLenum pname, GLfixed *params) -{ - getDispatch()->glGetLightxv(light, pname, params); -} - -void glGetMaterialxv(GLenum face, GLenum pname, GLfixed *params) -{ - getDispatch()->glGetMaterialxv(face, pname, params); -} - -void glGetPointerv(GLenum pname, GLvoid **params) -{ - getDispatch()->glGetPointerv(pname, params); -} - -const GLubyte* glGetString(GLenum name) -{ - return getDispatch()->glGetString(name); -} - -void glGetTexEnviv(GLenum env, GLenum pname, GLint *params) -{ - getDispatch()->glGetTexEnviv(env, pname, params); -} - -void glGetTexEnvxv(GLenum env, GLenum pname, GLfixed *params) -{ - getDispatch()->glGetTexEnvxv(env, pname, params); -} - -void glGetTexParameteriv(GLenum target, GLenum pname, GLint *params) -{ - getDispatch()->glGetTexParameteriv(target, pname, params); -} - -void glGetTexParameterxv(GLenum target, GLenum pname, GLfixed *params) -{ - getDispatch()->glGetTexParameterxv(target, pname, params); -} - -void glHint(GLenum target, GLenum mode) -{ - getDispatch()->glHint(target, mode); -} - -GLboolean glIsBuffer(GLuint buffer) -{ - return getDispatch()->glIsBuffer(buffer); -} - -GLboolean glIsEnabled(GLenum cap) -{ - return getDispatch()->glIsEnabled(cap); -} - -GLboolean glIsTexture(GLuint texture) -{ - return getDispatch()->glIsTexture(texture); -} - -void glLightModelx(GLenum pname, GLfixed param) -{ - getDispatch()->glLightModelx(pname, param); -} - -void glLightModelxv(GLenum pname, const GLfixed *params) -{ - getDispatch()->glLightModelxv(pname, params); -} - -void glLightx(GLenum light, GLenum pname, GLfixed param) -{ - getDispatch()->glLightx(light, pname, param); -} - -void glLightxv(GLenum light, GLenum pname, const GLfixed *params) -{ - getDispatch()->glLightxv(light, pname, params); -} - -void glLineWidthx(GLfixed width) -{ - getDispatch()->glLineWidthx(width); -} - -void glLoadIdentity() -{ - getDispatch()->glLoadIdentity(); -} - -void glLoadMatrixx(const GLfixed *m) -{ - getDispatch()->glLoadMatrixx(m); -} - -void glLogicOp(GLenum opcode) -{ - getDispatch()->glLogicOp(opcode); -} - -void glMaterialx(GLenum face, GLenum pname, GLfixed param) -{ - getDispatch()->glMaterialx(face, pname, param); -} - -void glMaterialxv(GLenum face, GLenum pname, const GLfixed *params) -{ - getDispatch()->glMaterialxv(face, pname, params); -} - -void glMatrixMode(GLenum mode) -{ - getDispatch()->glMatrixMode(mode); -} - -void glMultMatrixx(const GLfixed *m) -{ - getDispatch()->glMultMatrixx(m); -} - -void glMultiTexCoord4x(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q) -{ - getDispatch()->glMultiTexCoord4x(target, s, t, r, q); -} - -void glNormal3x(GLfixed nx, GLfixed ny, GLfixed nz) -{ - getDispatch()->glNormal3x(nx, ny, nz); -} - -void glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer) -{ - getDispatch()->glNormalPointer(type, stride, pointer); -} - -void glOrthox(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) -{ - getDispatch()->glOrthox(left, right, bottom, top, zNear, zFar); -} - -void glPixelStorei(GLenum pname, GLint param) -{ - getDispatch()->glPixelStorei(pname, param); -} - -void glPointParameterx(GLenum pname, GLfixed param) -{ - getDispatch()->glPointParameterx(pname, param); -} - -void glPointParameterxv(GLenum pname, const GLfixed *params) -{ - getDispatch()->glPointParameterxv(pname, params); -} - -void glPointSizex(GLfixed size) -{ - getDispatch()->glPointSizex(size); -} - -void glPolygonOffsetx(GLfixed factor, GLfixed units) -{ - getDispatch()->glPolygonOffsetx(factor, units); -} - -void glPopMatrix() -{ - getDispatch()->glPopMatrix(); -} - -void glPushMatrix() -{ - getDispatch()->glPushMatrix(); -} - -void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels) -{ - getDispatch()->glReadPixels(x, y, width, height, format, type, pixels); -} - -void glRotatex(GLfixed angle, GLfixed x, GLfixed y, GLfixed z) -{ - getDispatch()->glRotatex(angle, x, y, z); -} - -void glSampleCoverage(GLclampf value, GLboolean invert) -{ - getDispatch()->glSampleCoverage(value, invert); -} - -void glSampleCoveragex(GLclampx value, GLboolean invert) -{ - getDispatch()->glSampleCoveragex(value, invert); -} - -void glScalex(GLfixed x, GLfixed y, GLfixed z) -{ - getDispatch()->glScalex(x, y, z); -} - -void glScissor(GLint x, GLint y, GLsizei width, GLsizei height) -{ - getDispatch()->glScissor(x, y, width, height); -} - -void glShadeModel(GLenum mode) -{ - getDispatch()->glShadeModel(mode); -} - -void glStencilFunc(GLenum func, GLint ref, GLuint mask) -{ - getDispatch()->glStencilFunc(func, ref, mask); -} - -void glStencilMask(GLuint mask) -{ - getDispatch()->glStencilMask(mask); -} - -void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass) -{ - getDispatch()->glStencilOp(fail, zfail, zpass); -} - -void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) -{ - getDispatch()->glTexCoordPointer(size, type, stride, pointer); -} - -void glTexEnvi(GLenum target, GLenum pname, GLint param) -{ - getDispatch()->glTexEnvi(target, pname, param); -} - -void glTexEnvx(GLenum target, GLenum pname, GLfixed param) -{ - getDispatch()->glTexEnvx(target, pname, param); -} - -void glTexEnviv(GLenum target, GLenum pname, const GLint *params) -{ - getDispatch()->glTexEnviv(target, pname, params); -} - -void glTexEnvxv(GLenum target, GLenum pname, const GLfixed *params) -{ - getDispatch()->glTexEnvxv(target, pname, params); -} - -void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels) -{ - getDispatch()->glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels); -} - -void glTexParameteri(GLenum target, GLenum pname, GLint param) -{ - getDispatch()->glTexParameteri(target, pname, param); -} - -void glTexParameterx(GLenum target, GLenum pname, GLfixed param) -{ - getDispatch()->glTexParameterx(target, pname, param); -} - -void glTexParameteriv(GLenum target, GLenum pname, const GLint *params) -{ - getDispatch()->glTexParameteriv(target, pname, params); -} - -void glTexParameterxv(GLenum target, GLenum pname, const GLfixed *params) -{ - getDispatch()->glTexParameterxv(target, pname, params); -} - -void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels) -{ - getDispatch()->glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); -} - -void glTranslatex(GLfixed x, GLfixed y, GLfixed z) -{ - getDispatch()->glTranslatex(x, y, z); -} - -void glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) -{ - getDispatch()->glVertexPointer(size, type, stride, pointer); -} - -void glViewport(GLint x, GLint y, GLsizei width, GLsizei height) -{ - getDispatch()->glViewport(x, y, width, height); -} - -void glPointSizePointerOES(GLenum type, GLsizei stride, const GLvoid *pointer) -{ - getDispatch()->glPointSizePointerOES(type, stride, pointer); -} - -void glBlendEquationSeparateOES(GLenum modeRGB, GLenum modeAlpha) -{ - getDispatch()->glBlendEquationSeparateOES(modeRGB, modeAlpha); -} - -void glBlendFuncSeparateOES(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) -{ - getDispatch()->glBlendFuncSeparateOES(srcRGB, dstRGB, srcAlpha, dstAlpha); -} - -void glBlendEquationOES(GLenum mode) -{ - getDispatch()->glBlendEquationOES(mode); -} - -void glDrawTexsOES(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height) -{ - getDispatch()->glDrawTexsOES(x, y, z, width, height); -} - -void glDrawTexiOES(GLint x, GLint y, GLint z, GLint width, GLint height) -{ - getDispatch()->glDrawTexiOES(x, y, z, width, height); -} - -void glDrawTexxOES(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height) -{ - getDispatch()->glDrawTexxOES(x, y, z, width, height); -} - -void glDrawTexsvOES(const GLshort *coords) -{ - getDispatch()->glDrawTexsvOES(coords); -} - -void glDrawTexivOES(const GLint *coords) -{ - getDispatch()->glDrawTexivOES(coords); -} - -void glDrawTexxvOES(const GLfixed *coords) -{ - getDispatch()->glDrawTexxvOES(coords); -} - -void glDrawTexfOES(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height) -{ - getDispatch()->glDrawTexfOES(x, y, z, width, height); -} - -void glDrawTexfvOES(const GLfloat *coords) -{ - getDispatch()->glDrawTexfvOES(coords); -} - -void glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image) -{ - getDispatch()->glEGLImageTargetTexture2DOES(target, image); -} - -void glEGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image) -{ - getDispatch()->glEGLImageTargetRenderbufferStorageOES(target, image); -} - -void glAlphaFuncxOES(GLenum func, GLclampx ref) -{ - getDispatch()->glAlphaFuncxOES(func, ref); -} - -void glClearColorxOES(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha) -{ - getDispatch()->glClearColorxOES(red, green, blue, alpha); -} - -void glClearDepthxOES(GLclampx depth) -{ - getDispatch()->glClearDepthxOES(depth); -} - -void glClipPlanexOES(GLenum plane, const GLfixed *equation) -{ - getDispatch()->glClipPlanexOES(plane, equation); -} - -void glColor4xOES(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) -{ - getDispatch()->glColor4xOES(red, green, blue, alpha); -} - -void glDepthRangexOES(GLclampx zNear, GLclampx zFar) -{ - getDispatch()->glDepthRangexOES(zNear, zFar); -} - -void glFogxOES(GLenum pname, GLfixed param) -{ - getDispatch()->glFogxOES(pname, param); -} - -void glFogxvOES(GLenum pname, const GLfixed *params) -{ - getDispatch()->glFogxvOES(pname, params); -} - -void glFrustumxOES(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) -{ - getDispatch()->glFrustumxOES(left, right, bottom, top, zNear, zFar); -} - -void glGetClipPlanexOES(GLenum pname, GLfixed eqn[4]) -{ - getDispatch()->glGetClipPlanexOES(pname, eqn); -} - -void glGetFixedvOES(GLenum pname, GLfixed *params) -{ - getDispatch()->glGetFixedvOES(pname, params); -} - -void glGetLightxvOES(GLenum light, GLenum pname, GLfixed *params) -{ - getDispatch()->glGetLightxvOES(light, pname, params); -} - -void glGetMaterialxvOES(GLenum face, GLenum pname, GLfixed *params) -{ - getDispatch()->glGetMaterialxvOES(face, pname, params); -} - -void glGetTexEnvxvOES(GLenum env, GLenum pname, GLfixed *params) -{ - getDispatch()->glGetTexEnvxvOES(env, pname, params); -} - -void glGetTexParameterxvOES(GLenum target, GLenum pname, GLfixed *params) -{ - getDispatch()->glGetTexParameterxvOES(target, pname, params); -} - -void glLightModelxOES(GLenum pname, GLfixed param) -{ - getDispatch()->glLightModelxOES(pname, param); -} - -void glLightModelxvOES(GLenum pname, const GLfixed *params) -{ - getDispatch()->glLightModelxvOES(pname, params); -} - -void glLightxOES(GLenum light, GLenum pname, GLfixed param) -{ - getDispatch()->glLightxOES(light, pname, param); -} - -void glLightxvOES(GLenum light, GLenum pname, const GLfixed *params) -{ - getDispatch()->glLightxvOES(light, pname, params); -} - -void glLineWidthxOES(GLfixed width) -{ - getDispatch()->glLineWidthxOES(width); -} - -void glLoadMatrixxOES(const GLfixed *m) -{ - getDispatch()->glLoadMatrixxOES(m); -} - -void glMaterialxOES(GLenum face, GLenum pname, GLfixed param) -{ - getDispatch()->glMaterialxOES(face, pname, param); -} - -void glMaterialxvOES(GLenum face, GLenum pname, const GLfixed *params) -{ - getDispatch()->glMaterialxvOES(face, pname, params); -} - -void glMultMatrixxOES(const GLfixed *m) -{ - getDispatch()->glMultMatrixxOES(m); -} - -void glMultiTexCoord4xOES(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q) -{ - getDispatch()->glMultiTexCoord4xOES(target, s, t, r, q); -} - -void glNormal3xOES(GLfixed nx, GLfixed ny, GLfixed nz) -{ - getDispatch()->glNormal3xOES(nx, ny, nz); -} - -void glOrthoxOES(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) -{ - getDispatch()->glOrthoxOES(left, right, bottom, top, zNear, zFar); -} - -void glPointParameterxOES(GLenum pname, GLfixed param) -{ - getDispatch()->glPointParameterxOES(pname, param); -} - -void glPointParameterxvOES(GLenum pname, const GLfixed *params) -{ - getDispatch()->glPointParameterxvOES(pname, params); -} - -void glPointSizexOES(GLfixed size) -{ - getDispatch()->glPointSizexOES(size); -} - -void glPolygonOffsetxOES(GLfixed factor, GLfixed units) -{ - getDispatch()->glPolygonOffsetxOES(factor, units); -} - -void glRotatexOES(GLfixed angle, GLfixed x, GLfixed y, GLfixed z) -{ - getDispatch()->glRotatexOES(angle, x, y, z); -} - -void glSampleCoveragexOES(GLclampx value, GLboolean invert) -{ - getDispatch()->glSampleCoveragexOES(value, invert); -} - -void glScalexOES(GLfixed x, GLfixed y, GLfixed z) -{ - getDispatch()->glScalexOES(x, y, z); -} - -void glTexEnvxOES(GLenum target, GLenum pname, GLfixed param) -{ - getDispatch()->glTexEnvxOES(target, pname, param); -} - -void glTexEnvxvOES(GLenum target, GLenum pname, const GLfixed *params) -{ - getDispatch()->glTexEnvxvOES(target, pname, params); -} - -void glTexParameterxOES(GLenum target, GLenum pname, GLfixed param) -{ - getDispatch()->glTexParameterxOES(target, pname, param); -} - -void glTexParameterxvOES(GLenum target, GLenum pname, const GLfixed *params) -{ - getDispatch()->glTexParameterxvOES(target, pname, params); -} - -void glTranslatexOES(GLfixed x, GLfixed y, GLfixed z) -{ - getDispatch()->glTranslatexOES(x, y, z); -} - -GLboolean glIsRenderbufferOES(GLuint renderbuffer) -{ - return getDispatch()->glIsRenderbufferOES(renderbuffer); -} - -void glBindRenderbufferOES(GLenum target, GLuint renderbuffer) -{ - getDispatch()->glBindRenderbufferOES(target, renderbuffer); -} - -void glDeleteRenderbuffersOES(GLsizei n, const GLuint *renderbuffers) -{ - getDispatch()->glDeleteRenderbuffersOES(n, renderbuffers); -} - -void glGenRenderbuffersOES(GLsizei n, GLuint *renderbuffers) -{ - getDispatch()->glGenRenderbuffersOES(n, renderbuffers); -} - -void glRenderbufferStorageOES(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) -{ - getDispatch()->glRenderbufferStorageOES(target, internalformat, width, height); -} - -void glGetRenderbufferParameterivOES(GLenum target, GLenum pname, GLint *params) -{ - getDispatch()->glGetRenderbufferParameterivOES(target, pname, params); -} - -GLboolean glIsFramebufferOES(GLuint framebuffer) -{ - return getDispatch()->glIsFramebufferOES(framebuffer); -} - -void glBindFramebufferOES(GLenum target, GLuint framebuffer) -{ - getDispatch()->glBindFramebufferOES(target, framebuffer); -} - -void glDeleteFramebuffersOES(GLsizei n, const GLuint *framebuffers) -{ - getDispatch()->glDeleteFramebuffersOES(n, framebuffers); -} - -void glGenFramebuffersOES(GLsizei n, GLuint *framebuffers) -{ - getDispatch()->glGenFramebuffersOES(n, framebuffers); -} - -GLenum glCheckFramebufferStatusOES(GLenum target) -{ - return getDispatch()->glCheckFramebufferStatusOES(target); -} - -void glFramebufferRenderbufferOES(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) -{ - getDispatch()->glFramebufferRenderbufferOES(target, attachment, renderbuffertarget, renderbuffer); -} - -void glFramebufferTexture2DOES(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) -{ - getDispatch()->glFramebufferTexture2DOES(target, attachment, textarget, texture, level); -} - -void glGetFramebufferAttachmentParameterivOES(GLenum target, GLenum attachment, GLenum pname, GLint *params) -{ - getDispatch()->glGetFramebufferAttachmentParameterivOES(target, attachment, pname, params); -} - -void glGenerateMipmapOES(GLenum target) -{ - getDispatch()->glGenerateMipmapOES(target); -} - -void* glMapBufferOES(GLenum target, GLenum access) -{ - return getDispatch()->glMapBufferOES(target, access); -} - -GLboolean glUnmapBufferOES(GLenum target) -{ - return getDispatch()->glUnmapBufferOES(target); -} - -void glGetBufferPointervOES(GLenum target, GLenum pname, GLvoid **ptr) -{ - getDispatch()->glGetBufferPointervOES(target, pname, ptr); -} - -void glCurrentPaletteMatrixOES(GLuint matrixpaletteindex) -{ - getDispatch()->glCurrentPaletteMatrixOES(matrixpaletteindex); -} - -void glLoadPaletteFromModelViewMatrixOES() -{ - getDispatch()->glLoadPaletteFromModelViewMatrixOES(); -} - -void glMatrixIndexPointerOES(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) -{ - getDispatch()->glMatrixIndexPointerOES(size, type, stride, pointer); -} - -void glWeightPointerOES(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) -{ - getDispatch()->glWeightPointerOES(size, type, stride, pointer); -} - -GLbitfield glQueryMatrixxOES(GLfixed mantissa[16], GLint exponent[16]) -{ - return getDispatch()->glQueryMatrixxOES(mantissa, exponent); -} - -void glDepthRangefOES(GLclampf zNear, GLclampf zFar) -{ - getDispatch()->glDepthRangefOES(zNear, zFar); -} - -void glFrustumfOES(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) -{ - getDispatch()->glFrustumfOES(left, right, bottom, top, zNear, zFar); -} - -void glOrthofOES(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) -{ - getDispatch()->glOrthofOES(left, right, bottom, top, zNear, zFar); -} - -void glClipPlanefOES(GLenum plane, const GLfloat *equation) -{ - getDispatch()->glClipPlanefOES(plane, equation); -} - -void glGetClipPlanefOES(GLenum pname, GLfloat eqn[4]) -{ - getDispatch()->glGetClipPlanefOES(pname, eqn); -} - -void glClearDepthfOES(GLclampf depth) -{ - getDispatch()->glClearDepthfOES(depth); -} - -void glTexGenfOES(GLenum coord, GLenum pname, GLfloat param) -{ - getDispatch()->glTexGenfOES(coord, pname, param); -} - -void glTexGenfvOES(GLenum coord, GLenum pname, const GLfloat *params) -{ - getDispatch()->glTexGenfvOES(coord, pname, params); -} - -void glTexGeniOES(GLenum coord, GLenum pname, GLint param) -{ - getDispatch()->glTexGeniOES(coord, pname, param); -} - -void glTexGenivOES(GLenum coord, GLenum pname, const GLint *params) -{ - getDispatch()->glTexGenivOES(coord, pname, params); -} - -void glTexGenxOES(GLenum coord, GLenum pname, GLfixed param) -{ - getDispatch()->glTexGenxOES(coord, pname, param); -} - -void glTexGenxvOES(GLenum coord, GLenum pname, const GLfixed *params) -{ - getDispatch()->glTexGenxvOES(coord, pname, params); -} - -void glGetTexGenfvOES(GLenum coord, GLenum pname, GLfloat *params) -{ - getDispatch()->glGetTexGenfvOES(coord, pname, params); -} - -void glGetTexGenivOES(GLenum coord, GLenum pname, GLint *params) -{ - getDispatch()->glGetTexGenivOES(coord, pname, params); -} - -void glGetTexGenxvOES(GLenum coord, GLenum pname, GLfixed *params) -{ - getDispatch()->glGetTexGenxvOES(coord, pname, params); -} - -void glBindVertexArrayOES(GLuint array) -{ - getDispatch()->glBindVertexArrayOES(array); -} - -void glDeleteVertexArraysOES(GLsizei n, const GLuint *arrays) -{ - getDispatch()->glDeleteVertexArraysOES(n, arrays); -} - -void glGenVertexArraysOES(GLsizei n, GLuint *arrays) -{ - getDispatch()->glGenVertexArraysOES(n, arrays); -} - -GLboolean glIsVertexArrayOES(GLuint array) -{ - return getDispatch()->glIsVertexArrayOES(array); -} - -void glDiscardFramebufferEXT(GLenum target, GLsizei numAttachments, const GLenum *attachments) -{ - getDispatch()->glDiscardFramebufferEXT(target, numAttachments, attachments); -} - -void glMultiDrawArraysEXT(GLenum mode, GLint *first, GLsizei *count, GLsizei primcount) -{ - getDispatch()->glMultiDrawArraysEXT(mode, first, count, primcount); -} - -void glMultiDrawElementsEXT(GLenum mode, const GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount) -{ - getDispatch()->glMultiDrawElementsEXT(mode, count, type, indices, primcount); -} - -void glClipPlanefIMG(GLenum p, const GLfloat *eqn) -{ - getDispatch()->glClipPlanefIMG(p, eqn); -} - -void glClipPlanexIMG(GLenum p, const GLfixed *eqn) -{ - getDispatch()->glClipPlanexIMG(p, eqn); -} - -void glRenderbufferStorageMultisampleIMG(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) -{ - getDispatch()->glRenderbufferStorageMultisampleIMG(target, samples, internalformat, width, height); -} - -void glFramebufferTexture2DMultisampleIMG(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples) -{ - getDispatch()->glFramebufferTexture2DMultisampleIMG(target, attachment, textarget, texture, level, samples); -} - -void glDeleteFencesNV(GLsizei n, const GLuint *fences) -{ - getDispatch()->glDeleteFencesNV(n, fences); -} - -void glGenFencesNV(GLsizei n, GLuint *fences) -{ - getDispatch()->glGenFencesNV(n, fences); -} - -GLboolean glIsFenceNV(GLuint fence) -{ - return getDispatch()->glIsFenceNV(fence); -} - -GLboolean glTestFenceNV(GLuint fence) -{ - return getDispatch()->glTestFenceNV(fence); -} - -void glGetFenceivNV(GLuint fence, GLenum pname, GLint *params) -{ - getDispatch()->glGetFenceivNV(fence, pname, params); -} - -void glFinishFenceNV(GLuint fence) -{ - getDispatch()->glFinishFenceNV(fence); -} - -void glSetFenceNV(GLuint fence, GLenum condition) -{ - getDispatch()->glSetFenceNV(fence, condition); -} - -void glGetDriverControlsQCOM(GLint *num, GLsizei size, GLuint *driverControls) -{ - getDispatch()->glGetDriverControlsQCOM(num, size, driverControls); -} - -void glGetDriverControlStringQCOM(GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString) -{ - getDispatch()->glGetDriverControlStringQCOM(driverControl, bufSize, length, driverControlString); -} - -void glEnableDriverControlQCOM(GLuint driverControl) -{ - getDispatch()->glEnableDriverControlQCOM(driverControl); -} - -void glDisableDriverControlQCOM(GLuint driverControl) -{ - getDispatch()->glDisableDriverControlQCOM(driverControl); -} - -void glExtGetTexturesQCOM(GLuint *textures, GLint maxTextures, GLint *numTextures) -{ - getDispatch()->glExtGetTexturesQCOM(textures, maxTextures, numTextures); -} - -void glExtGetBuffersQCOM(GLuint *buffers, GLint maxBuffers, GLint *numBuffers) -{ - getDispatch()->glExtGetBuffersQCOM(buffers, maxBuffers, numBuffers); -} - -void glExtGetRenderbuffersQCOM(GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers) -{ - getDispatch()->glExtGetRenderbuffersQCOM(renderbuffers, maxRenderbuffers, numRenderbuffers); -} - -void glExtGetFramebuffersQCOM(GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers) -{ - getDispatch()->glExtGetFramebuffersQCOM(framebuffers, maxFramebuffers, numFramebuffers); -} - -void glExtGetTexLevelParameterivQCOM(GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params) -{ - getDispatch()->glExtGetTexLevelParameterivQCOM(texture, face, level, pname, params); -} - -void glExtTexObjectStateOverrideiQCOM(GLenum target, GLenum pname, GLint param) -{ - getDispatch()->glExtTexObjectStateOverrideiQCOM(target, pname, param); -} - -void glExtGetTexSubImageQCOM(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels) -{ - getDispatch()->glExtGetTexSubImageQCOM(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, texels); -} - -void glExtGetBufferPointervQCOM(GLenum target, GLvoid **params) -{ - getDispatch()->glExtGetBufferPointervQCOM(target, params); -} - -void glExtGetShadersQCOM(GLuint *shaders, GLint maxShaders, GLint *numShaders) -{ - getDispatch()->glExtGetShadersQCOM(shaders, maxShaders, numShaders); -} - -void glExtGetProgramsQCOM(GLuint *programs, GLint maxPrograms, GLint *numPrograms) -{ - getDispatch()->glExtGetProgramsQCOM(programs, maxPrograms, numPrograms); -} - -GLboolean glExtIsProgramBinaryQCOM(GLuint program) -{ - return getDispatch()->glExtIsProgramBinaryQCOM(program); -} - -void glExtGetProgramBinarySourceQCOM(GLuint program, GLenum shadertype, GLchar *source, GLint *length) -{ - getDispatch()->glExtGetProgramBinarySourceQCOM(program, shadertype, source, length); -} - -void glStartTilingQCOM(GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask) -{ - getDispatch()->glStartTilingQCOM(x, y, width, height, preserveMask); -} - -void glEndTilingQCOM(GLbitfield preserveMask) -{ - getDispatch()->glEndTilingQCOM(preserveMask); -} - diff --git a/emulator/opengl/tests/gles_android_wrapper/gles_dispatch.cpp b/emulator/opengl/tests/gles_android_wrapper/gles_dispatch.cpp deleted file mode 100644 index 0a17624..0000000 --- a/emulator/opengl/tests/gles_android_wrapper/gles_dispatch.cpp +++ /dev/null @@ -1,298 +0,0 @@ -/* -* Copyright (C) 2011 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -#include "gles_dispatch.h" -#include <stdio.h> -#include <dlfcn.h> - -gles_dispatch *create_gles_dispatch(void *gles_android) -{ - gles_dispatch *disp = new gles_dispatch; - - void *ptr; - ptr = dlsym(gles_android,"glAlphaFunc"); disp->set_glAlphaFunc((glAlphaFunc_t)ptr); - ptr = dlsym(gles_android,"glClearColor"); disp->set_glClearColor((glClearColor_t)ptr); - ptr = dlsym(gles_android,"glClearDepthf"); disp->set_glClearDepthf((glClearDepthf_t)ptr); - ptr = dlsym(gles_android,"glClipPlanef"); disp->set_glClipPlanef((glClipPlanef_t)ptr); - ptr = dlsym(gles_android,"glColor4f"); disp->set_glColor4f((glColor4f_t)ptr); - ptr = dlsym(gles_android,"glDepthRangef"); disp->set_glDepthRangef((glDepthRangef_t)ptr); - ptr = dlsym(gles_android,"glFogf"); disp->set_glFogf((glFogf_t)ptr); - ptr = dlsym(gles_android,"glFogfv"); disp->set_glFogfv((glFogfv_t)ptr); - ptr = dlsym(gles_android,"glFrustumf"); disp->set_glFrustumf((glFrustumf_t)ptr); - ptr = dlsym(gles_android,"glGetClipPlanef"); disp->set_glGetClipPlanef((glGetClipPlanef_t)ptr); - ptr = dlsym(gles_android,"glGetFloatv"); disp->set_glGetFloatv((glGetFloatv_t)ptr); - ptr = dlsym(gles_android,"glGetLightfv"); disp->set_glGetLightfv((glGetLightfv_t)ptr); - ptr = dlsym(gles_android,"glGetMaterialfv"); disp->set_glGetMaterialfv((glGetMaterialfv_t)ptr); - ptr = dlsym(gles_android,"glGetTexEnvfv"); disp->set_glGetTexEnvfv((glGetTexEnvfv_t)ptr); - ptr = dlsym(gles_android,"glGetTexParameterfv"); disp->set_glGetTexParameterfv((glGetTexParameterfv_t)ptr); - ptr = dlsym(gles_android,"glLightModelf"); disp->set_glLightModelf((glLightModelf_t)ptr); - ptr = dlsym(gles_android,"glLightModelfv"); disp->set_glLightModelfv((glLightModelfv_t)ptr); - ptr = dlsym(gles_android,"glLightf"); disp->set_glLightf((glLightf_t)ptr); - ptr = dlsym(gles_android,"glLightfv"); disp->set_glLightfv((glLightfv_t)ptr); - ptr = dlsym(gles_android,"glLineWidth"); disp->set_glLineWidth((glLineWidth_t)ptr); - ptr = dlsym(gles_android,"glLoadMatrixf"); disp->set_glLoadMatrixf((glLoadMatrixf_t)ptr); - ptr = dlsym(gles_android,"glMaterialf"); disp->set_glMaterialf((glMaterialf_t)ptr); - ptr = dlsym(gles_android,"glMaterialfv"); disp->set_glMaterialfv((glMaterialfv_t)ptr); - ptr = dlsym(gles_android,"glMultMatrixf"); disp->set_glMultMatrixf((glMultMatrixf_t)ptr); - ptr = dlsym(gles_android,"glMultiTexCoord4f"); disp->set_glMultiTexCoord4f((glMultiTexCoord4f_t)ptr); - ptr = dlsym(gles_android,"glNormal3f"); disp->set_glNormal3f((glNormal3f_t)ptr); - ptr = dlsym(gles_android,"glOrthof"); disp->set_glOrthof((glOrthof_t)ptr); - ptr = dlsym(gles_android,"glPointParameterf"); disp->set_glPointParameterf((glPointParameterf_t)ptr); - ptr = dlsym(gles_android,"glPointParameterfv"); disp->set_glPointParameterfv((glPointParameterfv_t)ptr); - ptr = dlsym(gles_android,"glPointSize"); disp->set_glPointSize((glPointSize_t)ptr); - ptr = dlsym(gles_android,"glPolygonOffset"); disp->set_glPolygonOffset((glPolygonOffset_t)ptr); - ptr = dlsym(gles_android,"glRotatef"); disp->set_glRotatef((glRotatef_t)ptr); - ptr = dlsym(gles_android,"glScalef"); disp->set_glScalef((glScalef_t)ptr); - ptr = dlsym(gles_android,"glTexEnvf"); disp->set_glTexEnvf((glTexEnvf_t)ptr); - ptr = dlsym(gles_android,"glTexEnvfv"); disp->set_glTexEnvfv((glTexEnvfv_t)ptr); - ptr = dlsym(gles_android,"glTexParameterf"); disp->set_glTexParameterf((glTexParameterf_t)ptr); - ptr = dlsym(gles_android,"glTexParameterfv"); disp->set_glTexParameterfv((glTexParameterfv_t)ptr); - ptr = dlsym(gles_android,"glTranslatef"); disp->set_glTranslatef((glTranslatef_t)ptr); - ptr = dlsym(gles_android,"glActiveTexture"); disp->set_glActiveTexture((glActiveTexture_t)ptr); - ptr = dlsym(gles_android,"glAlphaFuncx"); disp->set_glAlphaFuncx((glAlphaFuncx_t)ptr); - ptr = dlsym(gles_android,"glBindBuffer"); disp->set_glBindBuffer((glBindBuffer_t)ptr); - ptr = dlsym(gles_android,"glBindTexture"); disp->set_glBindTexture((glBindTexture_t)ptr); - ptr = dlsym(gles_android,"glBlendFunc"); disp->set_glBlendFunc((glBlendFunc_t)ptr); - ptr = dlsym(gles_android,"glBufferData"); disp->set_glBufferData((glBufferData_t)ptr); - ptr = dlsym(gles_android,"glBufferSubData"); disp->set_glBufferSubData((glBufferSubData_t)ptr); - ptr = dlsym(gles_android,"glClear"); disp->set_glClear((glClear_t)ptr); - ptr = dlsym(gles_android,"glClearColorx"); disp->set_glClearColorx((glClearColorx_t)ptr); - ptr = dlsym(gles_android,"glClearDepthx"); disp->set_glClearDepthx((glClearDepthx_t)ptr); - ptr = dlsym(gles_android,"glClearStencil"); disp->set_glClearStencil((glClearStencil_t)ptr); - ptr = dlsym(gles_android,"glClientActiveTexture"); disp->set_glClientActiveTexture((glClientActiveTexture_t)ptr); - ptr = dlsym(gles_android,"glClipPlanex"); disp->set_glClipPlanex((glClipPlanex_t)ptr); - ptr = dlsym(gles_android,"glColor4ub"); disp->set_glColor4ub((glColor4ub_t)ptr); - ptr = dlsym(gles_android,"glColor4x"); disp->set_glColor4x((glColor4x_t)ptr); - ptr = dlsym(gles_android,"glColorMask"); disp->set_glColorMask((glColorMask_t)ptr); - ptr = dlsym(gles_android,"glColorPointer"); disp->set_glColorPointer((glColorPointer_t)ptr); - ptr = dlsym(gles_android,"glCompressedTexImage2D"); disp->set_glCompressedTexImage2D((glCompressedTexImage2D_t)ptr); - ptr = dlsym(gles_android,"glCompressedTexSubImage2D"); disp->set_glCompressedTexSubImage2D((glCompressedTexSubImage2D_t)ptr); - ptr = dlsym(gles_android,"glCopyTexImage2D"); disp->set_glCopyTexImage2D((glCopyTexImage2D_t)ptr); - ptr = dlsym(gles_android,"glCopyTexSubImage2D"); disp->set_glCopyTexSubImage2D((glCopyTexSubImage2D_t)ptr); - ptr = dlsym(gles_android,"glCullFace"); disp->set_glCullFace((glCullFace_t)ptr); - ptr = dlsym(gles_android,"glDeleteBuffers"); disp->set_glDeleteBuffers((glDeleteBuffers_t)ptr); - ptr = dlsym(gles_android,"glDeleteTextures"); disp->set_glDeleteTextures((glDeleteTextures_t)ptr); - ptr = dlsym(gles_android,"glDepthFunc"); disp->set_glDepthFunc((glDepthFunc_t)ptr); - ptr = dlsym(gles_android,"glDepthMask"); disp->set_glDepthMask((glDepthMask_t)ptr); - ptr = dlsym(gles_android,"glDepthRangex"); disp->set_glDepthRangex((glDepthRangex_t)ptr); - ptr = dlsym(gles_android,"glDisable"); disp->set_glDisable((glDisable_t)ptr); - ptr = dlsym(gles_android,"glDisableClientState"); disp->set_glDisableClientState((glDisableClientState_t)ptr); - ptr = dlsym(gles_android,"glDrawArrays"); disp->set_glDrawArrays((glDrawArrays_t)ptr); - ptr = dlsym(gles_android,"glDrawElements"); disp->set_glDrawElements((glDrawElements_t)ptr); - ptr = dlsym(gles_android,"glEnable"); disp->set_glEnable((glEnable_t)ptr); - ptr = dlsym(gles_android,"glEnableClientState"); disp->set_glEnableClientState((glEnableClientState_t)ptr); - ptr = dlsym(gles_android,"glFinish"); disp->set_glFinish((glFinish_t)ptr); - ptr = dlsym(gles_android,"glFlush"); disp->set_glFlush((glFlush_t)ptr); - ptr = dlsym(gles_android,"glFogx"); disp->set_glFogx((glFogx_t)ptr); - ptr = dlsym(gles_android,"glFogxv"); disp->set_glFogxv((glFogxv_t)ptr); - ptr = dlsym(gles_android,"glFrontFace"); disp->set_glFrontFace((glFrontFace_t)ptr); - ptr = dlsym(gles_android,"glFrustumx"); disp->set_glFrustumx((glFrustumx_t)ptr); - ptr = dlsym(gles_android,"glGetBooleanv"); disp->set_glGetBooleanv((glGetBooleanv_t)ptr); - ptr = dlsym(gles_android,"glGetBufferParameteriv"); disp->set_glGetBufferParameteriv((glGetBufferParameteriv_t)ptr); - ptr = dlsym(gles_android,"glGetClipPlanex"); disp->set_glGetClipPlanex((glGetClipPlanex_t)ptr); - ptr = dlsym(gles_android,"glGenBuffers"); disp->set_glGenBuffers((glGenBuffers_t)ptr); - ptr = dlsym(gles_android,"glGenTextures"); disp->set_glGenTextures((glGenTextures_t)ptr); - ptr = dlsym(gles_android,"glGetError"); disp->set_glGetError((glGetError_t)ptr); - ptr = dlsym(gles_android,"glGetFixedv"); disp->set_glGetFixedv((glGetFixedv_t)ptr); - ptr = dlsym(gles_android,"glGetIntegerv"); disp->set_glGetIntegerv((glGetIntegerv_t)ptr); - ptr = dlsym(gles_android,"glGetLightxv"); disp->set_glGetLightxv((glGetLightxv_t)ptr); - ptr = dlsym(gles_android,"glGetMaterialxv"); disp->set_glGetMaterialxv((glGetMaterialxv_t)ptr); - ptr = dlsym(gles_android,"glGetPointerv"); disp->set_glGetPointerv((glGetPointerv_t)ptr); - ptr = dlsym(gles_android,"glGetString"); disp->set_glGetString((glGetString_t)ptr); - ptr = dlsym(gles_android,"glGetTexEnviv"); disp->set_glGetTexEnviv((glGetTexEnviv_t)ptr); - ptr = dlsym(gles_android,"glGetTexEnvxv"); disp->set_glGetTexEnvxv((glGetTexEnvxv_t)ptr); - ptr = dlsym(gles_android,"glGetTexParameteriv"); disp->set_glGetTexParameteriv((glGetTexParameteriv_t)ptr); - ptr = dlsym(gles_android,"glGetTexParameterxv"); disp->set_glGetTexParameterxv((glGetTexParameterxv_t)ptr); - ptr = dlsym(gles_android,"glHint"); disp->set_glHint((glHint_t)ptr); - ptr = dlsym(gles_android,"glIsBuffer"); disp->set_glIsBuffer((glIsBuffer_t)ptr); - ptr = dlsym(gles_android,"glIsEnabled"); disp->set_glIsEnabled((glIsEnabled_t)ptr); - ptr = dlsym(gles_android,"glIsTexture"); disp->set_glIsTexture((glIsTexture_t)ptr); - ptr = dlsym(gles_android,"glLightModelx"); disp->set_glLightModelx((glLightModelx_t)ptr); - ptr = dlsym(gles_android,"glLightModelxv"); disp->set_glLightModelxv((glLightModelxv_t)ptr); - ptr = dlsym(gles_android,"glLightx"); disp->set_glLightx((glLightx_t)ptr); - ptr = dlsym(gles_android,"glLightxv"); disp->set_glLightxv((glLightxv_t)ptr); - ptr = dlsym(gles_android,"glLineWidthx"); disp->set_glLineWidthx((glLineWidthx_t)ptr); - ptr = dlsym(gles_android,"glLoadIdentity"); disp->set_glLoadIdentity((glLoadIdentity_t)ptr); - ptr = dlsym(gles_android,"glLoadMatrixx"); disp->set_glLoadMatrixx((glLoadMatrixx_t)ptr); - ptr = dlsym(gles_android,"glLogicOp"); disp->set_glLogicOp((glLogicOp_t)ptr); - ptr = dlsym(gles_android,"glMaterialx"); disp->set_glMaterialx((glMaterialx_t)ptr); - ptr = dlsym(gles_android,"glMaterialxv"); disp->set_glMaterialxv((glMaterialxv_t)ptr); - ptr = dlsym(gles_android,"glMatrixMode"); disp->set_glMatrixMode((glMatrixMode_t)ptr); - ptr = dlsym(gles_android,"glMultMatrixx"); disp->set_glMultMatrixx((glMultMatrixx_t)ptr); - ptr = dlsym(gles_android,"glMultiTexCoord4x"); disp->set_glMultiTexCoord4x((glMultiTexCoord4x_t)ptr); - ptr = dlsym(gles_android,"glNormal3x"); disp->set_glNormal3x((glNormal3x_t)ptr); - ptr = dlsym(gles_android,"glNormalPointer"); disp->set_glNormalPointer((glNormalPointer_t)ptr); - ptr = dlsym(gles_android,"glOrthox"); disp->set_glOrthox((glOrthox_t)ptr); - ptr = dlsym(gles_android,"glPixelStorei"); disp->set_glPixelStorei((glPixelStorei_t)ptr); - ptr = dlsym(gles_android,"glPointParameterx"); disp->set_glPointParameterx((glPointParameterx_t)ptr); - ptr = dlsym(gles_android,"glPointParameterxv"); disp->set_glPointParameterxv((glPointParameterxv_t)ptr); - ptr = dlsym(gles_android,"glPointSizex"); disp->set_glPointSizex((glPointSizex_t)ptr); - ptr = dlsym(gles_android,"glPolygonOffsetx"); disp->set_glPolygonOffsetx((glPolygonOffsetx_t)ptr); - ptr = dlsym(gles_android,"glPopMatrix"); disp->set_glPopMatrix((glPopMatrix_t)ptr); - ptr = dlsym(gles_android,"glPushMatrix"); disp->set_glPushMatrix((glPushMatrix_t)ptr); - ptr = dlsym(gles_android,"glReadPixels"); disp->set_glReadPixels((glReadPixels_t)ptr); - ptr = dlsym(gles_android,"glRotatex"); disp->set_glRotatex((glRotatex_t)ptr); - ptr = dlsym(gles_android,"glSampleCoverage"); disp->set_glSampleCoverage((glSampleCoverage_t)ptr); - ptr = dlsym(gles_android,"glSampleCoveragex"); disp->set_glSampleCoveragex((glSampleCoveragex_t)ptr); - ptr = dlsym(gles_android,"glScalex"); disp->set_glScalex((glScalex_t)ptr); - ptr = dlsym(gles_android,"glScissor"); disp->set_glScissor((glScissor_t)ptr); - ptr = dlsym(gles_android,"glShadeModel"); disp->set_glShadeModel((glShadeModel_t)ptr); - ptr = dlsym(gles_android,"glStencilFunc"); disp->set_glStencilFunc((glStencilFunc_t)ptr); - ptr = dlsym(gles_android,"glStencilMask"); disp->set_glStencilMask((glStencilMask_t)ptr); - ptr = dlsym(gles_android,"glStencilOp"); disp->set_glStencilOp((glStencilOp_t)ptr); - ptr = dlsym(gles_android,"glTexCoordPointer"); disp->set_glTexCoordPointer((glTexCoordPointer_t)ptr); - ptr = dlsym(gles_android,"glTexEnvi"); disp->set_glTexEnvi((glTexEnvi_t)ptr); - ptr = dlsym(gles_android,"glTexEnvx"); disp->set_glTexEnvx((glTexEnvx_t)ptr); - ptr = dlsym(gles_android,"glTexEnviv"); disp->set_glTexEnviv((glTexEnviv_t)ptr); - ptr = dlsym(gles_android,"glTexEnvxv"); disp->set_glTexEnvxv((glTexEnvxv_t)ptr); - ptr = dlsym(gles_android,"glTexImage2D"); disp->set_glTexImage2D((glTexImage2D_t)ptr); - ptr = dlsym(gles_android,"glTexParameteri"); disp->set_glTexParameteri((glTexParameteri_t)ptr); - ptr = dlsym(gles_android,"glTexParameterx"); disp->set_glTexParameterx((glTexParameterx_t)ptr); - ptr = dlsym(gles_android,"glTexParameteriv"); disp->set_glTexParameteriv((glTexParameteriv_t)ptr); - ptr = dlsym(gles_android,"glTexParameterxv"); disp->set_glTexParameterxv((glTexParameterxv_t)ptr); - ptr = dlsym(gles_android,"glTexSubImage2D"); disp->set_glTexSubImage2D((glTexSubImage2D_t)ptr); - ptr = dlsym(gles_android,"glTranslatex"); disp->set_glTranslatex((glTranslatex_t)ptr); - ptr = dlsym(gles_android,"glVertexPointer"); disp->set_glVertexPointer((glVertexPointer_t)ptr); - ptr = dlsym(gles_android,"glViewport"); disp->set_glViewport((glViewport_t)ptr); - ptr = dlsym(gles_android,"glPointSizePointerOES"); disp->set_glPointSizePointerOES((glPointSizePointerOES_t)ptr); - ptr = dlsym(gles_android,"glBlendEquationSeparateOES"); disp->set_glBlendEquationSeparateOES((glBlendEquationSeparateOES_t)ptr); - ptr = dlsym(gles_android,"glBlendFuncSeparateOES"); disp->set_glBlendFuncSeparateOES((glBlendFuncSeparateOES_t)ptr); - ptr = dlsym(gles_android,"glBlendEquationOES"); disp->set_glBlendEquationOES((glBlendEquationOES_t)ptr); - ptr = dlsym(gles_android,"glDrawTexsOES"); disp->set_glDrawTexsOES((glDrawTexsOES_t)ptr); - ptr = dlsym(gles_android,"glDrawTexiOES"); disp->set_glDrawTexiOES((glDrawTexiOES_t)ptr); - ptr = dlsym(gles_android,"glDrawTexxOES"); disp->set_glDrawTexxOES((glDrawTexxOES_t)ptr); - ptr = dlsym(gles_android,"glDrawTexsvOES"); disp->set_glDrawTexsvOES((glDrawTexsvOES_t)ptr); - ptr = dlsym(gles_android,"glDrawTexivOES"); disp->set_glDrawTexivOES((glDrawTexivOES_t)ptr); - ptr = dlsym(gles_android,"glDrawTexxvOES"); disp->set_glDrawTexxvOES((glDrawTexxvOES_t)ptr); - ptr = dlsym(gles_android,"glDrawTexfOES"); disp->set_glDrawTexfOES((glDrawTexfOES_t)ptr); - ptr = dlsym(gles_android,"glDrawTexfvOES"); disp->set_glDrawTexfvOES((glDrawTexfvOES_t)ptr); - ptr = dlsym(gles_android,"glEGLImageTargetTexture2DOES"); disp->set_glEGLImageTargetTexture2DOES((glEGLImageTargetTexture2DOES_t)ptr); - ptr = dlsym(gles_android,"glEGLImageTargetRenderbufferStorageOES"); disp->set_glEGLImageTargetRenderbufferStorageOES((glEGLImageTargetRenderbufferStorageOES_t)ptr); - ptr = dlsym(gles_android,"glAlphaFuncxOES"); disp->set_glAlphaFuncxOES((glAlphaFuncxOES_t)ptr); - ptr = dlsym(gles_android,"glClearColorxOES"); disp->set_glClearColorxOES((glClearColorxOES_t)ptr); - ptr = dlsym(gles_android,"glClearDepthxOES"); disp->set_glClearDepthxOES((glClearDepthxOES_t)ptr); - ptr = dlsym(gles_android,"glClipPlanexOES"); disp->set_glClipPlanexOES((glClipPlanexOES_t)ptr); - ptr = dlsym(gles_android,"glColor4xOES"); disp->set_glColor4xOES((glColor4xOES_t)ptr); - ptr = dlsym(gles_android,"glDepthRangexOES"); disp->set_glDepthRangexOES((glDepthRangexOES_t)ptr); - ptr = dlsym(gles_android,"glFogxOES"); disp->set_glFogxOES((glFogxOES_t)ptr); - ptr = dlsym(gles_android,"glFogxvOES"); disp->set_glFogxvOES((glFogxvOES_t)ptr); - ptr = dlsym(gles_android,"glFrustumxOES"); disp->set_glFrustumxOES((glFrustumxOES_t)ptr); - ptr = dlsym(gles_android,"glGetClipPlanexOES"); disp->set_glGetClipPlanexOES((glGetClipPlanexOES_t)ptr); - ptr = dlsym(gles_android,"glGetFixedvOES"); disp->set_glGetFixedvOES((glGetFixedvOES_t)ptr); - ptr = dlsym(gles_android,"glGetLightxvOES"); disp->set_glGetLightxvOES((glGetLightxvOES_t)ptr); - ptr = dlsym(gles_android,"glGetMaterialxvOES"); disp->set_glGetMaterialxvOES((glGetMaterialxvOES_t)ptr); - ptr = dlsym(gles_android,"glGetTexEnvxvOES"); disp->set_glGetTexEnvxvOES((glGetTexEnvxvOES_t)ptr); - ptr = dlsym(gles_android,"glGetTexParameterxvOES"); disp->set_glGetTexParameterxvOES((glGetTexParameterxvOES_t)ptr); - ptr = dlsym(gles_android,"glLightModelxOES"); disp->set_glLightModelxOES((glLightModelxOES_t)ptr); - ptr = dlsym(gles_android,"glLightModelxvOES"); disp->set_glLightModelxvOES((glLightModelxvOES_t)ptr); - ptr = dlsym(gles_android,"glLightxOES"); disp->set_glLightxOES((glLightxOES_t)ptr); - ptr = dlsym(gles_android,"glLightxvOES"); disp->set_glLightxvOES((glLightxvOES_t)ptr); - ptr = dlsym(gles_android,"glLineWidthxOES"); disp->set_glLineWidthxOES((glLineWidthxOES_t)ptr); - ptr = dlsym(gles_android,"glLoadMatrixxOES"); disp->set_glLoadMatrixxOES((glLoadMatrixxOES_t)ptr); - ptr = dlsym(gles_android,"glMaterialxOES"); disp->set_glMaterialxOES((glMaterialxOES_t)ptr); - ptr = dlsym(gles_android,"glMaterialxvOES"); disp->set_glMaterialxvOES((glMaterialxvOES_t)ptr); - ptr = dlsym(gles_android,"glMultMatrixxOES"); disp->set_glMultMatrixxOES((glMultMatrixxOES_t)ptr); - ptr = dlsym(gles_android,"glMultiTexCoord4xOES"); disp->set_glMultiTexCoord4xOES((glMultiTexCoord4xOES_t)ptr); - ptr = dlsym(gles_android,"glNormal3xOES"); disp->set_glNormal3xOES((glNormal3xOES_t)ptr); - ptr = dlsym(gles_android,"glOrthoxOES"); disp->set_glOrthoxOES((glOrthoxOES_t)ptr); - ptr = dlsym(gles_android,"glPointParameterxOES"); disp->set_glPointParameterxOES((glPointParameterxOES_t)ptr); - ptr = dlsym(gles_android,"glPointParameterxvOES"); disp->set_glPointParameterxvOES((glPointParameterxvOES_t)ptr); - ptr = dlsym(gles_android,"glPointSizexOES"); disp->set_glPointSizexOES((glPointSizexOES_t)ptr); - ptr = dlsym(gles_android,"glPolygonOffsetxOES"); disp->set_glPolygonOffsetxOES((glPolygonOffsetxOES_t)ptr); - ptr = dlsym(gles_android,"glRotatexOES"); disp->set_glRotatexOES((glRotatexOES_t)ptr); - ptr = dlsym(gles_android,"glSampleCoveragexOES"); disp->set_glSampleCoveragexOES((glSampleCoveragexOES_t)ptr); - ptr = dlsym(gles_android,"glScalexOES"); disp->set_glScalexOES((glScalexOES_t)ptr); - ptr = dlsym(gles_android,"glTexEnvxOES"); disp->set_glTexEnvxOES((glTexEnvxOES_t)ptr); - ptr = dlsym(gles_android,"glTexEnvxvOES"); disp->set_glTexEnvxvOES((glTexEnvxvOES_t)ptr); - ptr = dlsym(gles_android,"glTexParameterxOES"); disp->set_glTexParameterxOES((glTexParameterxOES_t)ptr); - ptr = dlsym(gles_android,"glTexParameterxvOES"); disp->set_glTexParameterxvOES((glTexParameterxvOES_t)ptr); - ptr = dlsym(gles_android,"glTranslatexOES"); disp->set_glTranslatexOES((glTranslatexOES_t)ptr); - ptr = dlsym(gles_android,"glIsRenderbufferOES"); disp->set_glIsRenderbufferOES((glIsRenderbufferOES_t)ptr); - ptr = dlsym(gles_android,"glBindRenderbufferOES"); disp->set_glBindRenderbufferOES((glBindRenderbufferOES_t)ptr); - ptr = dlsym(gles_android,"glDeleteRenderbuffersOES"); disp->set_glDeleteRenderbuffersOES((glDeleteRenderbuffersOES_t)ptr); - ptr = dlsym(gles_android,"glGenRenderbuffersOES"); disp->set_glGenRenderbuffersOES((glGenRenderbuffersOES_t)ptr); - ptr = dlsym(gles_android,"glRenderbufferStorageOES"); disp->set_glRenderbufferStorageOES((glRenderbufferStorageOES_t)ptr); - ptr = dlsym(gles_android,"glGetRenderbufferParameterivOES"); disp->set_glGetRenderbufferParameterivOES((glGetRenderbufferParameterivOES_t)ptr); - ptr = dlsym(gles_android,"glIsFramebufferOES"); disp->set_glIsFramebufferOES((glIsFramebufferOES_t)ptr); - ptr = dlsym(gles_android,"glBindFramebufferOES"); disp->set_glBindFramebufferOES((glBindFramebufferOES_t)ptr); - ptr = dlsym(gles_android,"glDeleteFramebuffersOES"); disp->set_glDeleteFramebuffersOES((glDeleteFramebuffersOES_t)ptr); - ptr = dlsym(gles_android,"glGenFramebuffersOES"); disp->set_glGenFramebuffersOES((glGenFramebuffersOES_t)ptr); - ptr = dlsym(gles_android,"glCheckFramebufferStatusOES"); disp->set_glCheckFramebufferStatusOES((glCheckFramebufferStatusOES_t)ptr); - ptr = dlsym(gles_android,"glFramebufferRenderbufferOES"); disp->set_glFramebufferRenderbufferOES((glFramebufferRenderbufferOES_t)ptr); - ptr = dlsym(gles_android,"glFramebufferTexture2DOES"); disp->set_glFramebufferTexture2DOES((glFramebufferTexture2DOES_t)ptr); - ptr = dlsym(gles_android,"glGetFramebufferAttachmentParameterivOES"); disp->set_glGetFramebufferAttachmentParameterivOES((glGetFramebufferAttachmentParameterivOES_t)ptr); - ptr = dlsym(gles_android,"glGenerateMipmapOES"); disp->set_glGenerateMipmapOES((glGenerateMipmapOES_t)ptr); - ptr = dlsym(gles_android,"glMapBufferOES"); disp->set_glMapBufferOES((glMapBufferOES_t)ptr); - ptr = dlsym(gles_android,"glUnmapBufferOES"); disp->set_glUnmapBufferOES((glUnmapBufferOES_t)ptr); - ptr = dlsym(gles_android,"glGetBufferPointervOES"); disp->set_glGetBufferPointervOES((glGetBufferPointervOES_t)ptr); - ptr = dlsym(gles_android,"glCurrentPaletteMatrixOES"); disp->set_glCurrentPaletteMatrixOES((glCurrentPaletteMatrixOES_t)ptr); - ptr = dlsym(gles_android,"glLoadPaletteFromModelViewMatrixOES"); disp->set_glLoadPaletteFromModelViewMatrixOES((glLoadPaletteFromModelViewMatrixOES_t)ptr); - ptr = dlsym(gles_android,"glMatrixIndexPointerOES"); disp->set_glMatrixIndexPointerOES((glMatrixIndexPointerOES_t)ptr); - ptr = dlsym(gles_android,"glWeightPointerOES"); disp->set_glWeightPointerOES((glWeightPointerOES_t)ptr); - ptr = dlsym(gles_android,"glQueryMatrixxOES"); disp->set_glQueryMatrixxOES((glQueryMatrixxOES_t)ptr); - ptr = dlsym(gles_android,"glDepthRangefOES"); disp->set_glDepthRangefOES((glDepthRangefOES_t)ptr); - ptr = dlsym(gles_android,"glFrustumfOES"); disp->set_glFrustumfOES((glFrustumfOES_t)ptr); - ptr = dlsym(gles_android,"glOrthofOES"); disp->set_glOrthofOES((glOrthofOES_t)ptr); - ptr = dlsym(gles_android,"glClipPlanefOES"); disp->set_glClipPlanefOES((glClipPlanefOES_t)ptr); - ptr = dlsym(gles_android,"glGetClipPlanefOES"); disp->set_glGetClipPlanefOES((glGetClipPlanefOES_t)ptr); - ptr = dlsym(gles_android,"glClearDepthfOES"); disp->set_glClearDepthfOES((glClearDepthfOES_t)ptr); - ptr = dlsym(gles_android,"glTexGenfOES"); disp->set_glTexGenfOES((glTexGenfOES_t)ptr); - ptr = dlsym(gles_android,"glTexGenfvOES"); disp->set_glTexGenfvOES((glTexGenfvOES_t)ptr); - ptr = dlsym(gles_android,"glTexGeniOES"); disp->set_glTexGeniOES((glTexGeniOES_t)ptr); - ptr = dlsym(gles_android,"glTexGenivOES"); disp->set_glTexGenivOES((glTexGenivOES_t)ptr); - ptr = dlsym(gles_android,"glTexGenxOES"); disp->set_glTexGenxOES((glTexGenxOES_t)ptr); - ptr = dlsym(gles_android,"glTexGenxvOES"); disp->set_glTexGenxvOES((glTexGenxvOES_t)ptr); - ptr = dlsym(gles_android,"glGetTexGenfvOES"); disp->set_glGetTexGenfvOES((glGetTexGenfvOES_t)ptr); - ptr = dlsym(gles_android,"glGetTexGenivOES"); disp->set_glGetTexGenivOES((glGetTexGenivOES_t)ptr); - ptr = dlsym(gles_android,"glGetTexGenxvOES"); disp->set_glGetTexGenxvOES((glGetTexGenxvOES_t)ptr); - ptr = dlsym(gles_android,"glBindVertexArrayOES"); disp->set_glBindVertexArrayOES((glBindVertexArrayOES_t)ptr); - ptr = dlsym(gles_android,"glDeleteVertexArraysOES"); disp->set_glDeleteVertexArraysOES((glDeleteVertexArraysOES_t)ptr); - ptr = dlsym(gles_android,"glGenVertexArraysOES"); disp->set_glGenVertexArraysOES((glGenVertexArraysOES_t)ptr); - ptr = dlsym(gles_android,"glIsVertexArrayOES"); disp->set_glIsVertexArrayOES((glIsVertexArrayOES_t)ptr); - ptr = dlsym(gles_android,"glDiscardFramebufferEXT"); disp->set_glDiscardFramebufferEXT((glDiscardFramebufferEXT_t)ptr); - ptr = dlsym(gles_android,"glMultiDrawArraysEXT"); disp->set_glMultiDrawArraysEXT((glMultiDrawArraysEXT_t)ptr); - ptr = dlsym(gles_android,"glMultiDrawElementsEXT"); disp->set_glMultiDrawElementsEXT((glMultiDrawElementsEXT_t)ptr); - ptr = dlsym(gles_android,"glClipPlanefIMG"); disp->set_glClipPlanefIMG((glClipPlanefIMG_t)ptr); - ptr = dlsym(gles_android,"glClipPlanexIMG"); disp->set_glClipPlanexIMG((glClipPlanexIMG_t)ptr); - ptr = dlsym(gles_android,"glRenderbufferStorageMultisampleIMG"); disp->set_glRenderbufferStorageMultisampleIMG((glRenderbufferStorageMultisampleIMG_t)ptr); - ptr = dlsym(gles_android,"glFramebufferTexture2DMultisampleIMG"); disp->set_glFramebufferTexture2DMultisampleIMG((glFramebufferTexture2DMultisampleIMG_t)ptr); - ptr = dlsym(gles_android,"glDeleteFencesNV"); disp->set_glDeleteFencesNV((glDeleteFencesNV_t)ptr); - ptr = dlsym(gles_android,"glGenFencesNV"); disp->set_glGenFencesNV((glGenFencesNV_t)ptr); - ptr = dlsym(gles_android,"glIsFenceNV"); disp->set_glIsFenceNV((glIsFenceNV_t)ptr); - ptr = dlsym(gles_android,"glTestFenceNV"); disp->set_glTestFenceNV((glTestFenceNV_t)ptr); - ptr = dlsym(gles_android,"glGetFenceivNV"); disp->set_glGetFenceivNV((glGetFenceivNV_t)ptr); - ptr = dlsym(gles_android,"glFinishFenceNV"); disp->set_glFinishFenceNV((glFinishFenceNV_t)ptr); - ptr = dlsym(gles_android,"glSetFenceNV"); disp->set_glSetFenceNV((glSetFenceNV_t)ptr); - ptr = dlsym(gles_android,"glGetDriverControlsQCOM"); disp->set_glGetDriverControlsQCOM((glGetDriverControlsQCOM_t)ptr); - ptr = dlsym(gles_android,"glGetDriverControlStringQCOM"); disp->set_glGetDriverControlStringQCOM((glGetDriverControlStringQCOM_t)ptr); - ptr = dlsym(gles_android,"glEnableDriverControlQCOM"); disp->set_glEnableDriverControlQCOM((glEnableDriverControlQCOM_t)ptr); - ptr = dlsym(gles_android,"glDisableDriverControlQCOM"); disp->set_glDisableDriverControlQCOM((glDisableDriverControlQCOM_t)ptr); - ptr = dlsym(gles_android,"glExtGetTexturesQCOM"); disp->set_glExtGetTexturesQCOM((glExtGetTexturesQCOM_t)ptr); - ptr = dlsym(gles_android,"glExtGetBuffersQCOM"); disp->set_glExtGetBuffersQCOM((glExtGetBuffersQCOM_t)ptr); - ptr = dlsym(gles_android,"glExtGetRenderbuffersQCOM"); disp->set_glExtGetRenderbuffersQCOM((glExtGetRenderbuffersQCOM_t)ptr); - ptr = dlsym(gles_android,"glExtGetFramebuffersQCOM"); disp->set_glExtGetFramebuffersQCOM((glExtGetFramebuffersQCOM_t)ptr); - ptr = dlsym(gles_android,"glExtGetTexLevelParameterivQCOM"); disp->set_glExtGetTexLevelParameterivQCOM((glExtGetTexLevelParameterivQCOM_t)ptr); - ptr = dlsym(gles_android,"glExtTexObjectStateOverrideiQCOM"); disp->set_glExtTexObjectStateOverrideiQCOM((glExtTexObjectStateOverrideiQCOM_t)ptr); - ptr = dlsym(gles_android,"glExtGetTexSubImageQCOM"); disp->set_glExtGetTexSubImageQCOM((glExtGetTexSubImageQCOM_t)ptr); - ptr = dlsym(gles_android,"glExtGetBufferPointervQCOM"); disp->set_glExtGetBufferPointervQCOM((glExtGetBufferPointervQCOM_t)ptr); - ptr = dlsym(gles_android,"glExtGetShadersQCOM"); disp->set_glExtGetShadersQCOM((glExtGetShadersQCOM_t)ptr); - ptr = dlsym(gles_android,"glExtGetProgramsQCOM"); disp->set_glExtGetProgramsQCOM((glExtGetProgramsQCOM_t)ptr); - ptr = dlsym(gles_android,"glExtIsProgramBinaryQCOM"); disp->set_glExtIsProgramBinaryQCOM((glExtIsProgramBinaryQCOM_t)ptr); - ptr = dlsym(gles_android,"glExtGetProgramBinarySourceQCOM"); disp->set_glExtGetProgramBinarySourceQCOM((glExtGetProgramBinarySourceQCOM_t)ptr); - ptr = dlsym(gles_android,"glStartTilingQCOM"); disp->set_glStartTilingQCOM((glStartTilingQCOM_t)ptr); - ptr = dlsym(gles_android,"glEndTilingQCOM"); disp->set_glEndTilingQCOM((glEndTilingQCOM_t)ptr); - - return disp; -} diff --git a/emulator/opengl/tests/gles_android_wrapper/gles_dispatch.h b/emulator/opengl/tests/gles_android_wrapper/gles_dispatch.h deleted file mode 100644 index 98a4fca..0000000 --- a/emulator/opengl/tests/gles_android_wrapper/gles_dispatch.h +++ /dev/null @@ -1,570 +0,0 @@ -/* -* Copyright (C) 2011 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -#ifndef _GLES_DISPATCH_H -#define _GLES_DISPATCH_H - -#include "gles_proc.h" - - -struct gles_dispatch { - glAlphaFunc_t glAlphaFunc; - glClearColor_t glClearColor; - glClearDepthf_t glClearDepthf; - glClipPlanef_t glClipPlanef; - glColor4f_t glColor4f; - glDepthRangef_t glDepthRangef; - glFogf_t glFogf; - glFogfv_t glFogfv; - glFrustumf_t glFrustumf; - glGetClipPlanef_t glGetClipPlanef; - glGetFloatv_t glGetFloatv; - glGetLightfv_t glGetLightfv; - glGetMaterialfv_t glGetMaterialfv; - glGetTexEnvfv_t glGetTexEnvfv; - glGetTexParameterfv_t glGetTexParameterfv; - glLightModelf_t glLightModelf; - glLightModelfv_t glLightModelfv; - glLightf_t glLightf; - glLightfv_t glLightfv; - glLineWidth_t glLineWidth; - glLoadMatrixf_t glLoadMatrixf; - glMaterialf_t glMaterialf; - glMaterialfv_t glMaterialfv; - glMultMatrixf_t glMultMatrixf; - glMultiTexCoord4f_t glMultiTexCoord4f; - glNormal3f_t glNormal3f; - glOrthof_t glOrthof; - glPointParameterf_t glPointParameterf; - glPointParameterfv_t glPointParameterfv; - glPointSize_t glPointSize; - glPolygonOffset_t glPolygonOffset; - glRotatef_t glRotatef; - glScalef_t glScalef; - glTexEnvf_t glTexEnvf; - glTexEnvfv_t glTexEnvfv; - glTexParameterf_t glTexParameterf; - glTexParameterfv_t glTexParameterfv; - glTranslatef_t glTranslatef; - glActiveTexture_t glActiveTexture; - glAlphaFuncx_t glAlphaFuncx; - glBindBuffer_t glBindBuffer; - glBindTexture_t glBindTexture; - glBlendFunc_t glBlendFunc; - glBufferData_t glBufferData; - glBufferSubData_t glBufferSubData; - glClear_t glClear; - glClearColorx_t glClearColorx; - glClearDepthx_t glClearDepthx; - glClearStencil_t glClearStencil; - glClientActiveTexture_t glClientActiveTexture; - glClipPlanex_t glClipPlanex; - glColor4ub_t glColor4ub; - glColor4x_t glColor4x; - glColorMask_t glColorMask; - glColorPointer_t glColorPointer; - glCompressedTexImage2D_t glCompressedTexImage2D; - glCompressedTexSubImage2D_t glCompressedTexSubImage2D; - glCopyTexImage2D_t glCopyTexImage2D; - glCopyTexSubImage2D_t glCopyTexSubImage2D; - glCullFace_t glCullFace; - glDeleteBuffers_t glDeleteBuffers; - glDeleteTextures_t glDeleteTextures; - glDepthFunc_t glDepthFunc; - glDepthMask_t glDepthMask; - glDepthRangex_t glDepthRangex; - glDisable_t glDisable; - glDisableClientState_t glDisableClientState; - glDrawArrays_t glDrawArrays; - glDrawElements_t glDrawElements; - glEnable_t glEnable; - glEnableClientState_t glEnableClientState; - glFinish_t glFinish; - glFlush_t glFlush; - glFogx_t glFogx; - glFogxv_t glFogxv; - glFrontFace_t glFrontFace; - glFrustumx_t glFrustumx; - glGetBooleanv_t glGetBooleanv; - glGetBufferParameteriv_t glGetBufferParameteriv; - glGetClipPlanex_t glGetClipPlanex; - glGenBuffers_t glGenBuffers; - glGenTextures_t glGenTextures; - glGetError_t glGetError; - glGetFixedv_t glGetFixedv; - glGetIntegerv_t glGetIntegerv; - glGetLightxv_t glGetLightxv; - glGetMaterialxv_t glGetMaterialxv; - glGetPointerv_t glGetPointerv; - glGetString_t glGetString; - glGetTexEnviv_t glGetTexEnviv; - glGetTexEnvxv_t glGetTexEnvxv; - glGetTexParameteriv_t glGetTexParameteriv; - glGetTexParameterxv_t glGetTexParameterxv; - glHint_t glHint; - glIsBuffer_t glIsBuffer; - glIsEnabled_t glIsEnabled; - glIsTexture_t glIsTexture; - glLightModelx_t glLightModelx; - glLightModelxv_t glLightModelxv; - glLightx_t glLightx; - glLightxv_t glLightxv; - glLineWidthx_t glLineWidthx; - glLoadIdentity_t glLoadIdentity; - glLoadMatrixx_t glLoadMatrixx; - glLogicOp_t glLogicOp; - glMaterialx_t glMaterialx; - glMaterialxv_t glMaterialxv; - glMatrixMode_t glMatrixMode; - glMultMatrixx_t glMultMatrixx; - glMultiTexCoord4x_t glMultiTexCoord4x; - glNormal3x_t glNormal3x; - glNormalPointer_t glNormalPointer; - glOrthox_t glOrthox; - glPixelStorei_t glPixelStorei; - glPointParameterx_t glPointParameterx; - glPointParameterxv_t glPointParameterxv; - glPointSizex_t glPointSizex; - glPolygonOffsetx_t glPolygonOffsetx; - glPopMatrix_t glPopMatrix; - glPushMatrix_t glPushMatrix; - glReadPixels_t glReadPixels; - glRotatex_t glRotatex; - glSampleCoverage_t glSampleCoverage; - glSampleCoveragex_t glSampleCoveragex; - glScalex_t glScalex; - glScissor_t glScissor; - glShadeModel_t glShadeModel; - glStencilFunc_t glStencilFunc; - glStencilMask_t glStencilMask; - glStencilOp_t glStencilOp; - glTexCoordPointer_t glTexCoordPointer; - glTexEnvi_t glTexEnvi; - glTexEnvx_t glTexEnvx; - glTexEnviv_t glTexEnviv; - glTexEnvxv_t glTexEnvxv; - glTexImage2D_t glTexImage2D; - glTexParameteri_t glTexParameteri; - glTexParameterx_t glTexParameterx; - glTexParameteriv_t glTexParameteriv; - glTexParameterxv_t glTexParameterxv; - glTexSubImage2D_t glTexSubImage2D; - glTranslatex_t glTranslatex; - glVertexPointer_t glVertexPointer; - glViewport_t glViewport; - glPointSizePointerOES_t glPointSizePointerOES; - glBlendEquationSeparateOES_t glBlendEquationSeparateOES; - glBlendFuncSeparateOES_t glBlendFuncSeparateOES; - glBlendEquationOES_t glBlendEquationOES; - glDrawTexsOES_t glDrawTexsOES; - glDrawTexiOES_t glDrawTexiOES; - glDrawTexxOES_t glDrawTexxOES; - glDrawTexsvOES_t glDrawTexsvOES; - glDrawTexivOES_t glDrawTexivOES; - glDrawTexxvOES_t glDrawTexxvOES; - glDrawTexfOES_t glDrawTexfOES; - glDrawTexfvOES_t glDrawTexfvOES; - glEGLImageTargetTexture2DOES_t glEGLImageTargetTexture2DOES; - glEGLImageTargetRenderbufferStorageOES_t glEGLImageTargetRenderbufferStorageOES; - glAlphaFuncxOES_t glAlphaFuncxOES; - glClearColorxOES_t glClearColorxOES; - glClearDepthxOES_t glClearDepthxOES; - glClipPlanexOES_t glClipPlanexOES; - glColor4xOES_t glColor4xOES; - glDepthRangexOES_t glDepthRangexOES; - glFogxOES_t glFogxOES; - glFogxvOES_t glFogxvOES; - glFrustumxOES_t glFrustumxOES; - glGetClipPlanexOES_t glGetClipPlanexOES; - glGetFixedvOES_t glGetFixedvOES; - glGetLightxvOES_t glGetLightxvOES; - glGetMaterialxvOES_t glGetMaterialxvOES; - glGetTexEnvxvOES_t glGetTexEnvxvOES; - glGetTexParameterxvOES_t glGetTexParameterxvOES; - glLightModelxOES_t glLightModelxOES; - glLightModelxvOES_t glLightModelxvOES; - glLightxOES_t glLightxOES; - glLightxvOES_t glLightxvOES; - glLineWidthxOES_t glLineWidthxOES; - glLoadMatrixxOES_t glLoadMatrixxOES; - glMaterialxOES_t glMaterialxOES; - glMaterialxvOES_t glMaterialxvOES; - glMultMatrixxOES_t glMultMatrixxOES; - glMultiTexCoord4xOES_t glMultiTexCoord4xOES; - glNormal3xOES_t glNormal3xOES; - glOrthoxOES_t glOrthoxOES; - glPointParameterxOES_t glPointParameterxOES; - glPointParameterxvOES_t glPointParameterxvOES; - glPointSizexOES_t glPointSizexOES; - glPolygonOffsetxOES_t glPolygonOffsetxOES; - glRotatexOES_t glRotatexOES; - glSampleCoveragexOES_t glSampleCoveragexOES; - glScalexOES_t glScalexOES; - glTexEnvxOES_t glTexEnvxOES; - glTexEnvxvOES_t glTexEnvxvOES; - glTexParameterxOES_t glTexParameterxOES; - glTexParameterxvOES_t glTexParameterxvOES; - glTranslatexOES_t glTranslatexOES; - glIsRenderbufferOES_t glIsRenderbufferOES; - glBindRenderbufferOES_t glBindRenderbufferOES; - glDeleteRenderbuffersOES_t glDeleteRenderbuffersOES; - glGenRenderbuffersOES_t glGenRenderbuffersOES; - glRenderbufferStorageOES_t glRenderbufferStorageOES; - glGetRenderbufferParameterivOES_t glGetRenderbufferParameterivOES; - glIsFramebufferOES_t glIsFramebufferOES; - glBindFramebufferOES_t glBindFramebufferOES; - glDeleteFramebuffersOES_t glDeleteFramebuffersOES; - glGenFramebuffersOES_t glGenFramebuffersOES; - glCheckFramebufferStatusOES_t glCheckFramebufferStatusOES; - glFramebufferRenderbufferOES_t glFramebufferRenderbufferOES; - glFramebufferTexture2DOES_t glFramebufferTexture2DOES; - glGetFramebufferAttachmentParameterivOES_t glGetFramebufferAttachmentParameterivOES; - glGenerateMipmapOES_t glGenerateMipmapOES; - glMapBufferOES_t glMapBufferOES; - glUnmapBufferOES_t glUnmapBufferOES; - glGetBufferPointervOES_t glGetBufferPointervOES; - glCurrentPaletteMatrixOES_t glCurrentPaletteMatrixOES; - glLoadPaletteFromModelViewMatrixOES_t glLoadPaletteFromModelViewMatrixOES; - glMatrixIndexPointerOES_t glMatrixIndexPointerOES; - glWeightPointerOES_t glWeightPointerOES; - glQueryMatrixxOES_t glQueryMatrixxOES; - glDepthRangefOES_t glDepthRangefOES; - glFrustumfOES_t glFrustumfOES; - glOrthofOES_t glOrthofOES; - glClipPlanefOES_t glClipPlanefOES; - glGetClipPlanefOES_t glGetClipPlanefOES; - glClearDepthfOES_t glClearDepthfOES; - glTexGenfOES_t glTexGenfOES; - glTexGenfvOES_t glTexGenfvOES; - glTexGeniOES_t glTexGeniOES; - glTexGenivOES_t glTexGenivOES; - glTexGenxOES_t glTexGenxOES; - glTexGenxvOES_t glTexGenxvOES; - glGetTexGenfvOES_t glGetTexGenfvOES; - glGetTexGenivOES_t glGetTexGenivOES; - glGetTexGenxvOES_t glGetTexGenxvOES; - glBindVertexArrayOES_t glBindVertexArrayOES; - glDeleteVertexArraysOES_t glDeleteVertexArraysOES; - glGenVertexArraysOES_t glGenVertexArraysOES; - glIsVertexArrayOES_t glIsVertexArrayOES; - glDiscardFramebufferEXT_t glDiscardFramebufferEXT; - glMultiDrawArraysEXT_t glMultiDrawArraysEXT; - glMultiDrawElementsEXT_t glMultiDrawElementsEXT; - glClipPlanefIMG_t glClipPlanefIMG; - glClipPlanexIMG_t glClipPlanexIMG; - glRenderbufferStorageMultisampleIMG_t glRenderbufferStorageMultisampleIMG; - glFramebufferTexture2DMultisampleIMG_t glFramebufferTexture2DMultisampleIMG; - glDeleteFencesNV_t glDeleteFencesNV; - glGenFencesNV_t glGenFencesNV; - glIsFenceNV_t glIsFenceNV; - glTestFenceNV_t glTestFenceNV; - glGetFenceivNV_t glGetFenceivNV; - glFinishFenceNV_t glFinishFenceNV; - glSetFenceNV_t glSetFenceNV; - glGetDriverControlsQCOM_t glGetDriverControlsQCOM; - glGetDriverControlStringQCOM_t glGetDriverControlStringQCOM; - glEnableDriverControlQCOM_t glEnableDriverControlQCOM; - glDisableDriverControlQCOM_t glDisableDriverControlQCOM; - glExtGetTexturesQCOM_t glExtGetTexturesQCOM; - glExtGetBuffersQCOM_t glExtGetBuffersQCOM; - glExtGetRenderbuffersQCOM_t glExtGetRenderbuffersQCOM; - glExtGetFramebuffersQCOM_t glExtGetFramebuffersQCOM; - glExtGetTexLevelParameterivQCOM_t glExtGetTexLevelParameterivQCOM; - glExtTexObjectStateOverrideiQCOM_t glExtTexObjectStateOverrideiQCOM; - glExtGetTexSubImageQCOM_t glExtGetTexSubImageQCOM; - glExtGetBufferPointervQCOM_t glExtGetBufferPointervQCOM; - glExtGetShadersQCOM_t glExtGetShadersQCOM; - glExtGetProgramsQCOM_t glExtGetProgramsQCOM; - glExtIsProgramBinaryQCOM_t glExtIsProgramBinaryQCOM; - glExtGetProgramBinarySourceQCOM_t glExtGetProgramBinarySourceQCOM; - glStartTilingQCOM_t glStartTilingQCOM; - glEndTilingQCOM_t glEndTilingQCOM; - //Accessors - glAlphaFunc_t set_glAlphaFunc(glAlphaFunc_t f) { glAlphaFunc_t retval = glAlphaFunc; glAlphaFunc = f; return retval;} - glClearColor_t set_glClearColor(glClearColor_t f) { glClearColor_t retval = glClearColor; glClearColor = f; return retval;} - glClearDepthf_t set_glClearDepthf(glClearDepthf_t f) { glClearDepthf_t retval = glClearDepthf; glClearDepthf = f; return retval;} - glClipPlanef_t set_glClipPlanef(glClipPlanef_t f) { glClipPlanef_t retval = glClipPlanef; glClipPlanef = f; return retval;} - glColor4f_t set_glColor4f(glColor4f_t f) { glColor4f_t retval = glColor4f; glColor4f = f; return retval;} - glDepthRangef_t set_glDepthRangef(glDepthRangef_t f) { glDepthRangef_t retval = glDepthRangef; glDepthRangef = f; return retval;} - glFogf_t set_glFogf(glFogf_t f) { glFogf_t retval = glFogf; glFogf = f; return retval;} - glFogfv_t set_glFogfv(glFogfv_t f) { glFogfv_t retval = glFogfv; glFogfv = f; return retval;} - glFrustumf_t set_glFrustumf(glFrustumf_t f) { glFrustumf_t retval = glFrustumf; glFrustumf = f; return retval;} - glGetClipPlanef_t set_glGetClipPlanef(glGetClipPlanef_t f) { glGetClipPlanef_t retval = glGetClipPlanef; glGetClipPlanef = f; return retval;} - glGetFloatv_t set_glGetFloatv(glGetFloatv_t f) { glGetFloatv_t retval = glGetFloatv; glGetFloatv = f; return retval;} - glGetLightfv_t set_glGetLightfv(glGetLightfv_t f) { glGetLightfv_t retval = glGetLightfv; glGetLightfv = f; return retval;} - glGetMaterialfv_t set_glGetMaterialfv(glGetMaterialfv_t f) { glGetMaterialfv_t retval = glGetMaterialfv; glGetMaterialfv = f; return retval;} - glGetTexEnvfv_t set_glGetTexEnvfv(glGetTexEnvfv_t f) { glGetTexEnvfv_t retval = glGetTexEnvfv; glGetTexEnvfv = f; return retval;} - glGetTexParameterfv_t set_glGetTexParameterfv(glGetTexParameterfv_t f) { glGetTexParameterfv_t retval = glGetTexParameterfv; glGetTexParameterfv = f; return retval;} - glLightModelf_t set_glLightModelf(glLightModelf_t f) { glLightModelf_t retval = glLightModelf; glLightModelf = f; return retval;} - glLightModelfv_t set_glLightModelfv(glLightModelfv_t f) { glLightModelfv_t retval = glLightModelfv; glLightModelfv = f; return retval;} - glLightf_t set_glLightf(glLightf_t f) { glLightf_t retval = glLightf; glLightf = f; return retval;} - glLightfv_t set_glLightfv(glLightfv_t f) { glLightfv_t retval = glLightfv; glLightfv = f; return retval;} - glLineWidth_t set_glLineWidth(glLineWidth_t f) { glLineWidth_t retval = glLineWidth; glLineWidth = f; return retval;} - glLoadMatrixf_t set_glLoadMatrixf(glLoadMatrixf_t f) { glLoadMatrixf_t retval = glLoadMatrixf; glLoadMatrixf = f; return retval;} - glMaterialf_t set_glMaterialf(glMaterialf_t f) { glMaterialf_t retval = glMaterialf; glMaterialf = f; return retval;} - glMaterialfv_t set_glMaterialfv(glMaterialfv_t f) { glMaterialfv_t retval = glMaterialfv; glMaterialfv = f; return retval;} - glMultMatrixf_t set_glMultMatrixf(glMultMatrixf_t f) { glMultMatrixf_t retval = glMultMatrixf; glMultMatrixf = f; return retval;} - glMultiTexCoord4f_t set_glMultiTexCoord4f(glMultiTexCoord4f_t f) { glMultiTexCoord4f_t retval = glMultiTexCoord4f; glMultiTexCoord4f = f; return retval;} - glNormal3f_t set_glNormal3f(glNormal3f_t f) { glNormal3f_t retval = glNormal3f; glNormal3f = f; return retval;} - glOrthof_t set_glOrthof(glOrthof_t f) { glOrthof_t retval = glOrthof; glOrthof = f; return retval;} - glPointParameterf_t set_glPointParameterf(glPointParameterf_t f) { glPointParameterf_t retval = glPointParameterf; glPointParameterf = f; return retval;} - glPointParameterfv_t set_glPointParameterfv(glPointParameterfv_t f) { glPointParameterfv_t retval = glPointParameterfv; glPointParameterfv = f; return retval;} - glPointSize_t set_glPointSize(glPointSize_t f) { glPointSize_t retval = glPointSize; glPointSize = f; return retval;} - glPolygonOffset_t set_glPolygonOffset(glPolygonOffset_t f) { glPolygonOffset_t retval = glPolygonOffset; glPolygonOffset = f; return retval;} - glRotatef_t set_glRotatef(glRotatef_t f) { glRotatef_t retval = glRotatef; glRotatef = f; return retval;} - glScalef_t set_glScalef(glScalef_t f) { glScalef_t retval = glScalef; glScalef = f; return retval;} - glTexEnvf_t set_glTexEnvf(glTexEnvf_t f) { glTexEnvf_t retval = glTexEnvf; glTexEnvf = f; return retval;} - glTexEnvfv_t set_glTexEnvfv(glTexEnvfv_t f) { glTexEnvfv_t retval = glTexEnvfv; glTexEnvfv = f; return retval;} - glTexParameterf_t set_glTexParameterf(glTexParameterf_t f) { glTexParameterf_t retval = glTexParameterf; glTexParameterf = f; return retval;} - glTexParameterfv_t set_glTexParameterfv(glTexParameterfv_t f) { glTexParameterfv_t retval = glTexParameterfv; glTexParameterfv = f; return retval;} - glTranslatef_t set_glTranslatef(glTranslatef_t f) { glTranslatef_t retval = glTranslatef; glTranslatef = f; return retval;} - glActiveTexture_t set_glActiveTexture(glActiveTexture_t f) { glActiveTexture_t retval = glActiveTexture; glActiveTexture = f; return retval;} - glAlphaFuncx_t set_glAlphaFuncx(glAlphaFuncx_t f) { glAlphaFuncx_t retval = glAlphaFuncx; glAlphaFuncx = f; return retval;} - glBindBuffer_t set_glBindBuffer(glBindBuffer_t f) { glBindBuffer_t retval = glBindBuffer; glBindBuffer = f; return retval;} - glBindTexture_t set_glBindTexture(glBindTexture_t f) { glBindTexture_t retval = glBindTexture; glBindTexture = f; return retval;} - glBlendFunc_t set_glBlendFunc(glBlendFunc_t f) { glBlendFunc_t retval = glBlendFunc; glBlendFunc = f; return retval;} - glBufferData_t set_glBufferData(glBufferData_t f) { glBufferData_t retval = glBufferData; glBufferData = f; return retval;} - glBufferSubData_t set_glBufferSubData(glBufferSubData_t f) { glBufferSubData_t retval = glBufferSubData; glBufferSubData = f; return retval;} - glClear_t set_glClear(glClear_t f) { glClear_t retval = glClear; glClear = f; return retval;} - glClearColorx_t set_glClearColorx(glClearColorx_t f) { glClearColorx_t retval = glClearColorx; glClearColorx = f; return retval;} - glClearDepthx_t set_glClearDepthx(glClearDepthx_t f) { glClearDepthx_t retval = glClearDepthx; glClearDepthx = f; return retval;} - glClearStencil_t set_glClearStencil(glClearStencil_t f) { glClearStencil_t retval = glClearStencil; glClearStencil = f; return retval;} - glClientActiveTexture_t set_glClientActiveTexture(glClientActiveTexture_t f) { glClientActiveTexture_t retval = glClientActiveTexture; glClientActiveTexture = f; return retval;} - glClipPlanex_t set_glClipPlanex(glClipPlanex_t f) { glClipPlanex_t retval = glClipPlanex; glClipPlanex = f; return retval;} - glColor4ub_t set_glColor4ub(glColor4ub_t f) { glColor4ub_t retval = glColor4ub; glColor4ub = f; return retval;} - glColor4x_t set_glColor4x(glColor4x_t f) { glColor4x_t retval = glColor4x; glColor4x = f; return retval;} - glColorMask_t set_glColorMask(glColorMask_t f) { glColorMask_t retval = glColorMask; glColorMask = f; return retval;} - glColorPointer_t set_glColorPointer(glColorPointer_t f) { glColorPointer_t retval = glColorPointer; glColorPointer = f; return retval;} - glCompressedTexImage2D_t set_glCompressedTexImage2D(glCompressedTexImage2D_t f) { glCompressedTexImage2D_t retval = glCompressedTexImage2D; glCompressedTexImage2D = f; return retval;} - glCompressedTexSubImage2D_t set_glCompressedTexSubImage2D(glCompressedTexSubImage2D_t f) { glCompressedTexSubImage2D_t retval = glCompressedTexSubImage2D; glCompressedTexSubImage2D = f; return retval;} - glCopyTexImage2D_t set_glCopyTexImage2D(glCopyTexImage2D_t f) { glCopyTexImage2D_t retval = glCopyTexImage2D; glCopyTexImage2D = f; return retval;} - glCopyTexSubImage2D_t set_glCopyTexSubImage2D(glCopyTexSubImage2D_t f) { glCopyTexSubImage2D_t retval = glCopyTexSubImage2D; glCopyTexSubImage2D = f; return retval;} - glCullFace_t set_glCullFace(glCullFace_t f) { glCullFace_t retval = glCullFace; glCullFace = f; return retval;} - glDeleteBuffers_t set_glDeleteBuffers(glDeleteBuffers_t f) { glDeleteBuffers_t retval = glDeleteBuffers; glDeleteBuffers = f; return retval;} - glDeleteTextures_t set_glDeleteTextures(glDeleteTextures_t f) { glDeleteTextures_t retval = glDeleteTextures; glDeleteTextures = f; return retval;} - glDepthFunc_t set_glDepthFunc(glDepthFunc_t f) { glDepthFunc_t retval = glDepthFunc; glDepthFunc = f; return retval;} - glDepthMask_t set_glDepthMask(glDepthMask_t f) { glDepthMask_t retval = glDepthMask; glDepthMask = f; return retval;} - glDepthRangex_t set_glDepthRangex(glDepthRangex_t f) { glDepthRangex_t retval = glDepthRangex; glDepthRangex = f; return retval;} - glDisable_t set_glDisable(glDisable_t f) { glDisable_t retval = glDisable; glDisable = f; return retval;} - glDisableClientState_t set_glDisableClientState(glDisableClientState_t f) { glDisableClientState_t retval = glDisableClientState; glDisableClientState = f; return retval;} - glDrawArrays_t set_glDrawArrays(glDrawArrays_t f) { glDrawArrays_t retval = glDrawArrays; glDrawArrays = f; return retval;} - glDrawElements_t set_glDrawElements(glDrawElements_t f) { glDrawElements_t retval = glDrawElements; glDrawElements = f; return retval;} - glEnable_t set_glEnable(glEnable_t f) { glEnable_t retval = glEnable; glEnable = f; return retval;} - glEnableClientState_t set_glEnableClientState(glEnableClientState_t f) { glEnableClientState_t retval = glEnableClientState; glEnableClientState = f; return retval;} - glFinish_t set_glFinish(glFinish_t f) { glFinish_t retval = glFinish; glFinish = f; return retval;} - glFlush_t set_glFlush(glFlush_t f) { glFlush_t retval = glFlush; glFlush = f; return retval;} - glFogx_t set_glFogx(glFogx_t f) { glFogx_t retval = glFogx; glFogx = f; return retval;} - glFogxv_t set_glFogxv(glFogxv_t f) { glFogxv_t retval = glFogxv; glFogxv = f; return retval;} - glFrontFace_t set_glFrontFace(glFrontFace_t f) { glFrontFace_t retval = glFrontFace; glFrontFace = f; return retval;} - glFrustumx_t set_glFrustumx(glFrustumx_t f) { glFrustumx_t retval = glFrustumx; glFrustumx = f; return retval;} - glGetBooleanv_t set_glGetBooleanv(glGetBooleanv_t f) { glGetBooleanv_t retval = glGetBooleanv; glGetBooleanv = f; return retval;} - glGetBufferParameteriv_t set_glGetBufferParameteriv(glGetBufferParameteriv_t f) { glGetBufferParameteriv_t retval = glGetBufferParameteriv; glGetBufferParameteriv = f; return retval;} - glGetClipPlanex_t set_glGetClipPlanex(glGetClipPlanex_t f) { glGetClipPlanex_t retval = glGetClipPlanex; glGetClipPlanex = f; return retval;} - glGenBuffers_t set_glGenBuffers(glGenBuffers_t f) { glGenBuffers_t retval = glGenBuffers; glGenBuffers = f; return retval;} - glGenTextures_t set_glGenTextures(glGenTextures_t f) { glGenTextures_t retval = glGenTextures; glGenTextures = f; return retval;} - glGetError_t set_glGetError(glGetError_t f) { glGetError_t retval = glGetError; glGetError = f; return retval;} - glGetFixedv_t set_glGetFixedv(glGetFixedv_t f) { glGetFixedv_t retval = glGetFixedv; glGetFixedv = f; return retval;} - glGetIntegerv_t set_glGetIntegerv(glGetIntegerv_t f) { glGetIntegerv_t retval = glGetIntegerv; glGetIntegerv = f; return retval;} - glGetLightxv_t set_glGetLightxv(glGetLightxv_t f) { glGetLightxv_t retval = glGetLightxv; glGetLightxv = f; return retval;} - glGetMaterialxv_t set_glGetMaterialxv(glGetMaterialxv_t f) { glGetMaterialxv_t retval = glGetMaterialxv; glGetMaterialxv = f; return retval;} - glGetPointerv_t set_glGetPointerv(glGetPointerv_t f) { glGetPointerv_t retval = glGetPointerv; glGetPointerv = f; return retval;} - glGetString_t set_glGetString(glGetString_t f) { glGetString_t retval = glGetString; glGetString = f; return retval;} - glGetTexEnviv_t set_glGetTexEnviv(glGetTexEnviv_t f) { glGetTexEnviv_t retval = glGetTexEnviv; glGetTexEnviv = f; return retval;} - glGetTexEnvxv_t set_glGetTexEnvxv(glGetTexEnvxv_t f) { glGetTexEnvxv_t retval = glGetTexEnvxv; glGetTexEnvxv = f; return retval;} - glGetTexParameteriv_t set_glGetTexParameteriv(glGetTexParameteriv_t f) { glGetTexParameteriv_t retval = glGetTexParameteriv; glGetTexParameteriv = f; return retval;} - glGetTexParameterxv_t set_glGetTexParameterxv(glGetTexParameterxv_t f) { glGetTexParameterxv_t retval = glGetTexParameterxv; glGetTexParameterxv = f; return retval;} - glHint_t set_glHint(glHint_t f) { glHint_t retval = glHint; glHint = f; return retval;} - glIsBuffer_t set_glIsBuffer(glIsBuffer_t f) { glIsBuffer_t retval = glIsBuffer; glIsBuffer = f; return retval;} - glIsEnabled_t set_glIsEnabled(glIsEnabled_t f) { glIsEnabled_t retval = glIsEnabled; glIsEnabled = f; return retval;} - glIsTexture_t set_glIsTexture(glIsTexture_t f) { glIsTexture_t retval = glIsTexture; glIsTexture = f; return retval;} - glLightModelx_t set_glLightModelx(glLightModelx_t f) { glLightModelx_t retval = glLightModelx; glLightModelx = f; return retval;} - glLightModelxv_t set_glLightModelxv(glLightModelxv_t f) { glLightModelxv_t retval = glLightModelxv; glLightModelxv = f; return retval;} - glLightx_t set_glLightx(glLightx_t f) { glLightx_t retval = glLightx; glLightx = f; return retval;} - glLightxv_t set_glLightxv(glLightxv_t f) { glLightxv_t retval = glLightxv; glLightxv = f; return retval;} - glLineWidthx_t set_glLineWidthx(glLineWidthx_t f) { glLineWidthx_t retval = glLineWidthx; glLineWidthx = f; return retval;} - glLoadIdentity_t set_glLoadIdentity(glLoadIdentity_t f) { glLoadIdentity_t retval = glLoadIdentity; glLoadIdentity = f; return retval;} - glLoadMatrixx_t set_glLoadMatrixx(glLoadMatrixx_t f) { glLoadMatrixx_t retval = glLoadMatrixx; glLoadMatrixx = f; return retval;} - glLogicOp_t set_glLogicOp(glLogicOp_t f) { glLogicOp_t retval = glLogicOp; glLogicOp = f; return retval;} - glMaterialx_t set_glMaterialx(glMaterialx_t f) { glMaterialx_t retval = glMaterialx; glMaterialx = f; return retval;} - glMaterialxv_t set_glMaterialxv(glMaterialxv_t f) { glMaterialxv_t retval = glMaterialxv; glMaterialxv = f; return retval;} - glMatrixMode_t set_glMatrixMode(glMatrixMode_t f) { glMatrixMode_t retval = glMatrixMode; glMatrixMode = f; return retval;} - glMultMatrixx_t set_glMultMatrixx(glMultMatrixx_t f) { glMultMatrixx_t retval = glMultMatrixx; glMultMatrixx = f; return retval;} - glMultiTexCoord4x_t set_glMultiTexCoord4x(glMultiTexCoord4x_t f) { glMultiTexCoord4x_t retval = glMultiTexCoord4x; glMultiTexCoord4x = f; return retval;} - glNormal3x_t set_glNormal3x(glNormal3x_t f) { glNormal3x_t retval = glNormal3x; glNormal3x = f; return retval;} - glNormalPointer_t set_glNormalPointer(glNormalPointer_t f) { glNormalPointer_t retval = glNormalPointer; glNormalPointer = f; return retval;} - glOrthox_t set_glOrthox(glOrthox_t f) { glOrthox_t retval = glOrthox; glOrthox = f; return retval;} - glPixelStorei_t set_glPixelStorei(glPixelStorei_t f) { glPixelStorei_t retval = glPixelStorei; glPixelStorei = f; return retval;} - glPointParameterx_t set_glPointParameterx(glPointParameterx_t f) { glPointParameterx_t retval = glPointParameterx; glPointParameterx = f; return retval;} - glPointParameterxv_t set_glPointParameterxv(glPointParameterxv_t f) { glPointParameterxv_t retval = glPointParameterxv; glPointParameterxv = f; return retval;} - glPointSizex_t set_glPointSizex(glPointSizex_t f) { glPointSizex_t retval = glPointSizex; glPointSizex = f; return retval;} - glPolygonOffsetx_t set_glPolygonOffsetx(glPolygonOffsetx_t f) { glPolygonOffsetx_t retval = glPolygonOffsetx; glPolygonOffsetx = f; return retval;} - glPopMatrix_t set_glPopMatrix(glPopMatrix_t f) { glPopMatrix_t retval = glPopMatrix; glPopMatrix = f; return retval;} - glPushMatrix_t set_glPushMatrix(glPushMatrix_t f) { glPushMatrix_t retval = glPushMatrix; glPushMatrix = f; return retval;} - glReadPixels_t set_glReadPixels(glReadPixels_t f) { glReadPixels_t retval = glReadPixels; glReadPixels = f; return retval;} - glRotatex_t set_glRotatex(glRotatex_t f) { glRotatex_t retval = glRotatex; glRotatex = f; return retval;} - glSampleCoverage_t set_glSampleCoverage(glSampleCoverage_t f) { glSampleCoverage_t retval = glSampleCoverage; glSampleCoverage = f; return retval;} - glSampleCoveragex_t set_glSampleCoveragex(glSampleCoveragex_t f) { glSampleCoveragex_t retval = glSampleCoveragex; glSampleCoveragex = f; return retval;} - glScalex_t set_glScalex(glScalex_t f) { glScalex_t retval = glScalex; glScalex = f; return retval;} - glScissor_t set_glScissor(glScissor_t f) { glScissor_t retval = glScissor; glScissor = f; return retval;} - glShadeModel_t set_glShadeModel(glShadeModel_t f) { glShadeModel_t retval = glShadeModel; glShadeModel = f; return retval;} - glStencilFunc_t set_glStencilFunc(glStencilFunc_t f) { glStencilFunc_t retval = glStencilFunc; glStencilFunc = f; return retval;} - glStencilMask_t set_glStencilMask(glStencilMask_t f) { glStencilMask_t retval = glStencilMask; glStencilMask = f; return retval;} - glStencilOp_t set_glStencilOp(glStencilOp_t f) { glStencilOp_t retval = glStencilOp; glStencilOp = f; return retval;} - glTexCoordPointer_t set_glTexCoordPointer(glTexCoordPointer_t f) { glTexCoordPointer_t retval = glTexCoordPointer; glTexCoordPointer = f; return retval;} - glTexEnvi_t set_glTexEnvi(glTexEnvi_t f) { glTexEnvi_t retval = glTexEnvi; glTexEnvi = f; return retval;} - glTexEnvx_t set_glTexEnvx(glTexEnvx_t f) { glTexEnvx_t retval = glTexEnvx; glTexEnvx = f; return retval;} - glTexEnviv_t set_glTexEnviv(glTexEnviv_t f) { glTexEnviv_t retval = glTexEnviv; glTexEnviv = f; return retval;} - glTexEnvxv_t set_glTexEnvxv(glTexEnvxv_t f) { glTexEnvxv_t retval = glTexEnvxv; glTexEnvxv = f; return retval;} - glTexImage2D_t set_glTexImage2D(glTexImage2D_t f) { glTexImage2D_t retval = glTexImage2D; glTexImage2D = f; return retval;} - glTexParameteri_t set_glTexParameteri(glTexParameteri_t f) { glTexParameteri_t retval = glTexParameteri; glTexParameteri = f; return retval;} - glTexParameterx_t set_glTexParameterx(glTexParameterx_t f) { glTexParameterx_t retval = glTexParameterx; glTexParameterx = f; return retval;} - glTexParameteriv_t set_glTexParameteriv(glTexParameteriv_t f) { glTexParameteriv_t retval = glTexParameteriv; glTexParameteriv = f; return retval;} - glTexParameterxv_t set_glTexParameterxv(glTexParameterxv_t f) { glTexParameterxv_t retval = glTexParameterxv; glTexParameterxv = f; return retval;} - glTexSubImage2D_t set_glTexSubImage2D(glTexSubImage2D_t f) { glTexSubImage2D_t retval = glTexSubImage2D; glTexSubImage2D = f; return retval;} - glTranslatex_t set_glTranslatex(glTranslatex_t f) { glTranslatex_t retval = glTranslatex; glTranslatex = f; return retval;} - glVertexPointer_t set_glVertexPointer(glVertexPointer_t f) { glVertexPointer_t retval = glVertexPointer; glVertexPointer = f; return retval;} - glViewport_t set_glViewport(glViewport_t f) { glViewport_t retval = glViewport; glViewport = f; return retval;} - glPointSizePointerOES_t set_glPointSizePointerOES(glPointSizePointerOES_t f) { glPointSizePointerOES_t retval = glPointSizePointerOES; glPointSizePointerOES = f; return retval;} - glBlendEquationSeparateOES_t set_glBlendEquationSeparateOES(glBlendEquationSeparateOES_t f) { glBlendEquationSeparateOES_t retval = glBlendEquationSeparateOES; glBlendEquationSeparateOES = f; return retval;} - glBlendFuncSeparateOES_t set_glBlendFuncSeparateOES(glBlendFuncSeparateOES_t f) { glBlendFuncSeparateOES_t retval = glBlendFuncSeparateOES; glBlendFuncSeparateOES = f; return retval;} - glBlendEquationOES_t set_glBlendEquationOES(glBlendEquationOES_t f) { glBlendEquationOES_t retval = glBlendEquationOES; glBlendEquationOES = f; return retval;} - glDrawTexsOES_t set_glDrawTexsOES(glDrawTexsOES_t f) { glDrawTexsOES_t retval = glDrawTexsOES; glDrawTexsOES = f; return retval;} - glDrawTexiOES_t set_glDrawTexiOES(glDrawTexiOES_t f) { glDrawTexiOES_t retval = glDrawTexiOES; glDrawTexiOES = f; return retval;} - glDrawTexxOES_t set_glDrawTexxOES(glDrawTexxOES_t f) { glDrawTexxOES_t retval = glDrawTexxOES; glDrawTexxOES = f; return retval;} - glDrawTexsvOES_t set_glDrawTexsvOES(glDrawTexsvOES_t f) { glDrawTexsvOES_t retval = glDrawTexsvOES; glDrawTexsvOES = f; return retval;} - glDrawTexivOES_t set_glDrawTexivOES(glDrawTexivOES_t f) { glDrawTexivOES_t retval = glDrawTexivOES; glDrawTexivOES = f; return retval;} - glDrawTexxvOES_t set_glDrawTexxvOES(glDrawTexxvOES_t f) { glDrawTexxvOES_t retval = glDrawTexxvOES; glDrawTexxvOES = f; return retval;} - glDrawTexfOES_t set_glDrawTexfOES(glDrawTexfOES_t f) { glDrawTexfOES_t retval = glDrawTexfOES; glDrawTexfOES = f; return retval;} - glDrawTexfvOES_t set_glDrawTexfvOES(glDrawTexfvOES_t f) { glDrawTexfvOES_t retval = glDrawTexfvOES; glDrawTexfvOES = f; return retval;} - glEGLImageTargetTexture2DOES_t set_glEGLImageTargetTexture2DOES(glEGLImageTargetTexture2DOES_t f) { glEGLImageTargetTexture2DOES_t retval = glEGLImageTargetTexture2DOES; glEGLImageTargetTexture2DOES = f; return retval;} - glEGLImageTargetRenderbufferStorageOES_t set_glEGLImageTargetRenderbufferStorageOES(glEGLImageTargetRenderbufferStorageOES_t f) { glEGLImageTargetRenderbufferStorageOES_t retval = glEGLImageTargetRenderbufferStorageOES; glEGLImageTargetRenderbufferStorageOES = f; return retval;} - glAlphaFuncxOES_t set_glAlphaFuncxOES(glAlphaFuncxOES_t f) { glAlphaFuncxOES_t retval = glAlphaFuncxOES; glAlphaFuncxOES = f; return retval;} - glClearColorxOES_t set_glClearColorxOES(glClearColorxOES_t f) { glClearColorxOES_t retval = glClearColorxOES; glClearColorxOES = f; return retval;} - glClearDepthxOES_t set_glClearDepthxOES(glClearDepthxOES_t f) { glClearDepthxOES_t retval = glClearDepthxOES; glClearDepthxOES = f; return retval;} - glClipPlanexOES_t set_glClipPlanexOES(glClipPlanexOES_t f) { glClipPlanexOES_t retval = glClipPlanexOES; glClipPlanexOES = f; return retval;} - glColor4xOES_t set_glColor4xOES(glColor4xOES_t f) { glColor4xOES_t retval = glColor4xOES; glColor4xOES = f; return retval;} - glDepthRangexOES_t set_glDepthRangexOES(glDepthRangexOES_t f) { glDepthRangexOES_t retval = glDepthRangexOES; glDepthRangexOES = f; return retval;} - glFogxOES_t set_glFogxOES(glFogxOES_t f) { glFogxOES_t retval = glFogxOES; glFogxOES = f; return retval;} - glFogxvOES_t set_glFogxvOES(glFogxvOES_t f) { glFogxvOES_t retval = glFogxvOES; glFogxvOES = f; return retval;} - glFrustumxOES_t set_glFrustumxOES(glFrustumxOES_t f) { glFrustumxOES_t retval = glFrustumxOES; glFrustumxOES = f; return retval;} - glGetClipPlanexOES_t set_glGetClipPlanexOES(glGetClipPlanexOES_t f) { glGetClipPlanexOES_t retval = glGetClipPlanexOES; glGetClipPlanexOES = f; return retval;} - glGetFixedvOES_t set_glGetFixedvOES(glGetFixedvOES_t f) { glGetFixedvOES_t retval = glGetFixedvOES; glGetFixedvOES = f; return retval;} - glGetLightxvOES_t set_glGetLightxvOES(glGetLightxvOES_t f) { glGetLightxvOES_t retval = glGetLightxvOES; glGetLightxvOES = f; return retval;} - glGetMaterialxvOES_t set_glGetMaterialxvOES(glGetMaterialxvOES_t f) { glGetMaterialxvOES_t retval = glGetMaterialxvOES; glGetMaterialxvOES = f; return retval;} - glGetTexEnvxvOES_t set_glGetTexEnvxvOES(glGetTexEnvxvOES_t f) { glGetTexEnvxvOES_t retval = glGetTexEnvxvOES; glGetTexEnvxvOES = f; return retval;} - glGetTexParameterxvOES_t set_glGetTexParameterxvOES(glGetTexParameterxvOES_t f) { glGetTexParameterxvOES_t retval = glGetTexParameterxvOES; glGetTexParameterxvOES = f; return retval;} - glLightModelxOES_t set_glLightModelxOES(glLightModelxOES_t f) { glLightModelxOES_t retval = glLightModelxOES; glLightModelxOES = f; return retval;} - glLightModelxvOES_t set_glLightModelxvOES(glLightModelxvOES_t f) { glLightModelxvOES_t retval = glLightModelxvOES; glLightModelxvOES = f; return retval;} - glLightxOES_t set_glLightxOES(glLightxOES_t f) { glLightxOES_t retval = glLightxOES; glLightxOES = f; return retval;} - glLightxvOES_t set_glLightxvOES(glLightxvOES_t f) { glLightxvOES_t retval = glLightxvOES; glLightxvOES = f; return retval;} - glLineWidthxOES_t set_glLineWidthxOES(glLineWidthxOES_t f) { glLineWidthxOES_t retval = glLineWidthxOES; glLineWidthxOES = f; return retval;} - glLoadMatrixxOES_t set_glLoadMatrixxOES(glLoadMatrixxOES_t f) { glLoadMatrixxOES_t retval = glLoadMatrixxOES; glLoadMatrixxOES = f; return retval;} - glMaterialxOES_t set_glMaterialxOES(glMaterialxOES_t f) { glMaterialxOES_t retval = glMaterialxOES; glMaterialxOES = f; return retval;} - glMaterialxvOES_t set_glMaterialxvOES(glMaterialxvOES_t f) { glMaterialxvOES_t retval = glMaterialxvOES; glMaterialxvOES = f; return retval;} - glMultMatrixxOES_t set_glMultMatrixxOES(glMultMatrixxOES_t f) { glMultMatrixxOES_t retval = glMultMatrixxOES; glMultMatrixxOES = f; return retval;} - glMultiTexCoord4xOES_t set_glMultiTexCoord4xOES(glMultiTexCoord4xOES_t f) { glMultiTexCoord4xOES_t retval = glMultiTexCoord4xOES; glMultiTexCoord4xOES = f; return retval;} - glNormal3xOES_t set_glNormal3xOES(glNormal3xOES_t f) { glNormal3xOES_t retval = glNormal3xOES; glNormal3xOES = f; return retval;} - glOrthoxOES_t set_glOrthoxOES(glOrthoxOES_t f) { glOrthoxOES_t retval = glOrthoxOES; glOrthoxOES = f; return retval;} - glPointParameterxOES_t set_glPointParameterxOES(glPointParameterxOES_t f) { glPointParameterxOES_t retval = glPointParameterxOES; glPointParameterxOES = f; return retval;} - glPointParameterxvOES_t set_glPointParameterxvOES(glPointParameterxvOES_t f) { glPointParameterxvOES_t retval = glPointParameterxvOES; glPointParameterxvOES = f; return retval;} - glPointSizexOES_t set_glPointSizexOES(glPointSizexOES_t f) { glPointSizexOES_t retval = glPointSizexOES; glPointSizexOES = f; return retval;} - glPolygonOffsetxOES_t set_glPolygonOffsetxOES(glPolygonOffsetxOES_t f) { glPolygonOffsetxOES_t retval = glPolygonOffsetxOES; glPolygonOffsetxOES = f; return retval;} - glRotatexOES_t set_glRotatexOES(glRotatexOES_t f) { glRotatexOES_t retval = glRotatexOES; glRotatexOES = f; return retval;} - glSampleCoveragexOES_t set_glSampleCoveragexOES(glSampleCoveragexOES_t f) { glSampleCoveragexOES_t retval = glSampleCoveragexOES; glSampleCoveragexOES = f; return retval;} - glScalexOES_t set_glScalexOES(glScalexOES_t f) { glScalexOES_t retval = glScalexOES; glScalexOES = f; return retval;} - glTexEnvxOES_t set_glTexEnvxOES(glTexEnvxOES_t f) { glTexEnvxOES_t retval = glTexEnvxOES; glTexEnvxOES = f; return retval;} - glTexEnvxvOES_t set_glTexEnvxvOES(glTexEnvxvOES_t f) { glTexEnvxvOES_t retval = glTexEnvxvOES; glTexEnvxvOES = f; return retval;} - glTexParameterxOES_t set_glTexParameterxOES(glTexParameterxOES_t f) { glTexParameterxOES_t retval = glTexParameterxOES; glTexParameterxOES = f; return retval;} - glTexParameterxvOES_t set_glTexParameterxvOES(glTexParameterxvOES_t f) { glTexParameterxvOES_t retval = glTexParameterxvOES; glTexParameterxvOES = f; return retval;} - glTranslatexOES_t set_glTranslatexOES(glTranslatexOES_t f) { glTranslatexOES_t retval = glTranslatexOES; glTranslatexOES = f; return retval;} - glIsRenderbufferOES_t set_glIsRenderbufferOES(glIsRenderbufferOES_t f) { glIsRenderbufferOES_t retval = glIsRenderbufferOES; glIsRenderbufferOES = f; return retval;} - glBindRenderbufferOES_t set_glBindRenderbufferOES(glBindRenderbufferOES_t f) { glBindRenderbufferOES_t retval = glBindRenderbufferOES; glBindRenderbufferOES = f; return retval;} - glDeleteRenderbuffersOES_t set_glDeleteRenderbuffersOES(glDeleteRenderbuffersOES_t f) { glDeleteRenderbuffersOES_t retval = glDeleteRenderbuffersOES; glDeleteRenderbuffersOES = f; return retval;} - glGenRenderbuffersOES_t set_glGenRenderbuffersOES(glGenRenderbuffersOES_t f) { glGenRenderbuffersOES_t retval = glGenRenderbuffersOES; glGenRenderbuffersOES = f; return retval;} - glRenderbufferStorageOES_t set_glRenderbufferStorageOES(glRenderbufferStorageOES_t f) { glRenderbufferStorageOES_t retval = glRenderbufferStorageOES; glRenderbufferStorageOES = f; return retval;} - glGetRenderbufferParameterivOES_t set_glGetRenderbufferParameterivOES(glGetRenderbufferParameterivOES_t f) { glGetRenderbufferParameterivOES_t retval = glGetRenderbufferParameterivOES; glGetRenderbufferParameterivOES = f; return retval;} - glIsFramebufferOES_t set_glIsFramebufferOES(glIsFramebufferOES_t f) { glIsFramebufferOES_t retval = glIsFramebufferOES; glIsFramebufferOES = f; return retval;} - glBindFramebufferOES_t set_glBindFramebufferOES(glBindFramebufferOES_t f) { glBindFramebufferOES_t retval = glBindFramebufferOES; glBindFramebufferOES = f; return retval;} - glDeleteFramebuffersOES_t set_glDeleteFramebuffersOES(glDeleteFramebuffersOES_t f) { glDeleteFramebuffersOES_t retval = glDeleteFramebuffersOES; glDeleteFramebuffersOES = f; return retval;} - glGenFramebuffersOES_t set_glGenFramebuffersOES(glGenFramebuffersOES_t f) { glGenFramebuffersOES_t retval = glGenFramebuffersOES; glGenFramebuffersOES = f; return retval;} - glCheckFramebufferStatusOES_t set_glCheckFramebufferStatusOES(glCheckFramebufferStatusOES_t f) { glCheckFramebufferStatusOES_t retval = glCheckFramebufferStatusOES; glCheckFramebufferStatusOES = f; return retval;} - glFramebufferRenderbufferOES_t set_glFramebufferRenderbufferOES(glFramebufferRenderbufferOES_t f) { glFramebufferRenderbufferOES_t retval = glFramebufferRenderbufferOES; glFramebufferRenderbufferOES = f; return retval;} - glFramebufferTexture2DOES_t set_glFramebufferTexture2DOES(glFramebufferTexture2DOES_t f) { glFramebufferTexture2DOES_t retval = glFramebufferTexture2DOES; glFramebufferTexture2DOES = f; return retval;} - glGetFramebufferAttachmentParameterivOES_t set_glGetFramebufferAttachmentParameterivOES(glGetFramebufferAttachmentParameterivOES_t f) { glGetFramebufferAttachmentParameterivOES_t retval = glGetFramebufferAttachmentParameterivOES; glGetFramebufferAttachmentParameterivOES = f; return retval;} - glGenerateMipmapOES_t set_glGenerateMipmapOES(glGenerateMipmapOES_t f) { glGenerateMipmapOES_t retval = glGenerateMipmapOES; glGenerateMipmapOES = f; return retval;} - glMapBufferOES_t set_glMapBufferOES(glMapBufferOES_t f) { glMapBufferOES_t retval = glMapBufferOES; glMapBufferOES = f; return retval;} - glUnmapBufferOES_t set_glUnmapBufferOES(glUnmapBufferOES_t f) { glUnmapBufferOES_t retval = glUnmapBufferOES; glUnmapBufferOES = f; return retval;} - glGetBufferPointervOES_t set_glGetBufferPointervOES(glGetBufferPointervOES_t f) { glGetBufferPointervOES_t retval = glGetBufferPointervOES; glGetBufferPointervOES = f; return retval;} - glCurrentPaletteMatrixOES_t set_glCurrentPaletteMatrixOES(glCurrentPaletteMatrixOES_t f) { glCurrentPaletteMatrixOES_t retval = glCurrentPaletteMatrixOES; glCurrentPaletteMatrixOES = f; return retval;} - glLoadPaletteFromModelViewMatrixOES_t set_glLoadPaletteFromModelViewMatrixOES(glLoadPaletteFromModelViewMatrixOES_t f) { glLoadPaletteFromModelViewMatrixOES_t retval = glLoadPaletteFromModelViewMatrixOES; glLoadPaletteFromModelViewMatrixOES = f; return retval;} - glMatrixIndexPointerOES_t set_glMatrixIndexPointerOES(glMatrixIndexPointerOES_t f) { glMatrixIndexPointerOES_t retval = glMatrixIndexPointerOES; glMatrixIndexPointerOES = f; return retval;} - glWeightPointerOES_t set_glWeightPointerOES(glWeightPointerOES_t f) { glWeightPointerOES_t retval = glWeightPointerOES; glWeightPointerOES = f; return retval;} - glQueryMatrixxOES_t set_glQueryMatrixxOES(glQueryMatrixxOES_t f) { glQueryMatrixxOES_t retval = glQueryMatrixxOES; glQueryMatrixxOES = f; return retval;} - glDepthRangefOES_t set_glDepthRangefOES(glDepthRangefOES_t f) { glDepthRangefOES_t retval = glDepthRangefOES; glDepthRangefOES = f; return retval;} - glFrustumfOES_t set_glFrustumfOES(glFrustumfOES_t f) { glFrustumfOES_t retval = glFrustumfOES; glFrustumfOES = f; return retval;} - glOrthofOES_t set_glOrthofOES(glOrthofOES_t f) { glOrthofOES_t retval = glOrthofOES; glOrthofOES = f; return retval;} - glClipPlanefOES_t set_glClipPlanefOES(glClipPlanefOES_t f) { glClipPlanefOES_t retval = glClipPlanefOES; glClipPlanefOES = f; return retval;} - glGetClipPlanefOES_t set_glGetClipPlanefOES(glGetClipPlanefOES_t f) { glGetClipPlanefOES_t retval = glGetClipPlanefOES; glGetClipPlanefOES = f; return retval;} - glClearDepthfOES_t set_glClearDepthfOES(glClearDepthfOES_t f) { glClearDepthfOES_t retval = glClearDepthfOES; glClearDepthfOES = f; return retval;} - glTexGenfOES_t set_glTexGenfOES(glTexGenfOES_t f) { glTexGenfOES_t retval = glTexGenfOES; glTexGenfOES = f; return retval;} - glTexGenfvOES_t set_glTexGenfvOES(glTexGenfvOES_t f) { glTexGenfvOES_t retval = glTexGenfvOES; glTexGenfvOES = f; return retval;} - glTexGeniOES_t set_glTexGeniOES(glTexGeniOES_t f) { glTexGeniOES_t retval = glTexGeniOES; glTexGeniOES = f; return retval;} - glTexGenivOES_t set_glTexGenivOES(glTexGenivOES_t f) { glTexGenivOES_t retval = glTexGenivOES; glTexGenivOES = f; return retval;} - glTexGenxOES_t set_glTexGenxOES(glTexGenxOES_t f) { glTexGenxOES_t retval = glTexGenxOES; glTexGenxOES = f; return retval;} - glTexGenxvOES_t set_glTexGenxvOES(glTexGenxvOES_t f) { glTexGenxvOES_t retval = glTexGenxvOES; glTexGenxvOES = f; return retval;} - glGetTexGenfvOES_t set_glGetTexGenfvOES(glGetTexGenfvOES_t f) { glGetTexGenfvOES_t retval = glGetTexGenfvOES; glGetTexGenfvOES = f; return retval;} - glGetTexGenivOES_t set_glGetTexGenivOES(glGetTexGenivOES_t f) { glGetTexGenivOES_t retval = glGetTexGenivOES; glGetTexGenivOES = f; return retval;} - glGetTexGenxvOES_t set_glGetTexGenxvOES(glGetTexGenxvOES_t f) { glGetTexGenxvOES_t retval = glGetTexGenxvOES; glGetTexGenxvOES = f; return retval;} - glBindVertexArrayOES_t set_glBindVertexArrayOES(glBindVertexArrayOES_t f) { glBindVertexArrayOES_t retval = glBindVertexArrayOES; glBindVertexArrayOES = f; return retval;} - glDeleteVertexArraysOES_t set_glDeleteVertexArraysOES(glDeleteVertexArraysOES_t f) { glDeleteVertexArraysOES_t retval = glDeleteVertexArraysOES; glDeleteVertexArraysOES = f; return retval;} - glGenVertexArraysOES_t set_glGenVertexArraysOES(glGenVertexArraysOES_t f) { glGenVertexArraysOES_t retval = glGenVertexArraysOES; glGenVertexArraysOES = f; return retval;} - glIsVertexArrayOES_t set_glIsVertexArrayOES(glIsVertexArrayOES_t f) { glIsVertexArrayOES_t retval = glIsVertexArrayOES; glIsVertexArrayOES = f; return retval;} - glDiscardFramebufferEXT_t set_glDiscardFramebufferEXT(glDiscardFramebufferEXT_t f) { glDiscardFramebufferEXT_t retval = glDiscardFramebufferEXT; glDiscardFramebufferEXT = f; return retval;} - glMultiDrawArraysEXT_t set_glMultiDrawArraysEXT(glMultiDrawArraysEXT_t f) { glMultiDrawArraysEXT_t retval = glMultiDrawArraysEXT; glMultiDrawArraysEXT = f; return retval;} - glMultiDrawElementsEXT_t set_glMultiDrawElementsEXT(glMultiDrawElementsEXT_t f) { glMultiDrawElementsEXT_t retval = glMultiDrawElementsEXT; glMultiDrawElementsEXT = f; return retval;} - glClipPlanefIMG_t set_glClipPlanefIMG(glClipPlanefIMG_t f) { glClipPlanefIMG_t retval = glClipPlanefIMG; glClipPlanefIMG = f; return retval;} - glClipPlanexIMG_t set_glClipPlanexIMG(glClipPlanexIMG_t f) { glClipPlanexIMG_t retval = glClipPlanexIMG; glClipPlanexIMG = f; return retval;} - glRenderbufferStorageMultisampleIMG_t set_glRenderbufferStorageMultisampleIMG(glRenderbufferStorageMultisampleIMG_t f) { glRenderbufferStorageMultisampleIMG_t retval = glRenderbufferStorageMultisampleIMG; glRenderbufferStorageMultisampleIMG = f; return retval;} - glFramebufferTexture2DMultisampleIMG_t set_glFramebufferTexture2DMultisampleIMG(glFramebufferTexture2DMultisampleIMG_t f) { glFramebufferTexture2DMultisampleIMG_t retval = glFramebufferTexture2DMultisampleIMG; glFramebufferTexture2DMultisampleIMG = f; return retval;} - glDeleteFencesNV_t set_glDeleteFencesNV(glDeleteFencesNV_t f) { glDeleteFencesNV_t retval = glDeleteFencesNV; glDeleteFencesNV = f; return retval;} - glGenFencesNV_t set_glGenFencesNV(glGenFencesNV_t f) { glGenFencesNV_t retval = glGenFencesNV; glGenFencesNV = f; return retval;} - glIsFenceNV_t set_glIsFenceNV(glIsFenceNV_t f) { glIsFenceNV_t retval = glIsFenceNV; glIsFenceNV = f; return retval;} - glTestFenceNV_t set_glTestFenceNV(glTestFenceNV_t f) { glTestFenceNV_t retval = glTestFenceNV; glTestFenceNV = f; return retval;} - glGetFenceivNV_t set_glGetFenceivNV(glGetFenceivNV_t f) { glGetFenceivNV_t retval = glGetFenceivNV; glGetFenceivNV = f; return retval;} - glFinishFenceNV_t set_glFinishFenceNV(glFinishFenceNV_t f) { glFinishFenceNV_t retval = glFinishFenceNV; glFinishFenceNV = f; return retval;} - glSetFenceNV_t set_glSetFenceNV(glSetFenceNV_t f) { glSetFenceNV_t retval = glSetFenceNV; glSetFenceNV = f; return retval;} - glGetDriverControlsQCOM_t set_glGetDriverControlsQCOM(glGetDriverControlsQCOM_t f) { glGetDriverControlsQCOM_t retval = glGetDriverControlsQCOM; glGetDriverControlsQCOM = f; return retval;} - glGetDriverControlStringQCOM_t set_glGetDriverControlStringQCOM(glGetDriverControlStringQCOM_t f) { glGetDriverControlStringQCOM_t retval = glGetDriverControlStringQCOM; glGetDriverControlStringQCOM = f; return retval;} - glEnableDriverControlQCOM_t set_glEnableDriverControlQCOM(glEnableDriverControlQCOM_t f) { glEnableDriverControlQCOM_t retval = glEnableDriverControlQCOM; glEnableDriverControlQCOM = f; return retval;} - glDisableDriverControlQCOM_t set_glDisableDriverControlQCOM(glDisableDriverControlQCOM_t f) { glDisableDriverControlQCOM_t retval = glDisableDriverControlQCOM; glDisableDriverControlQCOM = f; return retval;} - glExtGetTexturesQCOM_t set_glExtGetTexturesQCOM(glExtGetTexturesQCOM_t f) { glExtGetTexturesQCOM_t retval = glExtGetTexturesQCOM; glExtGetTexturesQCOM = f; return retval;} - glExtGetBuffersQCOM_t set_glExtGetBuffersQCOM(glExtGetBuffersQCOM_t f) { glExtGetBuffersQCOM_t retval = glExtGetBuffersQCOM; glExtGetBuffersQCOM = f; return retval;} - glExtGetRenderbuffersQCOM_t set_glExtGetRenderbuffersQCOM(glExtGetRenderbuffersQCOM_t f) { glExtGetRenderbuffersQCOM_t retval = glExtGetRenderbuffersQCOM; glExtGetRenderbuffersQCOM = f; return retval;} - glExtGetFramebuffersQCOM_t set_glExtGetFramebuffersQCOM(glExtGetFramebuffersQCOM_t f) { glExtGetFramebuffersQCOM_t retval = glExtGetFramebuffersQCOM; glExtGetFramebuffersQCOM = f; return retval;} - glExtGetTexLevelParameterivQCOM_t set_glExtGetTexLevelParameterivQCOM(glExtGetTexLevelParameterivQCOM_t f) { glExtGetTexLevelParameterivQCOM_t retval = glExtGetTexLevelParameterivQCOM; glExtGetTexLevelParameterivQCOM = f; return retval;} - glExtTexObjectStateOverrideiQCOM_t set_glExtTexObjectStateOverrideiQCOM(glExtTexObjectStateOverrideiQCOM_t f) { glExtTexObjectStateOverrideiQCOM_t retval = glExtTexObjectStateOverrideiQCOM; glExtTexObjectStateOverrideiQCOM = f; return retval;} - glExtGetTexSubImageQCOM_t set_glExtGetTexSubImageQCOM(glExtGetTexSubImageQCOM_t f) { glExtGetTexSubImageQCOM_t retval = glExtGetTexSubImageQCOM; glExtGetTexSubImageQCOM = f; return retval;} - glExtGetBufferPointervQCOM_t set_glExtGetBufferPointervQCOM(glExtGetBufferPointervQCOM_t f) { glExtGetBufferPointervQCOM_t retval = glExtGetBufferPointervQCOM; glExtGetBufferPointervQCOM = f; return retval;} - glExtGetShadersQCOM_t set_glExtGetShadersQCOM(glExtGetShadersQCOM_t f) { glExtGetShadersQCOM_t retval = glExtGetShadersQCOM; glExtGetShadersQCOM = f; return retval;} - glExtGetProgramsQCOM_t set_glExtGetProgramsQCOM(glExtGetProgramsQCOM_t f) { glExtGetProgramsQCOM_t retval = glExtGetProgramsQCOM; glExtGetProgramsQCOM = f; return retval;} - glExtIsProgramBinaryQCOM_t set_glExtIsProgramBinaryQCOM(glExtIsProgramBinaryQCOM_t f) { glExtIsProgramBinaryQCOM_t retval = glExtIsProgramBinaryQCOM; glExtIsProgramBinaryQCOM = f; return retval;} - glExtGetProgramBinarySourceQCOM_t set_glExtGetProgramBinarySourceQCOM(glExtGetProgramBinarySourceQCOM_t f) { glExtGetProgramBinarySourceQCOM_t retval = glExtGetProgramBinarySourceQCOM; glExtGetProgramBinarySourceQCOM = f; return retval;} - glStartTilingQCOM_t set_glStartTilingQCOM(glStartTilingQCOM_t f) { glStartTilingQCOM_t retval = glStartTilingQCOM; glStartTilingQCOM = f; return retval;} - glEndTilingQCOM_t set_glEndTilingQCOM(glEndTilingQCOM_t f) { glEndTilingQCOM_t retval = glEndTilingQCOM; glEndTilingQCOM = f; return retval;} -}; - -gles_dispatch *create_gles_dispatch(void *gles_andorid); - -#endif diff --git a/emulator/opengl/tests/gles_android_wrapper/gles_emul.cfg b/emulator/opengl/tests/gles_android_wrapper/gles_emul.cfg deleted file mode 100644 index a837807..0000000 --- a/emulator/opengl/tests/gles_android_wrapper/gles_emul.cfg +++ /dev/null @@ -1,7 +0,0 @@ -angeles -my-tritex -org.zeroxlab.benchmark -com.cooliris.media -com.polarbit.waveblazerlite -test-opengl-gl2_basic -com.trendy.ddapp diff --git a/emulator/opengl/tests/gles_android_wrapper/gles_ftable.h b/emulator/opengl/tests/gles_android_wrapper/gles_ftable.h deleted file mode 100644 index 1895b18..0000000 --- a/emulator/opengl/tests/gles_android_wrapper/gles_ftable.h +++ /dev/null @@ -1,292 +0,0 @@ -/* -* Copyright (C) 2011 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -static struct _gles_funcs_by_name { - const char *name; - void *proc; -} gles_funcs_by_name[] = { - {"glAlphaFunc", (void *)glAlphaFunc}, - {"glClearColor", (void *)glClearColor}, - {"glClearDepthf", (void *)glClearDepthf}, - {"glClipPlanef", (void *)glClipPlanef}, - {"glColor4f", (void *)glColor4f}, - {"glDepthRangef", (void *)glDepthRangef}, - {"glFogf", (void *)glFogf}, - {"glFogfv", (void *)glFogfv}, - {"glFrustumf", (void *)glFrustumf}, - {"glGetClipPlanef", (void *)glGetClipPlanef}, - {"glGetFloatv", (void *)glGetFloatv}, - {"glGetLightfv", (void *)glGetLightfv}, - {"glGetMaterialfv", (void *)glGetMaterialfv}, - {"glGetTexEnvfv", (void *)glGetTexEnvfv}, - {"glGetTexParameterfv", (void *)glGetTexParameterfv}, - {"glLightModelf", (void *)glLightModelf}, - {"glLightModelfv", (void *)glLightModelfv}, - {"glLightf", (void *)glLightf}, - {"glLightfv", (void *)glLightfv}, - {"glLineWidth", (void *)glLineWidth}, - {"glLoadMatrixf", (void *)glLoadMatrixf}, - {"glMaterialf", (void *)glMaterialf}, - {"glMaterialfv", (void *)glMaterialfv}, - {"glMultMatrixf", (void *)glMultMatrixf}, - {"glMultiTexCoord4f", (void *)glMultiTexCoord4f}, - {"glNormal3f", (void *)glNormal3f}, - {"glOrthof", (void *)glOrthof}, - {"glPointParameterf", (void *)glPointParameterf}, - {"glPointParameterfv", (void *)glPointParameterfv}, - {"glPointSize", (void *)glPointSize}, - {"glPolygonOffset", (void *)glPolygonOffset}, - {"glRotatef", (void *)glRotatef}, - {"glScalef", (void *)glScalef}, - {"glTexEnvf", (void *)glTexEnvf}, - {"glTexEnvfv", (void *)glTexEnvfv}, - {"glTexParameterf", (void *)glTexParameterf}, - {"glTexParameterfv", (void *)glTexParameterfv}, - {"glTranslatef", (void *)glTranslatef}, - {"glActiveTexture", (void *)glActiveTexture}, - {"glAlphaFuncx", (void *)glAlphaFuncx}, - {"glBindBuffer", (void *)glBindBuffer}, - {"glBindTexture", (void *)glBindTexture}, - {"glBlendFunc", (void *)glBlendFunc}, - {"glBufferData", (void *)glBufferData}, - {"glBufferSubData", (void *)glBufferSubData}, - {"glClear", (void *)glClear}, - {"glClearColorx", (void *)glClearColorx}, - {"glClearDepthx", (void *)glClearDepthx}, - {"glClearStencil", (void *)glClearStencil}, - {"glClientActiveTexture", (void *)glClientActiveTexture}, - {"glClipPlanex", (void *)glClipPlanex}, - {"glColor4ub", (void *)glColor4ub}, - {"glColor4x", (void *)glColor4x}, - {"glColorMask", (void *)glColorMask}, - {"glColorPointer", (void *)glColorPointer}, - {"glCompressedTexImage2D", (void *)glCompressedTexImage2D}, - {"glCompressedTexSubImage2D", (void *)glCompressedTexSubImage2D}, - {"glCopyTexImage2D", (void *)glCopyTexImage2D}, - {"glCopyTexSubImage2D", (void *)glCopyTexSubImage2D}, - {"glCullFace", (void *)glCullFace}, - {"glDeleteBuffers", (void *)glDeleteBuffers}, - {"glDeleteTextures", (void *)glDeleteTextures}, - {"glDepthFunc", (void *)glDepthFunc}, - {"glDepthMask", (void *)glDepthMask}, - {"glDepthRangex", (void *)glDepthRangex}, - {"glDisable", (void *)glDisable}, - {"glDisableClientState", (void *)glDisableClientState}, - {"glDrawArrays", (void *)glDrawArrays}, - {"glDrawElements", (void *)glDrawElements}, - {"glEnable", (void *)glEnable}, - {"glEnableClientState", (void *)glEnableClientState}, - {"glFinish", (void *)glFinish}, - {"glFlush", (void *)glFlush}, - {"glFogx", (void *)glFogx}, - {"glFogxv", (void *)glFogxv}, - {"glFrontFace", (void *)glFrontFace}, - {"glFrustumx", (void *)glFrustumx}, - {"glGetBooleanv", (void *)glGetBooleanv}, - {"glGetBufferParameteriv", (void *)glGetBufferParameteriv}, - {"glGetClipPlanex", (void *)glGetClipPlanex}, - {"glGenBuffers", (void *)glGenBuffers}, - {"glGenTextures", (void *)glGenTextures}, - {"glGetError", (void *)glGetError}, - {"glGetFixedv", (void *)glGetFixedv}, - {"glGetIntegerv", (void *)glGetIntegerv}, - {"glGetLightxv", (void *)glGetLightxv}, - {"glGetMaterialxv", (void *)glGetMaterialxv}, - {"glGetPointerv", (void *)glGetPointerv}, - {"glGetString", (void *)glGetString}, - {"glGetTexEnviv", (void *)glGetTexEnviv}, - {"glGetTexEnvxv", (void *)glGetTexEnvxv}, - {"glGetTexParameteriv", (void *)glGetTexParameteriv}, - {"glGetTexParameterxv", (void *)glGetTexParameterxv}, - {"glHint", (void *)glHint}, - {"glIsBuffer", (void *)glIsBuffer}, - {"glIsEnabled", (void *)glIsEnabled}, - {"glIsTexture", (void *)glIsTexture}, - {"glLightModelx", (void *)glLightModelx}, - {"glLightModelxv", (void *)glLightModelxv}, - {"glLightx", (void *)glLightx}, - {"glLightxv", (void *)glLightxv}, - {"glLineWidthx", (void *)glLineWidthx}, - {"glLoadIdentity", (void *)glLoadIdentity}, - {"glLoadMatrixx", (void *)glLoadMatrixx}, - {"glLogicOp", (void *)glLogicOp}, - {"glMaterialx", (void *)glMaterialx}, - {"glMaterialxv", (void *)glMaterialxv}, - {"glMatrixMode", (void *)glMatrixMode}, - {"glMultMatrixx", (void *)glMultMatrixx}, - {"glMultiTexCoord4x", (void *)glMultiTexCoord4x}, - {"glNormal3x", (void *)glNormal3x}, - {"glNormalPointer", (void *)glNormalPointer}, - {"glOrthox", (void *)glOrthox}, - {"glPixelStorei", (void *)glPixelStorei}, - {"glPointParameterx", (void *)glPointParameterx}, - {"glPointParameterxv", (void *)glPointParameterxv}, - {"glPointSizex", (void *)glPointSizex}, - {"glPolygonOffsetx", (void *)glPolygonOffsetx}, - {"glPopMatrix", (void *)glPopMatrix}, - {"glPushMatrix", (void *)glPushMatrix}, - {"glReadPixels", (void *)glReadPixels}, - {"glRotatex", (void *)glRotatex}, - {"glSampleCoverage", (void *)glSampleCoverage}, - {"glSampleCoveragex", (void *)glSampleCoveragex}, - {"glScalex", (void *)glScalex}, - {"glScissor", (void *)glScissor}, - {"glShadeModel", (void *)glShadeModel}, - {"glStencilFunc", (void *)glStencilFunc}, - {"glStencilMask", (void *)glStencilMask}, - {"glStencilOp", (void *)glStencilOp}, - {"glTexCoordPointer", (void *)glTexCoordPointer}, - {"glTexEnvi", (void *)glTexEnvi}, - {"glTexEnvx", (void *)glTexEnvx}, - {"glTexEnviv", (void *)glTexEnviv}, - {"glTexEnvxv", (void *)glTexEnvxv}, - {"glTexImage2D", (void *)glTexImage2D}, - {"glTexParameteri", (void *)glTexParameteri}, - {"glTexParameterx", (void *)glTexParameterx}, - {"glTexParameteriv", (void *)glTexParameteriv}, - {"glTexParameterxv", (void *)glTexParameterxv}, - {"glTexSubImage2D", (void *)glTexSubImage2D}, - {"glTranslatex", (void *)glTranslatex}, - {"glVertexPointer", (void *)glVertexPointer}, - {"glViewport", (void *)glViewport}, - {"glPointSizePointerOES", (void *)glPointSizePointerOES}, - {"glBlendEquationSeparateOES", (void *)glBlendEquationSeparateOES}, - {"glBlendFuncSeparateOES", (void *)glBlendFuncSeparateOES}, - {"glBlendEquationOES", (void *)glBlendEquationOES}, - {"glDrawTexsOES", (void *)glDrawTexsOES}, - {"glDrawTexiOES", (void *)glDrawTexiOES}, - {"glDrawTexxOES", (void *)glDrawTexxOES}, - {"glDrawTexsvOES", (void *)glDrawTexsvOES}, - {"glDrawTexivOES", (void *)glDrawTexivOES}, - {"glDrawTexxvOES", (void *)glDrawTexxvOES}, - {"glDrawTexfOES", (void *)glDrawTexfOES}, - {"glDrawTexfvOES", (void *)glDrawTexfvOES}, - {"glEGLImageTargetTexture2DOES", (void *)glEGLImageTargetTexture2DOES}, - {"glEGLImageTargetRenderbufferStorageOES", (void *)glEGLImageTargetRenderbufferStorageOES}, - {"glAlphaFuncxOES", (void *)glAlphaFuncxOES}, - {"glClearColorxOES", (void *)glClearColorxOES}, - {"glClearDepthxOES", (void *)glClearDepthxOES}, - {"glClipPlanexOES", (void *)glClipPlanexOES}, - {"glColor4xOES", (void *)glColor4xOES}, - {"glDepthRangexOES", (void *)glDepthRangexOES}, - {"glFogxOES", (void *)glFogxOES}, - {"glFogxvOES", (void *)glFogxvOES}, - {"glFrustumxOES", (void *)glFrustumxOES}, - {"glGetClipPlanexOES", (void *)glGetClipPlanexOES}, - {"glGetFixedvOES", (void *)glGetFixedvOES}, - {"glGetLightxvOES", (void *)glGetLightxvOES}, - {"glGetMaterialxvOES", (void *)glGetMaterialxvOES}, - {"glGetTexEnvxvOES", (void *)glGetTexEnvxvOES}, - {"glGetTexParameterxvOES", (void *)glGetTexParameterxvOES}, - {"glLightModelxOES", (void *)glLightModelxOES}, - {"glLightModelxvOES", (void *)glLightModelxvOES}, - {"glLightxOES", (void *)glLightxOES}, - {"glLightxvOES", (void *)glLightxvOES}, - {"glLineWidthxOES", (void *)glLineWidthxOES}, - {"glLoadMatrixxOES", (void *)glLoadMatrixxOES}, - {"glMaterialxOES", (void *)glMaterialxOES}, - {"glMaterialxvOES", (void *)glMaterialxvOES}, - {"glMultMatrixxOES", (void *)glMultMatrixxOES}, - {"glMultiTexCoord4xOES", (void *)glMultiTexCoord4xOES}, - {"glNormal3xOES", (void *)glNormal3xOES}, - {"glOrthoxOES", (void *)glOrthoxOES}, - {"glPointParameterxOES", (void *)glPointParameterxOES}, - {"glPointParameterxvOES", (void *)glPointParameterxvOES}, - {"glPointSizexOES", (void *)glPointSizexOES}, - {"glPolygonOffsetxOES", (void *)glPolygonOffsetxOES}, - {"glRotatexOES", (void *)glRotatexOES}, - {"glSampleCoveragexOES", (void *)glSampleCoveragexOES}, - {"glScalexOES", (void *)glScalexOES}, - {"glTexEnvxOES", (void *)glTexEnvxOES}, - {"glTexEnvxvOES", (void *)glTexEnvxvOES}, - {"glTexParameterxOES", (void *)glTexParameterxOES}, - {"glTexParameterxvOES", (void *)glTexParameterxvOES}, - {"glTranslatexOES", (void *)glTranslatexOES}, - {"glIsRenderbufferOES", (void *)glIsRenderbufferOES}, - {"glBindRenderbufferOES", (void *)glBindRenderbufferOES}, - {"glDeleteRenderbuffersOES", (void *)glDeleteRenderbuffersOES}, - {"glGenRenderbuffersOES", (void *)glGenRenderbuffersOES}, - {"glRenderbufferStorageOES", (void *)glRenderbufferStorageOES}, - {"glGetRenderbufferParameterivOES", (void *)glGetRenderbufferParameterivOES}, - {"glIsFramebufferOES", (void *)glIsFramebufferOES}, - {"glBindFramebufferOES", (void *)glBindFramebufferOES}, - {"glDeleteFramebuffersOES", (void *)glDeleteFramebuffersOES}, - {"glGenFramebuffersOES", (void *)glGenFramebuffersOES}, - {"glCheckFramebufferStatusOES", (void *)glCheckFramebufferStatusOES}, - {"glFramebufferRenderbufferOES", (void *)glFramebufferRenderbufferOES}, - {"glFramebufferTexture2DOES", (void *)glFramebufferTexture2DOES}, - {"glGetFramebufferAttachmentParameterivOES", (void *)glGetFramebufferAttachmentParameterivOES}, - {"glGenerateMipmapOES", (void *)glGenerateMipmapOES}, - {"glMapBufferOES", (void *)glMapBufferOES}, - {"glUnmapBufferOES", (void *)glUnmapBufferOES}, - {"glGetBufferPointervOES", (void *)glGetBufferPointervOES}, - {"glCurrentPaletteMatrixOES", (void *)glCurrentPaletteMatrixOES}, - {"glLoadPaletteFromModelViewMatrixOES", (void *)glLoadPaletteFromModelViewMatrixOES}, - {"glMatrixIndexPointerOES", (void *)glMatrixIndexPointerOES}, - {"glWeightPointerOES", (void *)glWeightPointerOES}, - {"glQueryMatrixxOES", (void *)glQueryMatrixxOES}, - {"glDepthRangefOES", (void *)glDepthRangefOES}, - {"glFrustumfOES", (void *)glFrustumfOES}, - {"glOrthofOES", (void *)glOrthofOES}, - {"glClipPlanefOES", (void *)glClipPlanefOES}, - {"glGetClipPlanefOES", (void *)glGetClipPlanefOES}, - {"glClearDepthfOES", (void *)glClearDepthfOES}, - {"glTexGenfOES", (void *)glTexGenfOES}, - {"glTexGenfvOES", (void *)glTexGenfvOES}, - {"glTexGeniOES", (void *)glTexGeniOES}, - {"glTexGenivOES", (void *)glTexGenivOES}, - {"glTexGenxOES", (void *)glTexGenxOES}, - {"glTexGenxvOES", (void *)glTexGenxvOES}, - {"glGetTexGenfvOES", (void *)glGetTexGenfvOES}, - {"glGetTexGenivOES", (void *)glGetTexGenivOES}, - {"glGetTexGenxvOES", (void *)glGetTexGenxvOES}, - {"glBindVertexArrayOES", (void *)glBindVertexArrayOES}, - {"glDeleteVertexArraysOES", (void *)glDeleteVertexArraysOES}, - {"glGenVertexArraysOES", (void *)glGenVertexArraysOES}, - {"glIsVertexArrayOES", (void *)glIsVertexArrayOES}, - {"glDiscardFramebufferEXT", (void *)glDiscardFramebufferEXT}, - {"glMultiDrawArraysEXT", (void *)glMultiDrawArraysEXT}, - {"glMultiDrawElementsEXT", (void *)glMultiDrawElementsEXT}, - {"glClipPlanefIMG", (void *)glClipPlanefIMG}, - {"glClipPlanexIMG", (void *)glClipPlanexIMG}, - {"glRenderbufferStorageMultisampleIMG", (void *)glRenderbufferStorageMultisampleIMG}, - {"glFramebufferTexture2DMultisampleIMG", (void *)glFramebufferTexture2DMultisampleIMG}, - {"glDeleteFencesNV", (void *)glDeleteFencesNV}, - {"glGenFencesNV", (void *)glGenFencesNV}, - {"glIsFenceNV", (void *)glIsFenceNV}, - {"glTestFenceNV", (void *)glTestFenceNV}, - {"glGetFenceivNV", (void *)glGetFenceivNV}, - {"glFinishFenceNV", (void *)glFinishFenceNV}, - {"glSetFenceNV", (void *)glSetFenceNV}, - {"glGetDriverControlsQCOM", (void *)glGetDriverControlsQCOM}, - {"glGetDriverControlStringQCOM", (void *)glGetDriverControlStringQCOM}, - {"glEnableDriverControlQCOM", (void *)glEnableDriverControlQCOM}, - {"glDisableDriverControlQCOM", (void *)glDisableDriverControlQCOM}, - {"glExtGetTexturesQCOM", (void *)glExtGetTexturesQCOM}, - {"glExtGetBuffersQCOM", (void *)glExtGetBuffersQCOM}, - {"glExtGetRenderbuffersQCOM", (void *)glExtGetRenderbuffersQCOM}, - {"glExtGetFramebuffersQCOM", (void *)glExtGetFramebuffersQCOM}, - {"glExtGetTexLevelParameterivQCOM", (void *)glExtGetTexLevelParameterivQCOM}, - {"glExtTexObjectStateOverrideiQCOM", (void *)glExtTexObjectStateOverrideiQCOM}, - {"glExtGetTexSubImageQCOM", (void *)glExtGetTexSubImageQCOM}, - {"glExtGetBufferPointervQCOM", (void *)glExtGetBufferPointervQCOM}, - {"glExtGetShadersQCOM", (void *)glExtGetShadersQCOM}, - {"glExtGetProgramsQCOM", (void *)glExtGetProgramsQCOM}, - {"glExtIsProgramBinaryQCOM", (void *)glExtIsProgramBinaryQCOM}, - {"glExtGetProgramBinarySourceQCOM", (void *)glExtGetProgramBinarySourceQCOM}, - {"glStartTilingQCOM", (void *)glStartTilingQCOM}, - {"glEndTilingQCOM", (void *)glEndTilingQCOM} -}; -static int gles_num_funcs = sizeof(gles_funcs_by_name) / sizeof(struct _gles_funcs_by_name); diff --git a/emulator/opengl/tests/gles_android_wrapper/gles_proc.h b/emulator/opengl/tests/gles_android_wrapper/gles_proc.h deleted file mode 100644 index afd94b9..0000000 --- a/emulator/opengl/tests/gles_android_wrapper/gles_proc.h +++ /dev/null @@ -1,296 +0,0 @@ -/* -* Copyright (C) 2011 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -#ifndef _GLES_PROC_H -#define _GLES_PROC_H - -#include <GLES/gl.h> -#define GL_GLEXT_PROTOTYPES -#include <GLES/glext.h> - -typedef void (* glAlphaFunc_t) (GLenum, GLclampf); -typedef void (* glClearColor_t) (GLclampf, GLclampf, GLclampf, GLclampf); -typedef void (* glClearDepthf_t) (GLclampf); -typedef void (* glClipPlanef_t) (GLenum, const GLfloat*); -typedef void (* glColor4f_t) (GLfloat, GLfloat, GLfloat, GLfloat); -typedef void (* glDepthRangef_t) (GLclampf, GLclampf); -typedef void (* glFogf_t) (GLenum, GLfloat); -typedef void (* glFogfv_t) (GLenum, const GLfloat*); -typedef void (* glFrustumf_t) (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -typedef void (* glGetClipPlanef_t) (GLenum, GLfloat*); -typedef void (* glGetFloatv_t) (GLenum, GLfloat*); -typedef void (* glGetLightfv_t) (GLenum, GLenum, GLfloat*); -typedef void (* glGetMaterialfv_t) (GLenum, GLenum, GLfloat*); -typedef void (* glGetTexEnvfv_t) (GLenum, GLenum, GLfloat*); -typedef void (* glGetTexParameterfv_t) (GLenum, GLenum, GLfloat*); -typedef void (* glLightModelf_t) (GLenum, GLfloat); -typedef void (* glLightModelfv_t) (GLenum, const GLfloat*); -typedef void (* glLightf_t) (GLenum, GLenum, GLfloat); -typedef void (* glLightfv_t) (GLenum, GLenum, const GLfloat*); -typedef void (* glLineWidth_t) (GLfloat); -typedef void (* glLoadMatrixf_t) (const GLfloat*); -typedef void (* glMaterialf_t) (GLenum, GLenum, GLfloat); -typedef void (* glMaterialfv_t) (GLenum, GLenum, const GLfloat*); -typedef void (* glMultMatrixf_t) (const GLfloat*); -typedef void (* glMultiTexCoord4f_t) (GLenum, GLfloat, GLfloat, GLfloat, GLfloat); -typedef void (* glNormal3f_t) (GLfloat, GLfloat, GLfloat); -typedef void (* glOrthof_t) (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -typedef void (* glPointParameterf_t) (GLenum, GLfloat); -typedef void (* glPointParameterfv_t) (GLenum, const GLfloat*); -typedef void (* glPointSize_t) (GLfloat); -typedef void (* glPolygonOffset_t) (GLfloat, GLfloat); -typedef void (* glRotatef_t) (GLfloat, GLfloat, GLfloat, GLfloat); -typedef void (* glScalef_t) (GLfloat, GLfloat, GLfloat); -typedef void (* glTexEnvf_t) (GLenum, GLenum, GLfloat); -typedef void (* glTexEnvfv_t) (GLenum, GLenum, const GLfloat*); -typedef void (* glTexParameterf_t) (GLenum, GLenum, GLfloat); -typedef void (* glTexParameterfv_t) (GLenum, GLenum, const GLfloat*); -typedef void (* glTranslatef_t) (GLfloat, GLfloat, GLfloat); -typedef void (* glActiveTexture_t) (GLenum); -typedef void (* glAlphaFuncx_t) (GLenum, GLclampx); -typedef void (* glBindBuffer_t) (GLenum, GLuint); -typedef void (* glBindTexture_t) (GLenum, GLuint); -typedef void (* glBlendFunc_t) (GLenum, GLenum); -typedef void (* glBufferData_t) (GLenum, GLsizeiptr, const GLvoid*, GLenum); -typedef void (* glBufferSubData_t) (GLenum, GLintptr, GLsizeiptr, const GLvoid*); -typedef void (* glClear_t) (GLbitfield); -typedef void (* glClearColorx_t) (GLclampx, GLclampx, GLclampx, GLclampx); -typedef void (* glClearDepthx_t) (GLclampx); -typedef void (* glClearStencil_t) (GLint); -typedef void (* glClientActiveTexture_t) (GLenum); -typedef void (* glClipPlanex_t) (GLenum, const GLfixed*); -typedef void (* glColor4ub_t) (GLubyte, GLubyte, GLubyte, GLubyte); -typedef void (* glColor4x_t) (GLfixed, GLfixed, GLfixed, GLfixed); -typedef void (* glColorMask_t) (GLboolean, GLboolean, GLboolean, GLboolean); -typedef void (* glColorPointer_t) (GLint, GLenum, GLsizei, const GLvoid*); -typedef void (* glCompressedTexImage2D_t) (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid*); -typedef void (* glCompressedTexSubImage2D_t) (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid*); -typedef void (* glCopyTexImage2D_t) (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint); -typedef void (* glCopyTexSubImage2D_t) (GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); -typedef void (* glCullFace_t) (GLenum); -typedef void (* glDeleteBuffers_t) (GLsizei, const GLuint*); -typedef void (* glDeleteTextures_t) (GLsizei, const GLuint*); -typedef void (* glDepthFunc_t) (GLenum); -typedef void (* glDepthMask_t) (GLboolean); -typedef void (* glDepthRangex_t) (GLclampx, GLclampx); -typedef void (* glDisable_t) (GLenum); -typedef void (* glDisableClientState_t) (GLenum); -typedef void (* glDrawArrays_t) (GLenum, GLint, GLsizei); -typedef void (* glDrawElements_t) (GLenum, GLsizei, GLenum, const GLvoid*); -typedef void (* glEnable_t) (GLenum); -typedef void (* glEnableClientState_t) (GLenum); -typedef void (* glFinish_t) (); -typedef void (* glFlush_t) (); -typedef void (* glFogx_t) (GLenum, GLfixed); -typedef void (* glFogxv_t) (GLenum, const GLfixed*); -typedef void (* glFrontFace_t) (GLenum); -typedef void (* glFrustumx_t) (GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed); -typedef void (* glGetBooleanv_t) (GLenum, GLboolean*); -typedef void (* glGetBufferParameteriv_t) (GLenum, GLenum, GLint*); -typedef void (* glGetClipPlanex_t) (GLenum, GLfixed*); -typedef void (* glGenBuffers_t) (GLsizei, GLuint*); -typedef void (* glGenTextures_t) (GLsizei, GLuint*); -typedef GLenum (* glGetError_t) (); -typedef void (* glGetFixedv_t) (GLenum, GLfixed*); -typedef void (* glGetIntegerv_t) (GLenum, GLint*); -typedef void (* glGetLightxv_t) (GLenum, GLenum, GLfixed*); -typedef void (* glGetMaterialxv_t) (GLenum, GLenum, GLfixed*); -typedef void (* glGetPointerv_t) (GLenum, GLvoid**); -typedef const GLubyte* (* glGetString_t) (GLenum); -typedef void (* glGetTexEnviv_t) (GLenum, GLenum, GLint*); -typedef void (* glGetTexEnvxv_t) (GLenum, GLenum, GLfixed*); -typedef void (* glGetTexParameteriv_t) (GLenum, GLenum, GLint*); -typedef void (* glGetTexParameterxv_t) (GLenum, GLenum, GLfixed*); -typedef void (* glHint_t) (GLenum, GLenum); -typedef GLboolean (* glIsBuffer_t) (GLuint); -typedef GLboolean (* glIsEnabled_t) (GLenum); -typedef GLboolean (* glIsTexture_t) (GLuint); -typedef void (* glLightModelx_t) (GLenum, GLfixed); -typedef void (* glLightModelxv_t) (GLenum, const GLfixed*); -typedef void (* glLightx_t) (GLenum, GLenum, GLfixed); -typedef void (* glLightxv_t) (GLenum, GLenum, const GLfixed*); -typedef void (* glLineWidthx_t) (GLfixed); -typedef void (* glLoadIdentity_t) (); -typedef void (* glLoadMatrixx_t) (const GLfixed*); -typedef void (* glLogicOp_t) (GLenum); -typedef void (* glMaterialx_t) (GLenum, GLenum, GLfixed); -typedef void (* glMaterialxv_t) (GLenum, GLenum, const GLfixed*); -typedef void (* glMatrixMode_t) (GLenum); -typedef void (* glMultMatrixx_t) (const GLfixed*); -typedef void (* glMultiTexCoord4x_t) (GLenum, GLfixed, GLfixed, GLfixed, GLfixed); -typedef void (* glNormal3x_t) (GLfixed, GLfixed, GLfixed); -typedef void (* glNormalPointer_t) (GLenum, GLsizei, const GLvoid*); -typedef void (* glOrthox_t) (GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed); -typedef void (* glPixelStorei_t) (GLenum, GLint); -typedef void (* glPointParameterx_t) (GLenum, GLfixed); -typedef void (* glPointParameterxv_t) (GLenum, const GLfixed*); -typedef void (* glPointSizex_t) (GLfixed); -typedef void (* glPolygonOffsetx_t) (GLfixed, GLfixed); -typedef void (* glPopMatrix_t) (); -typedef void (* glPushMatrix_t) (); -typedef void (* glReadPixels_t) (GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid*); -typedef void (* glRotatex_t) (GLfixed, GLfixed, GLfixed, GLfixed); -typedef void (* glSampleCoverage_t) (GLclampf, GLboolean); -typedef void (* glSampleCoveragex_t) (GLclampx, GLboolean); -typedef void (* glScalex_t) (GLfixed, GLfixed, GLfixed); -typedef void (* glScissor_t) (GLint, GLint, GLsizei, GLsizei); -typedef void (* glShadeModel_t) (GLenum); -typedef void (* glStencilFunc_t) (GLenum, GLint, GLuint); -typedef void (* glStencilMask_t) (GLuint); -typedef void (* glStencilOp_t) (GLenum, GLenum, GLenum); -typedef void (* glTexCoordPointer_t) (GLint, GLenum, GLsizei, const GLvoid*); -typedef void (* glTexEnvi_t) (GLenum, GLenum, GLint); -typedef void (* glTexEnvx_t) (GLenum, GLenum, GLfixed); -typedef void (* glTexEnviv_t) (GLenum, GLenum, const GLint*); -typedef void (* glTexEnvxv_t) (GLenum, GLenum, const GLfixed*); -typedef void (* glTexImage2D_t) (GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid*); -typedef void (* glTexParameteri_t) (GLenum, GLenum, GLint); -typedef void (* glTexParameterx_t) (GLenum, GLenum, GLfixed); -typedef void (* glTexParameteriv_t) (GLenum, GLenum, const GLint*); -typedef void (* glTexParameterxv_t) (GLenum, GLenum, const GLfixed*); -typedef void (* glTexSubImage2D_t) (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid*); -typedef void (* glTranslatex_t) (GLfixed, GLfixed, GLfixed); -typedef void (* glVertexPointer_t) (GLint, GLenum, GLsizei, const GLvoid*); -typedef void (* glViewport_t) (GLint, GLint, GLsizei, GLsizei); -typedef void (* glPointSizePointerOES_t) (GLenum, GLsizei, const GLvoid*); -typedef void (* glBlendEquationSeparateOES_t) (GLenum, GLenum); -typedef void (* glBlendFuncSeparateOES_t) (GLenum, GLenum, GLenum, GLenum); -typedef void (* glBlendEquationOES_t) (GLenum); -typedef void (* glDrawTexsOES_t) (GLshort, GLshort, GLshort, GLshort, GLshort); -typedef void (* glDrawTexiOES_t) (GLint, GLint, GLint, GLint, GLint); -typedef void (* glDrawTexxOES_t) (GLfixed, GLfixed, GLfixed, GLfixed, GLfixed); -typedef void (* glDrawTexsvOES_t) (const GLshort*); -typedef void (* glDrawTexivOES_t) (const GLint*); -typedef void (* glDrawTexxvOES_t) (const GLfixed*); -typedef void (* glDrawTexfOES_t) (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -typedef void (* glDrawTexfvOES_t) (const GLfloat*); -typedef void (* glEGLImageTargetTexture2DOES_t) (GLenum, GLeglImageOES); -typedef void (* glEGLImageTargetRenderbufferStorageOES_t) (GLenum, GLeglImageOES); -typedef void (* glAlphaFuncxOES_t) (GLenum, GLclampx); -typedef void (* glClearColorxOES_t) (GLclampx, GLclampx, GLclampx, GLclampx); -typedef void (* glClearDepthxOES_t) (GLclampx); -typedef void (* glClipPlanexOES_t) (GLenum, const GLfixed*); -typedef void (* glColor4xOES_t) (GLfixed, GLfixed, GLfixed, GLfixed); -typedef void (* glDepthRangexOES_t) (GLclampx, GLclampx); -typedef void (* glFogxOES_t) (GLenum, GLfixed); -typedef void (* glFogxvOES_t) (GLenum, const GLfixed*); -typedef void (* glFrustumxOES_t) (GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed); -typedef void (* glGetClipPlanexOES_t) (GLenum, GLfixed*); -typedef void (* glGetFixedvOES_t) (GLenum, GLfixed*); -typedef void (* glGetLightxvOES_t) (GLenum, GLenum, GLfixed*); -typedef void (* glGetMaterialxvOES_t) (GLenum, GLenum, GLfixed*); -typedef void (* glGetTexEnvxvOES_t) (GLenum, GLenum, GLfixed*); -typedef void (* glGetTexParameterxvOES_t) (GLenum, GLenum, GLfixed*); -typedef void (* glLightModelxOES_t) (GLenum, GLfixed); -typedef void (* glLightModelxvOES_t) (GLenum, const GLfixed*); -typedef void (* glLightxOES_t) (GLenum, GLenum, GLfixed); -typedef void (* glLightxvOES_t) (GLenum, GLenum, const GLfixed*); -typedef void (* glLineWidthxOES_t) (GLfixed); -typedef void (* glLoadMatrixxOES_t) (const GLfixed*); -typedef void (* glMaterialxOES_t) (GLenum, GLenum, GLfixed); -typedef void (* glMaterialxvOES_t) (GLenum, GLenum, const GLfixed*); -typedef void (* glMultMatrixxOES_t) (const GLfixed*); -typedef void (* glMultiTexCoord4xOES_t) (GLenum, GLfixed, GLfixed, GLfixed, GLfixed); -typedef void (* glNormal3xOES_t) (GLfixed, GLfixed, GLfixed); -typedef void (* glOrthoxOES_t) (GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed); -typedef void (* glPointParameterxOES_t) (GLenum, GLfixed); -typedef void (* glPointParameterxvOES_t) (GLenum, const GLfixed*); -typedef void (* glPointSizexOES_t) (GLfixed); -typedef void (* glPolygonOffsetxOES_t) (GLfixed, GLfixed); -typedef void (* glRotatexOES_t) (GLfixed, GLfixed, GLfixed, GLfixed); -typedef void (* glSampleCoveragexOES_t) (GLclampx, GLboolean); -typedef void (* glScalexOES_t) (GLfixed, GLfixed, GLfixed); -typedef void (* glTexEnvxOES_t) (GLenum, GLenum, GLfixed); -typedef void (* glTexEnvxvOES_t) (GLenum, GLenum, const GLfixed*); -typedef void (* glTexParameterxOES_t) (GLenum, GLenum, GLfixed); -typedef void (* glTexParameterxvOES_t) (GLenum, GLenum, const GLfixed*); -typedef void (* glTranslatexOES_t) (GLfixed, GLfixed, GLfixed); -typedef GLboolean (* glIsRenderbufferOES_t) (GLuint); -typedef void (* glBindRenderbufferOES_t) (GLenum, GLuint); -typedef void (* glDeleteRenderbuffersOES_t) (GLsizei, const GLuint*); -typedef void (* glGenRenderbuffersOES_t) (GLsizei, GLuint*); -typedef void (* glRenderbufferStorageOES_t) (GLenum, GLenum, GLsizei, GLsizei); -typedef void (* glGetRenderbufferParameterivOES_t) (GLenum, GLenum, GLint*); -typedef GLboolean (* glIsFramebufferOES_t) (GLuint); -typedef void (* glBindFramebufferOES_t) (GLenum, GLuint); -typedef void (* glDeleteFramebuffersOES_t) (GLsizei, const GLuint*); -typedef void (* glGenFramebuffersOES_t) (GLsizei, GLuint*); -typedef GLenum (* glCheckFramebufferStatusOES_t) (GLenum); -typedef void (* glFramebufferRenderbufferOES_t) (GLenum, GLenum, GLenum, GLuint); -typedef void (* glFramebufferTexture2DOES_t) (GLenum, GLenum, GLenum, GLuint, GLint); -typedef void (* glGetFramebufferAttachmentParameterivOES_t) (GLenum, GLenum, GLenum, GLint*); -typedef void (* glGenerateMipmapOES_t) (GLenum); -typedef void* (* glMapBufferOES_t) (GLenum, GLenum); -typedef GLboolean (* glUnmapBufferOES_t) (GLenum); -typedef void (* glGetBufferPointervOES_t) (GLenum, GLenum, GLvoid*); -typedef void (* glCurrentPaletteMatrixOES_t) (GLuint); -typedef void (* glLoadPaletteFromModelViewMatrixOES_t) (); -typedef void (* glMatrixIndexPointerOES_t) (GLint, GLenum, GLsizei, const GLvoid*); -typedef void (* glWeightPointerOES_t) (GLint, GLenum, GLsizei, const GLvoid*); -typedef GLbitfield (* glQueryMatrixxOES_t) (GLfixed*, GLint*); -typedef void (* glDepthRangefOES_t) (GLclampf, GLclampf); -typedef void (* glFrustumfOES_t) (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -typedef void (* glOrthofOES_t) (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -typedef void (* glClipPlanefOES_t) (GLenum, const GLfloat*); -typedef void (* glGetClipPlanefOES_t) (GLenum, GLfloat*); -typedef void (* glClearDepthfOES_t) (GLclampf); -typedef void (* glTexGenfOES_t) (GLenum, GLenum, GLfloat); -typedef void (* glTexGenfvOES_t) (GLenum, GLenum, const GLfloat*); -typedef void (* glTexGeniOES_t) (GLenum, GLenum, GLint); -typedef void (* glTexGenivOES_t) (GLenum, GLenum, const GLint*); -typedef void (* glTexGenxOES_t) (GLenum, GLenum, GLfixed); -typedef void (* glTexGenxvOES_t) (GLenum, GLenum, const GLfixed*); -typedef void (* glGetTexGenfvOES_t) (GLenum, GLenum, GLfloat*); -typedef void (* glGetTexGenivOES_t) (GLenum, GLenum, GLint*); -typedef void (* glGetTexGenxvOES_t) (GLenum, GLenum, GLfixed*); -typedef void (* glBindVertexArrayOES_t) (GLuint); -typedef void (* glDeleteVertexArraysOES_t) (GLsizei, const GLuint*); -typedef void (* glGenVertexArraysOES_t) (GLsizei, GLuint*); -typedef GLboolean (* glIsVertexArrayOES_t) (GLuint); -typedef void (* glDiscardFramebufferEXT_t) (GLenum, GLsizei, const GLenum*); -typedef void (* glMultiDrawArraysEXT_t) (GLenum, GLint*, GLsizei*, GLsizei); -typedef void (* glMultiDrawElementsEXT_t) (GLenum, const GLsizei*, GLenum, const GLvoid**, GLsizei); -typedef void (* glClipPlanefIMG_t) (GLenum, const GLfloat*); -typedef void (* glClipPlanexIMG_t) (GLenum, const GLfixed*); -typedef void (* glRenderbufferStorageMultisampleIMG_t) (GLenum, GLsizei, GLenum, GLsizei, GLsizei); -typedef void (* glFramebufferTexture2DMultisampleIMG_t) (GLenum, GLenum, GLenum, GLuint, GLint, GLsizei); -typedef void (* glDeleteFencesNV_t) (GLsizei, const GLuint*); -typedef void (* glGenFencesNV_t) (GLsizei, GLuint*); -typedef GLboolean (* glIsFenceNV_t) (GLuint); -typedef GLboolean (* glTestFenceNV_t) (GLuint); -typedef void (* glGetFenceivNV_t) (GLuint, GLenum, GLint*); -typedef void (* glFinishFenceNV_t) (GLuint); -typedef void (* glSetFenceNV_t) (GLuint, GLenum); -typedef void (* glGetDriverControlsQCOM_t) (GLint*, GLsizei, GLuint*); -typedef void (* glGetDriverControlStringQCOM_t) (GLuint, GLsizei, GLsizei*, GLchar*); -typedef void (* glEnableDriverControlQCOM_t) (GLuint); -typedef void (* glDisableDriverControlQCOM_t) (GLuint); -typedef void (* glExtGetTexturesQCOM_t) (GLuint*, GLint, GLint*); -typedef void (* glExtGetBuffersQCOM_t) (GLuint*, GLint, GLint*); -typedef void (* glExtGetRenderbuffersQCOM_t) (GLuint*, GLint, GLint*); -typedef void (* glExtGetFramebuffersQCOM_t) (GLuint*, GLint, GLint*); -typedef void (* glExtGetTexLevelParameterivQCOM_t) (GLuint, GLenum, GLint, GLenum, GLint*); -typedef void (* glExtTexObjectStateOverrideiQCOM_t) (GLenum, GLenum, GLint); -typedef void (* glExtGetTexSubImageQCOM_t) (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, GLvoid*); -typedef void (* glExtGetBufferPointervQCOM_t) (GLenum, GLvoid**); -typedef void (* glExtGetShadersQCOM_t) (GLuint*, GLint, GLint*); -typedef void (* glExtGetProgramsQCOM_t) (GLuint*, GLint, GLint*); -typedef GLboolean (* glExtIsProgramBinaryQCOM_t) (GLuint); -typedef void (* glExtGetProgramBinarySourceQCOM_t) (GLuint, GLenum, GLchar*, GLint*); -typedef void (* glStartTilingQCOM_t) (GLuint, GLuint, GLuint, GLuint, GLbitfield); -typedef void (* glEndTilingQCOM_t) (GLbitfield); - - -#endif diff --git a/emulator/opengl/tests/gles_android_wrapper/glesv1_emul_ifc.cpp b/emulator/opengl/tests/gles_android_wrapper/glesv1_emul_ifc.cpp deleted file mode 100644 index 26c98a8..0000000 --- a/emulator/opengl/tests/gles_android_wrapper/glesv1_emul_ifc.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* -* Copyright 2011 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include <stdlib.h> -#include "ApiInitializer.h" -#include <dlfcn.h> -#include "gl_wrapper_context.h" - -extern "C" { - gl_wrapper_context_t *createFromLib(void *solib, gl_wrapper_context_t *(*accessor)()); -} - -gl_wrapper_context_t * createFromLib(void *solib, gl_wrapper_context_t *(accessor)()) -{ - gl_wrapper_context_t *ctx = new gl_wrapper_context_t; - if (ctx == NULL) { - return NULL; - } - ApiInitializer *initializer = new ApiInitializer(solib); - ctx->initDispatchByName(ApiInitializer::s_getProc, initializer); - gl_wrapper_context_t::setContextAccessor(accessor); - delete initializer; - return ctx; -} - - diff --git a/emulator/opengl/tests/gles_android_wrapper/glesv2_emul_ifc.cpp b/emulator/opengl/tests/gles_android_wrapper/glesv2_emul_ifc.cpp deleted file mode 100644 index 4ae13dd..0000000 --- a/emulator/opengl/tests/gles_android_wrapper/glesv2_emul_ifc.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* -* Copyright 2011 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include <stdlib.h> -#include "ApiInitializer.h" -#include <dlfcn.h> -#include "gl2_wrapper_context.h" - -extern "C" { - gl2_wrapper_context_t *createFromLib(void *solib, gl2_wrapper_context_t *(*accessor)()); -} - -gl2_wrapper_context_t * createFromLib(void *solib, gl2_wrapper_context_t *(*accessor)()) -{ - gl2_wrapper_context_t *ctx = new gl2_wrapper_context_t; - if (ctx == NULL) { - return NULL; - } - ApiInitializer *initializer = new ApiInitializer(solib); - ctx->initDispatchByName(ApiInitializer::s_getProc, initializer); - gl2_wrapper_context_t::setContextAccessor(accessor); - delete initializer; - return ctx; -} - - - diff --git a/emulator/opengl/tests/ut_rendercontrol_dec/Android.mk b/emulator/opengl/tests/ut_rendercontrol_dec/Android.mk index a5a01e8..b94bd44 100644 --- a/emulator/opengl/tests/ut_rendercontrol_dec/Android.mk +++ b/emulator/opengl/tests/ut_rendercontrol_dec/Android.mk @@ -2,6 +2,5 @@ LOCAL_PATH := $(call my-dir) $(call emugl-begin-host-shared-library,libut_rendercontrol_dec) $(call emugl-import, libOpenglCodecCommon) -$(call emugl-gen-decoder,$(EMUGL_PATH)/tests/ut_rendercontrol_enc,ut_rendercontrol) -$(call emugl-export,C_INCLUDES,$(EMUGL_PATH)/tests/ut_rendercontrol_enc) +$(call emugl-gen-decoder,$(LOCAL_PATH),ut_rendercontrol) $(call emugl-end-module) diff --git a/emulator/opengl/tests/ut_rendercontrol_enc/ut_rendercontrol.attrib b/emulator/opengl/tests/ut_rendercontrol_dec/ut_rendercontrol.attrib index c47a9f9..c47a9f9 100644 --- a/emulator/opengl/tests/ut_rendercontrol_enc/ut_rendercontrol.attrib +++ b/emulator/opengl/tests/ut_rendercontrol_dec/ut_rendercontrol.attrib diff --git a/emulator/opengl/tests/ut_rendercontrol_enc/ut_rendercontrol.in b/emulator/opengl/tests/ut_rendercontrol_dec/ut_rendercontrol.in index 0d5942f..0d5942f 100644 --- a/emulator/opengl/tests/ut_rendercontrol_enc/ut_rendercontrol.in +++ b/emulator/opengl/tests/ut_rendercontrol_dec/ut_rendercontrol.in diff --git a/emulator/opengl/tests/ut_rendercontrol_enc/ut_rendercontrol.types b/emulator/opengl/tests/ut_rendercontrol_dec/ut_rendercontrol.types index 9d945ab..9d945ab 100644 --- a/emulator/opengl/tests/ut_rendercontrol_enc/ut_rendercontrol.types +++ b/emulator/opengl/tests/ut_rendercontrol_dec/ut_rendercontrol.types diff --git a/emulator/opengl/tests/ut_rendercontrol_enc/ut_rendercontrol_types.h b/emulator/opengl/tests/ut_rendercontrol_dec/ut_rendercontrol_types.h index 9b7864d..9b7864d 100644 --- a/emulator/opengl/tests/ut_rendercontrol_enc/ut_rendercontrol_types.h +++ b/emulator/opengl/tests/ut_rendercontrol_dec/ut_rendercontrol_types.h |