aboutsummaryrefslogtreecommitdiffstats
path: root/emulator/opengl/tests/EGL_host_wrapper
diff options
context:
space:
mode:
Diffstat (limited to 'emulator/opengl/tests/EGL_host_wrapper')
-rw-r--r--emulator/opengl/tests/EGL_host_wrapper/Android.mk16
-rw-r--r--emulator/opengl/tests/EGL_host_wrapper/egl.cpp277
-rw-r--r--emulator/opengl/tests/EGL_host_wrapper/egl_dispatch.cpp77
-rw-r--r--emulator/opengl/tests/EGL_host_wrapper/egl_dispatch.h115
-rw-r--r--emulator/opengl/tests/EGL_host_wrapper/egl_ftable.h66
-rw-r--r--emulator/opengl/tests/EGL_host_wrapper/egl_proc.h68
6 files changed, 619 insertions, 0 deletions
diff --git a/emulator/opengl/tests/EGL_host_wrapper/Android.mk b/emulator/opengl/tests/EGL_host_wrapper/Android.mk
new file mode 100644
index 0000000..19d8794
--- /dev/null
+++ b/emulator/opengl/tests/EGL_host_wrapper/Android.mk
@@ -0,0 +1,16 @@
+ifeq ($(HOST_OS),linux)
+
+LOCAL_PATH := $(call my-dir)
+
+$(call emugl-begin-host-static-library,libEGL_host_wrapper)
+
+LOCAL_SRC_FILES := \
+ egl.cpp \
+ egl_dispatch.cpp
+
+$(call emugl-export,LDLIBS,-ldl -pthread)
+$(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
+
+$(call emugl-end-module)
+
+endif # HOST_OS == linux
diff --git a/emulator/opengl/tests/EGL_host_wrapper/egl.cpp b/emulator/opengl/tests/EGL_host_wrapper/egl.cpp
new file mode 100644
index 0000000..6fa27ac
--- /dev/null
+++ b/emulator/opengl/tests/EGL_host_wrapper/egl.cpp
@@ -0,0 +1,277 @@
+/*
+* 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 "egl_dispatch.h"
+#include "egl_ftable.h"
+#include <pthread.h>
+
+#define EGL_LIB "ANDROID_EGL_LIB"
+
+static struct egl_dispatch *s_dispatch = NULL;
+static pthread_once_t eglDispatchInitialized = PTHREAD_ONCE_INIT;
+
+void initEglDispatch()
+{
+ //
+ // Load back-end EGL implementation library
+ //
+ char *eglLib = (char *) "libEGL.so";
+ if (getenv(EGL_LIB) != NULL) {
+ eglLib = getenv(EGL_LIB);
+ }
+
+ s_dispatch = loadEGL(eglLib);
+ if (!s_dispatch) {
+ fprintf(stderr,"FATAL ERROR: Could not load EGL lib [%s]\n", eglLib);
+ exit(-1);
+ }
+}
+
+static struct egl_dispatch *getDispatch()
+{
+ pthread_once(&eglDispatchInitialized, initEglDispatch);
+ return s_dispatch;
+}
+
+__eglMustCastToProperFunctionPointerType eglGetProcAddress(const char *procname)
+{
+ 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;
+ }
+ }
+
+ return getDispatch()->eglGetProcAddress(procname);
+}
+
+//////////////// 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);
+}
+
+EGLBoolean eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config)
+{
+ return getDispatch()->eglChooseConfig(dpy, attrib_list, configs, config_size, num_config);
+}
+
+EGLBoolean eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value)
+{
+ return getDispatch()->eglGetConfigAttrib(dpy, config, attribute, value);
+}
+
+EGLSurface eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list)
+{
+ return getDispatch()->eglCreateWindowSurface(dpy, config, win, attrib_list);
+}
+
+EGLSurface eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list)
+{
+ return getDispatch()->eglCreatePbufferSurface(dpy, config, attrib_list);
+}
+
+EGLSurface eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list)
+{
+ return getDispatch()->eglCreatePixmapSurface(dpy, config, pixmap, attrib_list);
+}
+
+EGLBoolean eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
+{
+ return getDispatch()->eglDestroySurface(dpy, surface);
+}
+
+EGLBoolean eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value)
+{
+ return getDispatch()->eglQuerySurface(dpy, surface, attribute, value);
+}
+
+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)
+{
+ return getDispatch()->eglCreateContext(dpy, config, share_context, attrib_list);
+}
+
+EGLBoolean eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
+{
+ return getDispatch()->eglDestroyContext(dpy, ctx);
+}
+
+EGLBoolean eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx)
+{
+ return getDispatch()->eglMakeCurrent(dpy, draw, read, ctx);
+}
+
+EGLContext eglGetCurrentContext()
+{
+ return getDispatch()->eglGetCurrentContext();
+}
+
+EGLSurface eglGetCurrentSurface(EGLint readdraw)
+{
+ return getDispatch()->eglGetCurrentSurface(readdraw);
+}
+
+EGLDisplay eglGetCurrentDisplay()
+{
+ return getDispatch()->eglGetCurrentDisplay();
+}
+
+EGLBoolean eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value)
+{
+ return getDispatch()->eglQueryContext(dpy, ctx, attribute, value);
+}
+
+EGLBoolean eglWaitGL()
+{
+ return getDispatch()->eglWaitGL();
+}
+
+EGLBoolean eglWaitNative(EGLint engine)
+{
+ return getDispatch()->eglWaitNative(engine);
+}
+
+EGLBoolean eglSwapBuffers(EGLDisplay dpy, EGLSurface surface)
+{
+ 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)
+{
+ return getDispatch()->eglCreateImageKHR(dpy, ctx, 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/EGL_host_wrapper/egl_dispatch.cpp b/emulator/opengl/tests/EGL_host_wrapper/egl_dispatch.cpp
new file mode 100644
index 0000000..a9b8214
--- /dev/null
+++ b/emulator/opengl/tests/EGL_host_wrapper/egl_dispatch.cpp
@@ -0,0 +1,77 @@
+/*
+* 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 <dlfcn.h>
+#include "egl_dispatch.h"
+
+
+egl_dispatch *loadEGL(const char *p_eglPath)
+{
+ void *libEGL = dlopen(p_eglPath, RTLD_NOW);
+ if (!libEGL) {
+ return NULL;
+ }
+
+ egl_dispatch *disp = new egl_dispatch;
+
+ void *ptr;
+ ptr = dlsym(libEGL,"eglGetError"); disp->set_eglGetError((eglGetError_t)ptr);
+ ptr = dlsym(libEGL,"eglGetDisplay"); disp->set_eglGetDisplay((eglGetDisplay_t)ptr);
+ ptr = dlsym(libEGL,"eglInitialize"); disp->set_eglInitialize((eglInitialize_t)ptr);
+ ptr = dlsym(libEGL,"eglTerminate"); disp->set_eglTerminate((eglTerminate_t)ptr);
+ ptr = dlsym(libEGL,"eglQueryString"); disp->set_eglQueryString((eglQueryString_t)ptr);
+ ptr = dlsym(libEGL,"eglGetConfigs"); disp->set_eglGetConfigs((eglGetConfigs_t)ptr);
+ ptr = dlsym(libEGL,"eglChooseConfig"); disp->set_eglChooseConfig((eglChooseConfig_t)ptr);
+ ptr = dlsym(libEGL,"eglGetConfigAttrib"); disp->set_eglGetConfigAttrib((eglGetConfigAttrib_t)ptr);
+ ptr = dlsym(libEGL,"eglCreateWindowSurface"); disp->set_eglCreateWindowSurface((eglCreateWindowSurface_t)ptr);
+ ptr = dlsym(libEGL,"eglCreatePbufferSurface"); disp->set_eglCreatePbufferSurface((eglCreatePbufferSurface_t)ptr);
+ ptr = dlsym(libEGL,"eglCreatePixmapSurface"); disp->set_eglCreatePixmapSurface((eglCreatePixmapSurface_t)ptr);
+ ptr = dlsym(libEGL,"eglDestroySurface"); disp->set_eglDestroySurface((eglDestroySurface_t)ptr);
+ ptr = dlsym(libEGL,"eglQuerySurface"); disp->set_eglQuerySurface((eglQuerySurface_t)ptr);
+ ptr = dlsym(libEGL,"eglBindAPI"); disp->set_eglBindAPI((eglBindAPI_t)ptr);
+ ptr = dlsym(libEGL,"eglQueryAPI"); disp->set_eglQueryAPI((eglQueryAPI_t)ptr);
+ ptr = dlsym(libEGL,"eglWaitClient"); disp->set_eglWaitClient((eglWaitClient_t)ptr);
+ ptr = dlsym(libEGL,"eglReleaseThread"); disp->set_eglReleaseThread((eglReleaseThread_t)ptr);
+ ptr = dlsym(libEGL,"eglCreatePbufferFromClientBuffer"); disp->set_eglCreatePbufferFromClientBuffer((eglCreatePbufferFromClientBuffer_t)ptr);
+ ptr = dlsym(libEGL,"eglSurfaceAttrib"); disp->set_eglSurfaceAttrib((eglSurfaceAttrib_t)ptr);
+ ptr = dlsym(libEGL,"eglBindTexImage"); disp->set_eglBindTexImage((eglBindTexImage_t)ptr);
+ ptr = dlsym(libEGL,"eglReleaseTexImage"); disp->set_eglReleaseTexImage((eglReleaseTexImage_t)ptr);
+ ptr = dlsym(libEGL,"eglSwapInterval"); disp->set_eglSwapInterval((eglSwapInterval_t)ptr);
+ ptr = dlsym(libEGL,"eglCreateContext"); disp->set_eglCreateContext((eglCreateContext_t)ptr);
+ ptr = dlsym(libEGL,"eglDestroyContext"); disp->set_eglDestroyContext((eglDestroyContext_t)ptr);
+ ptr = dlsym(libEGL,"eglMakeCurrent"); disp->set_eglMakeCurrent((eglMakeCurrent_t)ptr);
+ ptr = dlsym(libEGL,"eglGetCurrentContext"); disp->set_eglGetCurrentContext((eglGetCurrentContext_t)ptr);
+ ptr = dlsym(libEGL,"eglGetCurrentSurface"); disp->set_eglGetCurrentSurface((eglGetCurrentSurface_t)ptr);
+ ptr = dlsym(libEGL,"eglGetCurrentDisplay"); disp->set_eglGetCurrentDisplay((eglGetCurrentDisplay_t)ptr);
+ ptr = dlsym(libEGL,"eglQueryContext"); disp->set_eglQueryContext((eglQueryContext_t)ptr);
+ ptr = dlsym(libEGL,"eglWaitGL"); disp->set_eglWaitGL((eglWaitGL_t)ptr);
+ ptr = dlsym(libEGL,"eglWaitNative"); disp->set_eglWaitNative((eglWaitNative_t)ptr);
+ ptr = dlsym(libEGL,"eglSwapBuffers"); disp->set_eglSwapBuffers((eglSwapBuffers_t)ptr);
+ ptr = dlsym(libEGL,"eglCopyBuffers"); disp->set_eglCopyBuffers((eglCopyBuffers_t)ptr);
+ ptr = dlsym(libEGL,"eglGetProcAddress"); disp->set_eglGetProcAddress((eglGetProcAddress_t)ptr);
+ ptr = dlsym(libEGL,"eglLockSurfaceKHR"); disp->set_eglLockSurfaceKHR((eglLockSurfaceKHR_t)ptr);
+ ptr = dlsym(libEGL,"eglUnlockSurfaceKHR"); disp->set_eglUnlockSurfaceKHR((eglUnlockSurfaceKHR_t)ptr);
+ ptr = dlsym(libEGL,"eglCreateImageKHR"); disp->set_eglCreateImageKHR((eglCreateImageKHR_t)ptr);
+ ptr = dlsym(libEGL,"eglDestroyImageKHR"); disp->set_eglDestroyImageKHR((eglDestroyImageKHR_t)ptr);
+ ptr = dlsym(libEGL,"eglCreateSyncKHR"); disp->set_eglCreateSyncKHR((eglCreateSyncKHR_t)ptr);
+ ptr = dlsym(libEGL,"eglDestroySyncKHR"); disp->set_eglDestroySyncKHR((eglDestroySyncKHR_t)ptr);
+ ptr = dlsym(libEGL,"eglClientWaitSyncKHR"); disp->set_eglClientWaitSyncKHR((eglClientWaitSyncKHR_t)ptr);
+ ptr = dlsym(libEGL,"eglSignalSyncKHR"); disp->set_eglSignalSyncKHR((eglSignalSyncKHR_t)ptr);
+ ptr = dlsym(libEGL,"eglGetSyncAttribKHR"); disp->set_eglGetSyncAttribKHR((eglGetSyncAttribKHR_t)ptr);
+ ptr = dlsym(libEGL,"eglSetSwapRectangleANDROID"); disp->set_eglSetSwapRectangleANDROID((eglSetSwapRectangleANDROID_t)ptr);
+
+ return disp;
+}
diff --git a/emulator/opengl/tests/EGL_host_wrapper/egl_dispatch.h b/emulator/opengl/tests/EGL_host_wrapper/egl_dispatch.h
new file mode 100644
index 0000000..e5f67c9
--- /dev/null
+++ b/emulator/opengl/tests/EGL_host_wrapper/egl_dispatch.h
@@ -0,0 +1,115 @@
+/*
+* 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 *loadEGL(const char *p_eglPath);
+
+#endif
diff --git a/emulator/opengl/tests/EGL_host_wrapper/egl_ftable.h b/emulator/opengl/tests/EGL_host_wrapper/egl_ftable.h
new file mode 100644
index 0000000..ee40585
--- /dev/null
+++ b/emulator/opengl/tests/EGL_host_wrapper/egl_ftable.h
@@ -0,0 +1,66 @@
+/*
+* 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/EGL_host_wrapper/egl_proc.h b/emulator/opengl/tests/EGL_host_wrapper/egl_proc.h
new file mode 100644
index 0000000..140c030
--- /dev/null
+++ b/emulator/opengl/tests/EGL_host_wrapper/egl_proc.h
@@ -0,0 +1,68 @@
+/*
+* 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