From 3daab3cdcd10f1e545510a4ffe7bcd95c68d499a Mon Sep 17 00:00:00 2001 From: jihye kim Date: Wed, 22 Aug 2012 11:42:18 +0900 Subject: migrate rsa git from private git --- debian/changelog | 142 ++++++++++++++++++++++++++++++--------- debian/control | 6 ++ debian/simulator-opengl.install | 1 + egl_1_4/37CreateContext.c | 2 + egl_1_4/37DestroyContext.c | 145 +++++++++++++++++++++++----------------- egl_1_4/37GetCurrentContext.c | 4 ++ egl_1_4/37MakeCurrent.c | 17 +++-- egl_1_4/39CopyBuffers.c | 4 ++ egl_1_4/3AGetProcAddress.c | 3 +- egl_1_4/global.c | 79 ++++++++++++++++++++++ egl_1_4/implement.h | 16 +++-- egl_1_4/makefile-dynamic | 4 +- es_1_1/makefile-dynamic | 2 +- es_2_0/EGLImage.c | 8 ++- es_2_0/Enable.c | 5 -- es_2_0/Program.c | 24 ++++--- es_2_0/Shader.c | 8 ++- es_2_0/Uniform.c | 8 +-- es_2_0/es2front.h | 1 + es_2_0/funcaction.inl | 1 + es_2_0/makefile-dynamic | 4 +- lib/host-gl/libEGL.so.1.0 | Bin 0 -> 541646 bytes lib/host-gl/libGL.so.1.2 | Bin 0 -> 1371456 bytes lib/host-gl/libGLESv1_CM.so.1.0 | Bin 0 -> 1270589 bytes lib/host-gl/libGLESv2.so.1.0 | Bin 0 -> 622728 bytes lib/libEGL.so | 2 +- lib/libEGL.so.1 | 2 +- lib/libEGL.so.1.0 | Bin 8947762 -> 0 bytes lib/libGL.so | 2 +- lib/libGL.so.1 | 2 +- lib/libGL.so.1.0 | 2 +- lib/libGL.so.1.2 | Bin 1259003 -> 0 bytes lib/libGLESv1_CM.so | 2 +- lib/libGLESv1_CM.so.1 | 2 +- lib/libGLESv1_CM.so.1.0 | Bin 1270597 -> 0 bytes lib/libGLESv2.so | 2 +- lib/libGLESv2.so.1 | 2 +- lib/libGLESv2.so.1.0 | Bin 1620438 -> 0 bytes lib/pkgconfig/opengl.pc | 2 +- lib/pkgconfig/opengl2.pc | 2 +- libGL/Makefile | 4 +- libGL/client_gl.c | 36 ++++++++++ libGL/client_glx.c | 72 ++++++++++++++------ libGL/common.h | 2 +- libGL/gl_func_perso.h | 3 + libGL/opengl_client.c | 15 ++++- libGL/opengl_func.h | 9 +++ libGL/parse_gl_h.c | 5 ++ packaging/simulator-opengl.spec | 3 +- 49 files changed, 484 insertions(+), 171 deletions(-) create mode 100755 lib/host-gl/libEGL.so.1.0 create mode 100755 lib/host-gl/libGL.so.1.2 create mode 100755 lib/host-gl/libGLESv1_CM.so.1.0 create mode 100755 lib/host-gl/libGLESv2.so.1.0 delete mode 100755 lib/libEGL.so.1.0 delete mode 100755 lib/libGL.so.1.2 delete mode 100755 lib/libGLESv1_CM.so.1.0 delete mode 100755 lib/libGLESv2.so.1.0 diff --git a/debian/changelog b/debian/changelog index b1fdb10..63b3058 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,74 +1,154 @@ +simulator-opengl (0.1.28) unstable; urgency=low + + * pixmap, EGLImageKHR, glEGLImageTargetTexture2DOES extension add. + * Git: 165.213.149.219:sdk/simulator-opengl + * Tag: simulator-opengl_0.1.28 + + -- Sangjin Kim Tue, 21 Aug 2012 18:19:12 +0900 + +simulator-opengl (0.1.25) unstable; urgency=low + + * Coregl support. + * Git: 165.213.149.219:slp/sdk/simulator-opengl + * Tag: simulator-opengl_0.1.25 + + -- Sangjin Kim Tue, 31 Jul 2012 16:07:02 +0900 + +simulator-opengl (0.1.24) unstable; urgency=low + + * Link to libGL library in pkgconfig file is removed. + * Git: 165.213.149.219:slp/sdk/simulator-opengl + * Tag: simulator-opengl_0.1.24 + + -- Sangjin Kim Sat, 07 Jul 2012 23:42:07 +0900 + +simulator-opengl (0.1.23) unstable; urgency=low + + * Version upgraded for UniformLocation bug fix. + * Git: 165.213.149.219:slp/sdk/simulator-opengl + * Tag: simulator-opengl_0.1.23 + + -- Jinhyung Jo Fri, 06 Jul 2012 20:49:33 +0900 + simulator-opengl (0.1.22) unstable; urgency=low - * shader and glUniform bug fixed. - * Git: 165.213.180.234:slp/sdk/simulator-opengl + * Version upgraded for eglDestroyContext bug fix. + * Git: 165.213.149.219:slp/sdk/simulator-opengl * Tag: simulator-opengl_0.1.22 - -- Sangjin Kim Wed, 18 Apr 2012 19:52:21 +0900 + -- Sangjin Kim Mon, 02 Jul 2012 17:19:12 +0900 simulator-opengl (0.1.21) unstable; urgency=low - * browser multi-view bug fix. - * Git: 165.213.180.234:slp/sdk/simulator-opengl + * spec file changed. + * Git: 165.213.149.219:slp/sdk/simulator-opengl * Tag: simulator-opengl_0.1.21 - -- Sangjin Kim Mon, 09 Apr 2012 18:50:42 +0900 + -- Sangjin Kim Mon, 21 May 2012 14:11:03 +0900 simulator-opengl (0.1.20) unstable; urgency=low - * browser segv bug fix. - * Git: 165.213.180.234:slp/sdk/simulator-opengl + * sw mesa gles support. + * Git: 165.213.149.219:slp/sdk/simulator-opengl * Tag: simulator-opengl_0.1.20 - -- Sangjin Kim Fri, 06 Apr 2012 11:09:40 +0900 + -- Sangjin Kim Thu, 17 May 2012 18:46:58 +0900 simulator-opengl (0.1.19) unstable; urgency=low - * udev rule file deleted. - * Git: 165.213.180.234:slp/sdk/simulator-opengl + * udev rule file deleted. Makefile, include path cleaned. + * Git: 165.213.149.219:slp/sdk/simulator-opengl * Tag: simulator-opengl_0.1.19 - -- Sangjin Kim Mon, 02 Apr 2012 19:35:17 +0900 - -simulator-opengl (0.1.18) unstable; urgency=low - - * Makefile, include path cleaned. - * Git: 165.213.180.234:slp/sdk/simulator-opengl - * Tag: simulator-opengl_0.1.18 - - -- Sangjin Kim Mon, 02 Apr 2012 18:02:01 +0900 + -- Sangjin Kim Tue, 03 Apr 2012 16:33:27 +0900 simulator-opengl (0.1.17) unstable; urgency=low * Some bug patched. - * Git: 165.213.180.234:slp/sdk/simulator-opengl + * Git: 165.213.149.219:slp/sdk/simulator-opengl * Tag: simulator-opengl_0.1.17 - -- Sangjin Kim Fri, 23 Mar 2012 10:56:54 +0900 + -- Sangjin Kim Fri, 23 Mar 2012 10:40:59 +0900 simulator-opengl (0.1.16) unstable; urgency=low - * spec file updated. - * Git: 165.213.180.234:slp/sdk/simulator-opengl + * spec file modified. + * Git: 165.213.149.219:slp/sdk/simulator-opengl * Tag: simulator-opengl_0.1.16 - -- Sangjin Kim Tue, 20 Mar 2012 16:08:42 +0900 + -- Sangjin Kim Tue, 20 Mar 2012 15:51:21 +0900 + +simulator-opengl (0.1.15) unstable; urgency=low + + * Runtime dependency added to spec file + * Git: 165.213.149.219:slp/sdk/simulator-opengl + * Tag: simulator-opengl_0.1.15 + + -- Sangjin Kim Tue, 20 Mar 2012 13:29:48 +0900 simulator-opengl (0.1-14) unstable; urgency=low - * spec file added. - * Git: 165.213.180.234:slp/sdk/simulator-opengl + * spec file add. + * Git: 165.213.149.219:slp/sdk/simulator-opengl * Tag: simulator-opengl_0.1-14 - -- Sangjin Kim Mon, 19 Mar 2012 16:49:42 +0900 + -- Sangjin Kim Mon, 19 Mar 2012 16:18:11 +0900 simulator-opengl (0.1-13) unstable; urgency=low - * New gl-es acceleration code added. - * Git: 165.213.180.234:slp/sdk/simulator-opengl + * Package internal reference changed. + * Git: 165.213.149.219:slp/sdk/simulator-opengl * Tag: simulator-opengl_0.1-13 - -- Sangjin Kim Sat, 17 Mar 2012 17:59:54 +0900 + -- Sangjin Kim Sat, 17 Mar 2012 14:37:21 +0900 + +simulator-opengl (0.1-12) unstable; urgency=low + + * changelog whitespace error fix. + * Git: 165.213.149.219:slp/sdk/simulator-opengl + * Tag: simulator-opengl_0.1-12 + + -- Sangjin Kim Thu, 15 Mar 2012 16:18:29 +0900 + +simulator-opengl (0.1-11) unstable; urgency=low + + * Build error fixed. + * Git: 165.213.149.219:slp/sdk/simulator-opengl + * Tag: simulator-opengl_0.1-11 + + -- Sangjin Kim Thu, 15 Mar 2012 15:42:43 +0900 + +simulator-opengl (0.1-10) unstable; urgency=low + + * Build error fixed. + * Git: 165.213.149.219:slp/sdk/simulator-opengl + * Tag: simulator-opengl_0.1-10 + + -- Sangjin Kim Thu, 15 Mar 2012 15:24:25 +0900 + +simulator-opengl (0.1-9) unstable; urgency=low + + * New gles acceleration implementation adopted. (meego latest + virtio) + * Git: 165.213.149.219:slp/sdk/simulator-opengl + * Tag: simulator-opengl_0.1-9 + + -- Sangjin Kim Thu, 15 Mar 2012 14:38:53 +0900 + +simulator-opengl (0.1-8) unstable; urgency=low + + * libGL sourcode added for new gles implementation. + * Git: 165.213.149.219:slp/sdk/simulator-opengl + * Tag: simulator-opengl_0.1-8 + + -- Sangjin Kim Thu, 15 Mar 2012 11:58:56 +0900 + +simulator-opengl (0.1-7) unstable; urgency=low + + * License changed(LGPL->MIT), segfault fixed, dependency added. + * Git: 165.213.149.219:slp/sdk/simulator-opengl + * Tag: simulator-opengl_0.1-7 + + -- Sooyoung Ha Fri, 06 Jan 2012 18:28:36 +0900 simulator-opengl (0.1-6) unstable; urgency=low diff --git a/debian/control b/debian/control index 560bf26..138db50 100644 --- a/debian/control +++ b/debian/control @@ -17,3 +17,9 @@ Section : libs Architecture: i386 Depends: ${shlibs:Depends}, ${misc:Depends}, libx11-6, libx11-xcb1, libxext6 Description: OpenGLES library for simulator + +Package: simulator-opengl-dbg +Section : debug +Architecture: i386 +Depends: ${shlibs:Depends}, ${misc:Depends}, simulator-opengl (= ${binary:Version}), libx11-6, libx11-xcb1, libxext6 +Description: OpenGLES debugging library for simulator diff --git a/debian/simulator-opengl.install b/debian/simulator-opengl.install index d34bd90..c0c8d5f 100644 --- a/debian/simulator-opengl.install +++ b/debian/simulator-opengl.install @@ -1 +1,2 @@ usr/lib/*.so* +usr/lib/host-gl diff --git a/egl_1_4/37CreateContext.c b/egl_1_4/37CreateContext.c index 5ab239e..95afd38 100755 --- a/egl_1_4/37CreateContext.c +++ b/egl_1_4/37CreateContext.c @@ -111,6 +111,7 @@ EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config, pContext->renderBuffer = EGL_NONE; pContext->apiKind = EGLINTER(global).currentAPI; pContext->apiVersion = apiVersion; + pContext->deleted = EGL_FALSE; switch (pContext->apiKind) { default: case EGL_OPENGL_API: @@ -169,5 +170,6 @@ EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLINTER(SetError)(EGL_BAD_CONTEXT); return EGL_NO_CONTEXT; } + return (EGLContext)(pContext->native); } diff --git a/egl_1_4/37DestroyContext.c b/egl_1_4/37DestroyContext.c index 1d9b22c..c3fb146 100755 --- a/egl_1_4/37DestroyContext.c +++ b/egl_1_4/37DestroyContext.c @@ -47,74 +47,93 @@ void (*fpVGReleaseContext)(void*) = NULL;//jcpark EGLINTER(SetError)(EGL_NOT_INITIALIZED); return EGL_FALSE; } + + struct ContextExtra* pContext = EGLINTER(LookUpContext)(ctx); if (pContext == NULL) { EGLINTER(SetError)(EGL_BAD_CONTEXT); return EGL_FALSE; } - switch (pContext->apiKind) { - default: - case EGL_OPENGL_API: - assert(pContext->apiContext == NULL); - break; -#if defined(PROVIDING_RUNTIME_BINDING) - case EGL_OPENGL_ES_API: - if (pContext->apiVersion == 2) { - if (EGLINTER(global).dlES2 == NULL) { - if ((EGLINTER(global).dlES2 = dlopen(GL_ES2_SO_FILENAME, RTLD_NOW | RTLD_GLOBAL)) - == NULL) { - EGLINTER(SetError)(EGL_BAD_ACCESS); - return; - } - } - fpReleaseContext = dlsym(EGLINTER(global).dlES2, EGLCROSS_PREFIX "ReleaseContext"); - if (fpReleaseContext != NULL) { - (*fpReleaseContext)(pContext->apiContext); - pContext->apiContext = NULL; - } - } else { - if (EGLINTER(global).dlES1 == NULL) { - if ((EGLINTER(global).dlES1 = dlopen(GL_ES1_SO_FILENAME, RTLD_NOW | RTLD_GLOBAL)) - == NULL) { - EGLINTER(SetError)(EGL_BAD_ACCESS); - return; - } - } - fpReleaseContext = dlsym(EGLINTER(global).dlES1, EGLCROSS_PREFIX "ReleaseContext"); - if (fpReleaseContext != NULL) { - (*fpReleaseContext)(pContext->apiContext); - pContext->apiContext = NULL; - } - } - break; -#else - case EGL_OPENGL_ES_API: - if (pContext->apiContext != NULL) { - EGLCROSS(ReleaseContext)(pContext->apiContext); - } - break; -#endif - case EGL_OPENVG_API: - /* TODO: OpenVG may need some action here */ - - if (EGLINTER(global).dlVG == NULL) { printf("==jcpark vg4egl_DestroyContext 2\n"); - if ((EGLINTER(global).dlVG = dlopen(VG_SO_FILENAME, RTLD_NOW | RTLD_GLOBAL)) - == NULL) { printf("==jcpark vg4egl_DestroyContext 3\n"); - EGLINTER(SetError)(EGL_BAD_ACCESS); - return; - } - } - fpVGReleaseContext = dlsym(EGLINTER(global).dlVG, "vg4egl_DestroyContext"); - if (fpVGReleaseContext != NULL) { - (*fpVGReleaseContext)(pContext->apiContext); - pContext->apiContext = NULL; - printf("==jcpark== vg4egl_DestroyContext working\n"); - } - - break; +// switch (pContext->apiKind) { +// default: +// case EGL_OPENGL_API: +// assert(pContext->apiContext == NULL); +// break; +//#if defined(PROVIDING_RUNTIME_BINDING) +// case EGL_OPENGL_ES_API: +// if (pContext->apiVersion == 2) { +// if (EGLINTER(global).dlES2 == NULL) { +// if ((EGLINTER(global).dlES2 = dlopen(GL_ES2_SO_FILENAME, RTLD_NOW | RTLD_GLOBAL)) +// == NULL) { +// EGLINTER(SetError)(EGL_BAD_ACCESS); +// return; +// } +// } +// fpReleaseContext = dlsym(EGLINTER(global).dlES2, EGLCROSS_PREFIX "ReleaseContext"); +// if (fpReleaseContext != NULL) { +// (*fpReleaseContext)(pContext->apiContext); +// pContext->apiContext = NULL; +// } +// } else { +// if (EGLINTER(global).dlES1 == NULL) { +// if ((EGLINTER(global).dlES1 = dlopen(GL_ES1_SO_FILENAME, RTLD_NOW | RTLD_GLOBAL)) +// == NULL) { +// EGLINTER(SetError)(EGL_BAD_ACCESS); +// return; +// } +// } +// fpReleaseContext = dlsym(EGLINTER(global).dlES1, EGLCROSS_PREFIX "ReleaseContext"); +// if (fpReleaseContext != NULL) { +// (*fpReleaseContext)(pContext->apiContext); +// pContext->apiContext = NULL; +// } +// } +// break; +//#else +// case EGL_OPENGL_ES_API: +// if (pContext->apiContext != NULL) { +// EGLCROSS(ReleaseContext)(pContext->apiContext); +// } +// break; +//#endif +// case EGL_OPENVG_API: +// /* TODO: OpenVG may need some action here */ +// +// if (EGLINTER(global).dlVG == NULL) { printf("==jcpark vg4egl_DestroyContext 2\n"); +// if ((EGLINTER(global).dlVG = dlopen(VG_SO_FILENAME, RTLD_NOW | RTLD_GLOBAL)) +// == NULL) { printf("==jcpark vg4egl_DestroyContext 3\n"); +// EGLINTER(SetError)(EGL_BAD_ACCESS); +// return; +// } +// } +// fpVGReleaseContext = dlsym(EGLINTER(global).dlVG, "vg4egl_DestroyContext"); +// if (fpVGReleaseContext != NULL) { +// (*fpVGReleaseContext)(pContext->apiContext); +// pContext->apiContext = NULL; +// printf("==jcpark== vg4egl_DestroyContext working\n"); +// } +// +// break; +// } +// FNPTR(DestroyContext)(pDisplay->native, pContext->native); +// EGLINTER(DeleteContext)(ctx); +// +// return EGL_TRUE; + /* Do not delete context that is current, but mark it and deleted it + * when change current in eglMakeCurrent + * TODO: Add refcount to track context, so can delete it when refcount + * reach 0 in eglDestroyContext/eglMakeCurrent + */ + struct ContextExtra* pPrevious = NULL; + GLXContext nativePrevious = FNPTR(GetCurrentContext)(); + if (nativePrevious != NULL) { + EGLContext uniquePrevious = (EGLContext)(nativePrevious); + pPrevious = EGLINTER(LookUpContext)(uniquePrevious); + } + if (pContext == pPrevious) { + pContext->deleted = EGL_TRUE; + return EGL_TRUE; } - FNPTR(DestroyContext)(pDisplay->native, pContext->native); - EGLINTER(DeleteContext)(ctx); - return EGL_TRUE; + return EGLINTER(FreeContext)(pContext); } diff --git a/egl_1_4/37GetCurrentContext.c b/egl_1_4/37GetCurrentContext.c index e9b1a68..1137908 100755 --- a/egl_1_4/37GetCurrentContext.c +++ b/egl_1_4/37GetCurrentContext.c @@ -33,6 +33,10 @@ EGLContext EGLAPIENTRY eglGetCurrentContext(void) { + return _eglGetCurrentContext(); +} + +EGLContext _eglGetCurrentContext(void) { if (!FNPTR(GetCurrentContext)) return EGL_NO_CONTEXT; diff --git a/egl_1_4/37MakeCurrent.c b/egl_1_4/37MakeCurrent.c index ee19e5d..bb18f1f 100755 --- a/egl_1_4/37MakeCurrent.c +++ b/egl_1_4/37MakeCurrent.c @@ -92,6 +92,7 @@ EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLContext uniquePrevious = (EGLContext)(nativePrevious); pPrevious = EGLINTER(LookUpContext)(uniquePrevious); } + if (pPrevious != NULL) { switch (pPrevious->apiKind) { default: @@ -108,9 +109,9 @@ EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, } } fpMakeCurrent = dlsym(EGLINTER(global).dlES2, EGLCROSS_PREFIX "MakeCurrent"); - if (fpMakeCurrent != NULL) { - (*fpMakeCurrent)(NULL); - } +// if (fpMakeCurrent != NULL) { +// (*fpMakeCurrent)(NULL); +// } } else { if (EGLINTER(global).dlES1 == NULL) { if ((EGLINTER(global).dlES1 = dlopen(GL_ES1_SO_FILENAME, RTLD_NOW | RTLD_GLOBAL)) @@ -120,9 +121,9 @@ EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, } } fpMakeCurrent = dlsym(EGLINTER(global).dlES1, EGLCROSS_PREFIX "MakeCurrent"); - if (fpMakeCurrent != NULL) { - (*fpMakeCurrent)(NULL); - } +// if (fpMakeCurrent != NULL) { +// (*fpMakeCurrent)(NULL); +// } } break; #else @@ -276,5 +277,9 @@ EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, } } #endif + /* Delete previous "current" if it was deleted */ + if (pPrevious != NULL && pPrevious->deleted && pPrevious != pContext) + EGLINTER(FreeContext)(pPrevious); + return EGL_TRUE; } diff --git a/egl_1_4/39CopyBuffers.c b/egl_1_4/39CopyBuffers.c index c1cf51b..bd0a4a5 100755 --- a/egl_1_4/39CopyBuffers.c +++ b/egl_1_4/39CopyBuffers.c @@ -48,6 +48,10 @@ EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLINTER(SetError)(EGL_BAD_SURFACE); return EGL_FALSE; } + + /* SwapBuffers copy pixmap from host buffer to drawable as no + * glxCopyBuffers available */ + FNPTR(SwapBuffers)(pDisplay->native, pSurface->native); Window root; int x, y; diff --git a/egl_1_4/3AGetProcAddress.c b/egl_1_4/3AGetProcAddress.c index 4708aba..2d2e22b 100755 --- a/egl_1_4/3AGetProcAddress.c +++ b/egl_1_4/3AGetProcAddress.c @@ -48,7 +48,8 @@ __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress(const cha void** ptrDLL = NULL; char* sofilename; char* libname; - EGLContext eglContext = eglGetCurrentContext(); + //EGLContext eglContext = eglGetCurrentContext(); + EGLContext eglContext = _eglGetCurrentContext(); if (eglContext != EGL_NO_CONTEXT) { struct ContextExtra* pContext = EGLINTER(LookUpContext)(eglContext); assert(pContext != NULL); diff --git a/egl_1_4/global.c b/egl_1_4/global.c index 28bd842..f5192aa 100755 --- a/egl_1_4/global.c +++ b/egl_1_4/global.c @@ -263,6 +263,85 @@ void EGLAPIENTRY EGLINTER(DeleteContext)(EGLContext unique) { pUnit++; } } + +EGLBoolean EGLAPIENTRY EGLINTER(FreeContext)(struct ContextExtra *pContext) { +void (*fpVGReleaseContext)(void*) = NULL;//jcpark +#if defined(PROVIDING_RUNTIME_BINDING) + void (*fpReleaseContext)(void*) = NULL; +#endif + + switch (pContext->apiKind) { + default: + case EGL_OPENGL_API: + assert(pContext->apiContext == NULL); + break; +#if defined(PROVIDING_RUNTIME_BINDING) + case EGL_OPENGL_ES_API: + if (pContext->apiVersion == 2) { + if (EGLINTER(global).dlES2 == NULL) { + if ((EGLINTER(global).dlES2 = dlopen(GL_ES2_SO_FILENAME, RTLD_NOW | RTLD_GLOBAL)) + == NULL) { + EGLINTER(SetError)(EGL_BAD_ACCESS); + return EGL_FALSE; + } + } + fpReleaseContext = dlsym(EGLINTER(global).dlES2, EGLCROSS_PREFIX "ReleaseContext"); + if (fpReleaseContext != NULL) { + (*fpReleaseContext)(pContext->apiContext); + pContext->apiContext = NULL; + } + } else { + if (EGLINTER(global).dlES1 == NULL) { + if ((EGLINTER(global).dlES1 = dlopen(GL_ES1_SO_FILENAME, RTLD_NOW | RTLD_GLOBAL)) + == NULL) { + EGLINTER(SetError)(EGL_BAD_ACCESS); + return EGL_FALSE; + } + } + fpReleaseContext = dlsym(EGLINTER(global).dlES1, EGLCROSS_PREFIX "ReleaseContext"); + if (fpReleaseContext != NULL) { + (*fpReleaseContext)(pContext->apiContext); + pContext->apiContext = NULL; + } + } + break; +#else + case EGL_OPENGL_ES_API: + if (pContext->apiContext != NULL) { + EGLCROSS(ReleaseContext)(pContext->apiContext); + } + break; +#endif + case EGL_OPENVG_API: + /* TODO: OpenVG may need some action here */ + + if (EGLINTER(global).dlVG == NULL) { printf("==jcpark vg4egl_DestroyContext 2\n"); + if ((EGLINTER(global).dlVG = dlopen(VG_SO_FILENAME, RTLD_NOW | RTLD_GLOBAL)) + == NULL) { printf("==jcpark vg4egl_DestroyContext 3\n"); + EGLINTER(SetError)(EGL_BAD_ACCESS); + return EGL_FALSE; + } + } + fpVGReleaseContext = dlsym(EGLINTER(global).dlVG, "vg4egl_DestroyContext"); + if (fpVGReleaseContext != NULL) { + (*fpVGReleaseContext)(pContext->apiContext); + pContext->apiContext = NULL; + printf("==jcpark== vg4egl_DestroyContext working\n"); + } + + break; + } + + struct DisplayExtra* pDisplay = EGLINTER(LookUpDisplay)(pContext->display); + if (pDisplay == NULL) + return EGL_FALSE; + FNPTR(DestroyContext)(pDisplay->native, pContext->native); + + EGLINTER(DeleteContext)(pContext->unique); + + return EGL_TRUE; +} + struct ImageExtra* EGLAPIENTRY EGLINTER(LookUpEGLImage)(EGLImageKHR unique) { struct ImageExtra* pUnit = EGLINTER(global).pImageExtra; int nCount = EGLINTER(global).nImageExtra; diff --git a/egl_1_4/implement.h b/egl_1_4/implement.h index 8d82118..33b9184 100755 --- a/egl_1_4/implement.h +++ b/egl_1_4/implement.h @@ -136,6 +136,7 @@ struct ContextExtra { EGLenum apiKind; EGLint apiVersion; void* apiContext; + EGLBoolean deleted; }; struct ImageExtra { @@ -146,11 +147,15 @@ struct ImageExtra { EGLNativeDisplayType dpy; Pixmap pixmap; }; -#define EGL_SO_FILENAME "libEGL.so" -#define GL_ES2_SO_FILENAME "libGLESv2.so" -#define GL_ES1_SO_FILENAME "libGLESv1_CM.so" -#define GL_SO_FILENAME "libGL.so" +//#define EGL_SO_FILENAME "libEGL.so" +//#define GL_ES2_SO_FILENAME "libGLESv2.so" +//#define GL_ES1_SO_FILENAME "libGLESv1_CM.so" +//#define GL_SO_FILENAME "libGL.so" #define VG_SO_FILENAME "libOpenVG.so" //jcpark +#define EGL_SO_FILENAME "/usr/lib/host-gl/libEGL.so.1.0" +#define GL_ES2_SO_FILENAME "/usr/lib/host-gl/libGLESv2.so.1.0" +#define GL_ES1_SO_FILENAME "/usr/lib/host-gl/libGLESv1_CM.so.1.0" +#define GL_SO_FILENAME "/usr/lib/host-gl/libGL.so.1.2" struct GlobalStruct { EGLint iLastError; @@ -416,6 +421,7 @@ EGLAPI void EGLAPIENTRY EGLINTER(DeleteDisplay)(EGLDisplay unique); EGLAPI struct SurfaceExtra* EGLAPIENTRY EGLINTER(LookUpSurface)(EGLSurface unique); EGLAPI struct SurfaceExtra* EGLAPIENTRY EGLINTER(InsertSurface)(EGLSurface unique); EGLAPI void EGLAPIENTRY EGLINTER(DeleteSurface)(EGLSurface unique); +EGLAPI EGLBoolean EGLAPIENTRY EGLINTER(FreeContext)(struct ContextExtra *pContext); EGLAPI struct ContextExtra* EGLAPIENTRY EGLINTER(LookUpContext)(EGLContext unique); EGLAPI struct ContextExtra* EGLAPIENTRY EGLINTER(InsertContext)(EGLContext unique); @@ -497,6 +503,8 @@ typedef enum { VG_lABGR_8888_PRE = 9 | (1 << 6) | (1 << 7) } VGImageFormat; +extern EGLContext _eglGetCurrentContext(void); + #ifdef __cplusplus } #endif diff --git a/egl_1_4/makefile-dynamic b/egl_1_4/makefile-dynamic index d1740df..e3c8bef 100755 --- a/egl_1_4/makefile-dynamic +++ b/egl_1_4/makefile-dynamic @@ -1,7 +1,7 @@ #!/bin/make -CFLAGS = -I. -I../include -fPIC -DPROVIDING_RUNTIME_BINDING -Werror-implicit-function-declaration -O0 -g3 +CFLAGS = -I. -I../include -fPIC -DPROVIDING_RUNTIME_BINDING -Werror-implicit-function-declaration -O3 -g ARFLAGS = rucv @@ -66,7 +66,7 @@ $(LIB): $(OBJS) install: $(LIB) - cp $(LIB) ../lib + cp $(LIB) ../lib/host-gl/ # supports diff --git a/es_1_1/makefile-dynamic b/es_1_1/makefile-dynamic index 91dfb72..de5adb6 100755 --- a/es_1_1/makefile-dynamic +++ b/es_1_1/makefile-dynamic @@ -66,7 +66,7 @@ $(LIB): $(OBJS) $(CC) -shared -Wl,-soname,$(LIBBASE).1 -o $@ $(OBJS) -ldl install: $(LIB) - cp $(LIB) ../lib + cp $(LIB) ../lib/host-gl/ # supports diff --git a/es_2_0/EGLImage.c b/es_2_0/EGLImage.c index b6d64de..a552519 100644 --- a/es_2_0/EGLImage.c +++ b/es_2_0/EGLImage.c @@ -9,7 +9,8 @@ #include #include -#define EGL_SO_FILENAME "libEGL.so" +//#define EGL_SO_FILENAME "libEGL.so" +#define EGL_SO_FILENAME "/usr/lib/host-gl/libEGL.so.1.0" #define EGLCROSS_PREFIX "__hazel_cross__" void* g_dlhandle_egl = NULL; @@ -46,6 +47,7 @@ void GL_APIENTRY ES2ENTRY(EGLImageTargetTexture2DOES) (GLenum target, fprintf (stderr, "======== height = 0x%x\n", (unsigned int)height); fprintf (stderr, "======== depth = 0x%x\n", (unsigned int)depth); +#if 0 img = XGetImage ((Display*)dpy, pixmap, 0, 0, width, height, AllPlanes, ZPixmap); if (img == NULL) { fprintf (stderr, "EGLImage: Failed to get pixmap image!\n"); @@ -54,5 +56,7 @@ void GL_APIENTRY ES2ENTRY(EGLImageTargetTexture2DOES) (GLenum target, FNPTR(TexImage2D)(target, 0, GL_RGB, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, img->data); XDestroyImage (img); - +#else + FNPTR(EGLImageTargetTexture2DOES)(target, pixmap); +#endif } diff --git a/es_2_0/Enable.c b/es_2_0/Enable.c index 8a7e2af..ddf83a5 100755 --- a/es_2_0/Enable.c +++ b/es_2_0/Enable.c @@ -45,11 +45,6 @@ void GL_APIENTRY ES2ENTRY(Enable)(GLenum cap) { case GL_STENCIL_TEST: FNPTR(Enable)(cap); break; - /* - case GL_DEPTH_TEST: - // disabled for poor supporting in WebGL. - break; - */ default: ES2INTER(SetError)(GL_INVALID_ENUM); break; diff --git a/es_2_0/Program.c b/es_2_0/Program.c index 1d1f2b9..ab0107d 100755 --- a/es_2_0/Program.c +++ b/es_2_0/Program.c @@ -97,10 +97,15 @@ GLuint GL_APIENTRY ES2ENTRY(CreateProgram)(void) { void GL_APIENTRY ES2ENTRY(DeleteProgram)(GLuint program) { if (program == 0) { return; - } else if (FNPTR(IsProgram)(program) == GL_FALSE) { + } else if (FNPTR(IsProgram) != NULL && FNPTR(IsProgram)(program) == GL_FALSE) { + ES2INTER(SetError)(GL_INVALID_VALUE); + return; + } + if (CCV(nProgramObjectAllocated) == NULL) { ES2INTER(SetError)(GL_INVALID_VALUE); return; } + if (program < CCV(nProgramObjectAllocated)) { GLint nAttachedShaders = 0; FNPTR(GetProgramiv)(program, GL_ATTACHED_SHADERS, &nAttachedShaders); @@ -164,22 +169,25 @@ void GL_APIENTRY ES2ENTRY(DetachShader)(GLuint program, GLuint shader) { if ((GLint)(program) <= 0) { ES2INTER(SetError)(GL_INVALID_VALUE); return; - } else if (FNPTR(IsProgram)(program) == GL_FALSE) { + } else if (FNPTR(IsProgram) != NULL && FNPTR(IsProgram)(program) == GL_FALSE) { ES2INTER(SetError)(GL_INVALID_OPERATION); return; } if ((GLint)(shader) <= 0) { ES2INTER(SetError)(GL_INVALID_VALUE); return; - } else if (FNPTR(IsShader)(shader) == GL_FALSE) { + } else if (FNPTR(IsShader) != NULL && FNPTR(IsShader)(shader) == GL_FALSE) { ES2INTER(SetError)(GL_INVALID_OPERATION); return; } - FNPTR(DetachShader)(program, shader); - pShader = &(CCV(pShaderObject)[shader]); - if (pShader->nAttached > 0) pShader->nAttached--; - if (pShader->nAttached == 0 && pShader->bDeleteStatus == GL_TRUE) { - ES2INTER(ShaderObjectRelease)(pShader); + if (FNPTR(DetachShader) != NULL) + FNPTR(DetachShader)(program, shader); + if (CCV(pShaderObject) != NULL) { + pShader = &(CCV(pShaderObject)[shader]); + if (pShader->nAttached > 0) + pShader->nAttached--; + if (pShader->nAttached == 0 && pShader->bDeleteStatus == GL_TRUE) + ES2INTER(ShaderObjectRelease)(pShader); } } diff --git a/es_2_0/Shader.c b/es_2_0/Shader.c index 1e661d4..e53c92c 100755 --- a/es_2_0/Shader.c +++ b/es_2_0/Shader.c @@ -187,11 +187,15 @@ GLuint GL_APIENTRY ES2ENTRY(CreateShader)(GLenum type) { void GL_APIENTRY ES2ENTRY(DeleteShader)(GLuint shader) { if (shader == 0) { return; - } else if (FNPTR(IsShader)(shader) == GL_FALSE) { + } else if (FNPTR(IsShader) != NULL && FNPTR(IsShader)(shader) == GL_FALSE) { ES2INTER(SetError)(GL_INVALID_VALUE); return; } - FNPTR(DeleteShader)(shader); + if (FNPTR(DeleteShader) != NULL) + FNPTR(DeleteShader)(shader); + if (!CCV(nShaderObjectAllocated)) + ES2INTER(SetError)(GL_INVALID_VALUE); + return; if (shader < CCV(nShaderObjectAllocated)) { struct ShaderObjectUnit* pUnit = &CCV(pShaderObject[shader]); pUnit->bDeleteStatus = GL_TRUE; diff --git a/es_2_0/Uniform.c b/es_2_0/Uniform.c index d488f04..00046df 100755 --- a/es_2_0/Uniform.c +++ b/es_2_0/Uniform.c @@ -84,13 +84,13 @@ void GL_APIENTRY ES2ENTRY(GetUniformfv)(GLuint program, GLint location, GLfloat* ES2INTER(SetError)(GL_INVALID_OPERATION); return; } -/* + FNPTR(GetProgramiv)(program, GL_ACTIVE_UNIFORMS, &nActiveUniforms); if (location < 0 || nActiveUniforms <= location) { ES2INTER(SetError)(GL_INVALID_OPERATION); return; } -*/ + FNPTR(GetUniformfv)(program, location, params); } @@ -109,13 +109,13 @@ void GL_APIENTRY ES2ENTRY(GetUniformiv)(GLuint program, GLint location, GLint* p ES2INTER(SetError)(GL_INVALID_OPERATION); return; } -/* + FNPTR(GetProgramiv)(program, GL_ACTIVE_UNIFORMS, &nActiveUniforms); if (location < 0 || nActiveUniforms <= location) { ES2INTER(SetError)(GL_INVALID_OPERATION); return; } -*/ + FNPTR(GetUniformiv)(program, location, params); } diff --git a/es_2_0/es2front.h b/es_2_0/es2front.h index f75e206..5e340ad 100755 --- a/es_2_0/es2front.h +++ b/es_2_0/es2front.h @@ -367,6 +367,7 @@ struct es2Context { void (*fpFramebufferTexture2D)(GLenum, GLenum, GLenum, GLuint, GLint); void (*fpGetFramebufferAttachmentParameteriv)(GLenum, GLenum, GLenum, GLint*); GLenum (*fpCheckFramebufferStatus)(GLenum); + void (*fpEGLImageTargetTexture2DOES)(GLenum, GLint); #if defined(PROVIDING_OES_texture_3D) void (*fpTexImage3D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid*); void (*fpTexSubImage3D)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid*); diff --git a/es_2_0/funcaction.inl b/es_2_0/funcaction.inl index 22a29f8..51aa375 100755 --- a/es_2_0/funcaction.inl +++ b/es_2_0/funcaction.inl @@ -135,6 +135,7 @@ ACTION( FramebufferTexture2D ); ACTION( GetFramebufferAttachmentParameteriv ); ACTION( CheckFramebufferStatus ); + ACTION( EGLImageTargetTexture2DOES ); #if defined(PROVIDING_OES_texture_3D) ACTION( TexImage3D ); ACTION( TexSubImage3D ); diff --git a/es_2_0/makefile-dynamic b/es_2_0/makefile-dynamic index 1fde268..3511dde 100755 --- a/es_2_0/makefile-dynamic +++ b/es_2_0/makefile-dynamic @@ -1,6 +1,6 @@ #!/bin/make -CFLAGS = -I. -I../include -fPIC -Werror-implicit-function-declaration -O0 -g3 +CFLAGS = -I. -I../include -fPIC -Werror-implicit-function-declaration -O3 -g ARFLAGS = rucv CFLAGS += -DPROVIDING_OES_blend_func_separate @@ -71,7 +71,7 @@ $(LIB): $(OBJS) $(CC) -shared -Wl,-soname,$(LIBBASE).1 -o $@ $(OBJS) -ldl -lX11 install: $(LIB) - cp $(LIB) ../lib + cp $(LIB) ../lib/host-gl/ # supports diff --git a/lib/host-gl/libEGL.so.1.0 b/lib/host-gl/libEGL.so.1.0 new file mode 100755 index 0000000..ffcab06 Binary files /dev/null and b/lib/host-gl/libEGL.so.1.0 differ diff --git a/lib/host-gl/libGL.so.1.2 b/lib/host-gl/libGL.so.1.2 new file mode 100755 index 0000000..97c4714 Binary files /dev/null and b/lib/host-gl/libGL.so.1.2 differ diff --git a/lib/host-gl/libGLESv1_CM.so.1.0 b/lib/host-gl/libGLESv1_CM.so.1.0 new file mode 100755 index 0000000..2edc1e5 Binary files /dev/null and b/lib/host-gl/libGLESv1_CM.so.1.0 differ diff --git a/lib/host-gl/libGLESv2.so.1.0 b/lib/host-gl/libGLESv2.so.1.0 new file mode 100755 index 0000000..7191753 Binary files /dev/null and b/lib/host-gl/libGLESv2.so.1.0 differ diff --git a/lib/libEGL.so b/lib/libEGL.so index ea7f524..b81a6fd 120000 --- a/lib/libEGL.so +++ b/lib/libEGL.so @@ -1 +1 @@ -libEGL.so.1.0 \ No newline at end of file +host-gl/libEGL.so.1.0 \ No newline at end of file diff --git a/lib/libEGL.so.1 b/lib/libEGL.so.1 index ea7f524..b81a6fd 120000 --- a/lib/libEGL.so.1 +++ b/lib/libEGL.so.1 @@ -1 +1 @@ -libEGL.so.1.0 \ No newline at end of file +host-gl/libEGL.so.1.0 \ No newline at end of file diff --git a/lib/libEGL.so.1.0 b/lib/libEGL.so.1.0 deleted file mode 100755 index 5787381..0000000 Binary files a/lib/libEGL.so.1.0 and /dev/null differ diff --git a/lib/libGL.so b/lib/libGL.so index c0ab8c3..3a27339 120000 --- a/lib/libGL.so +++ b/lib/libGL.so @@ -1 +1 @@ -libGL.so.1.2 \ No newline at end of file +host-gl/libGL.so.1.2 \ No newline at end of file diff --git a/lib/libGL.so.1 b/lib/libGL.so.1 index c0ab8c3..3a27339 120000 --- a/lib/libGL.so.1 +++ b/lib/libGL.so.1 @@ -1 +1 @@ -libGL.so.1.2 \ No newline at end of file +host-gl/libGL.so.1.2 \ No newline at end of file diff --git a/lib/libGL.so.1.0 b/lib/libGL.so.1.0 index c0ab8c3..3a27339 120000 --- a/lib/libGL.so.1.0 +++ b/lib/libGL.so.1.0 @@ -1 +1 @@ -libGL.so.1.2 \ No newline at end of file +host-gl/libGL.so.1.2 \ No newline at end of file diff --git a/lib/libGL.so.1.2 b/lib/libGL.so.1.2 deleted file mode 100755 index 3e05682..0000000 Binary files a/lib/libGL.so.1.2 and /dev/null differ diff --git a/lib/libGLESv1_CM.so b/lib/libGLESv1_CM.so index 2067e89..eaabe7d 120000 --- a/lib/libGLESv1_CM.so +++ b/lib/libGLESv1_CM.so @@ -1 +1 @@ -libGLESv1_CM.so.1.0 \ No newline at end of file +host-gl/libGLESv1_CM.so.1.0 \ No newline at end of file diff --git a/lib/libGLESv1_CM.so.1 b/lib/libGLESv1_CM.so.1 index 2067e89..eaabe7d 120000 --- a/lib/libGLESv1_CM.so.1 +++ b/lib/libGLESv1_CM.so.1 @@ -1 +1 @@ -libGLESv1_CM.so.1.0 \ No newline at end of file +host-gl/libGLESv1_CM.so.1.0 \ No newline at end of file diff --git a/lib/libGLESv1_CM.so.1.0 b/lib/libGLESv1_CM.so.1.0 deleted file mode 100755 index afd58e7..0000000 Binary files a/lib/libGLESv1_CM.so.1.0 and /dev/null differ diff --git a/lib/libGLESv2.so b/lib/libGLESv2.so index c9b6c7b..c3dc772 120000 --- a/lib/libGLESv2.so +++ b/lib/libGLESv2.so @@ -1 +1 @@ -libGLESv2.so.1.0 \ No newline at end of file +host-gl/libGLESv2.so.1.0 \ No newline at end of file diff --git a/lib/libGLESv2.so.1 b/lib/libGLESv2.so.1 index c9b6c7b..c3dc772 120000 --- a/lib/libGLESv2.so.1 +++ b/lib/libGLESv2.so.1 @@ -1 +1 @@ -libGLESv2.so.1.0 \ No newline at end of file +host-gl/libGLESv2.so.1.0 \ No newline at end of file diff --git a/lib/libGLESv2.so.1.0 b/lib/libGLESv2.so.1.0 deleted file mode 100755 index d7d175e..0000000 Binary files a/lib/libGLESv2.so.1.0 and /dev/null differ diff --git a/lib/pkgconfig/opengl.pc b/lib/pkgconfig/opengl.pc index f4095fe..9e010b1 100644 --- a/lib/pkgconfig/opengl.pc +++ b/lib/pkgconfig/opengl.pc @@ -7,6 +7,6 @@ Name: Desktop OpenGL ES Description: Desktop OpenGL ES Library Version:0.5 -Libs: -L${libdir} -lGL -lEGL -lGLESv1_CM -lX11 -ldl -lm +Libs: -L${libdir} -lEGL -lGLESv1_CM -lX11 -ldl -lm Cflags: -I${includedir} diff --git a/lib/pkgconfig/opengl2.pc b/lib/pkgconfig/opengl2.pc index 37d5f5c..451ab9f 100644 --- a/lib/pkgconfig/opengl2.pc +++ b/lib/pkgconfig/opengl2.pc @@ -7,6 +7,6 @@ Name: Desktop OpenGL ES 2.0 Description: Desktop OpenGL ES 2.0 Library Version:0.5 -Libs: -L${libdir} -lGL -lEGL -lGLESv2 -lX11 -ldl -lm +Libs: -L${libdir} -lEGL -lGLESv2 -lX11 -ldl -lm Cflags: -I${includedir} diff --git a/libGL/Makefile b/libGL/Makefile index b268820..3f5c0d0 100755 --- a/libGL/Makefile +++ b/libGL/Makefile @@ -1,6 +1,6 @@ BUILD_CC := gcc CC = gcc -GL_CFLAGS := -Wall -g -fno-strict-aliasing +GL_CFLAGS := -Wall -g -fno-strict-aliasing -O3 all: libGL.so.1.2 @@ -34,7 +34,7 @@ parse_mesa_get_c: parse_mesa_get_c.c mesa_gl.h mesa_glext.h $(BUILD_CC) -g -o $@ parse_mesa_get_c.c install: libGL.so.1.2 - cp libGL.so.1.2 ../lib + cp libGL.so.1.2 ../lib/host-gl/ clean: rm -f client_stub.c server_stub.c gl_func.h glgetv_cst.h parse_gl_h parse_mesa_get_c *.o gl_func_tabs.h diff --git a/libGL/client_gl.c b/libGL/client_gl.c index e73431b..8ba006e 100755 --- a/libGL/client_gl.c +++ b/libGL/client_gl.c @@ -2634,6 +2634,14 @@ GLAPI void APIENTRY EXT_FUNC(glTexSubImage3DEXT)( GLenum target, CHECK_PROC(glTexSubImage3DEXT); glTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels); } + +GLAPI void APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLint image) +{ + CHECK_PROC(glEGLImageTargetTexture2DOES); + long args[] = { INT_TO_ARG(target), INT_TO_ARG(image) }; + do_opengl_call(glEGLImageTargetTexture2DOES_fake_func, NULL, args, NULL); +} + GLAPI void APIENTRY glSelectBuffer( GLsizei size, GLuint *buffer ) { if (size <= 0) return; @@ -5805,6 +5813,34 @@ GLAPI GLint EXT_FUNC(glGetUniformLocation) (GLuint program, const GLcharARB *txt return ret; } +/* TODO:re-design the uniformLocations data structure, so that can invalide it + * per program + */ +GLAPI void APIENTRY EXT_FUNC(glLinkProgram) (GLuint program) +{ + /* Invalid cashed uniformlocation */ + GET_CURRENT_STATE(); + state->countUniformLocations = 0; + free(state->uniformLocations); + state->uniformLocations = NULL; + + CHECK_PROC(glLinkProgram); + long args[] = { UNSIGNED_INT_TO_ARG(program)}; + do_opengl_call(glLinkProgram_func, NULL, args, NULL); +} + +GLAPI void APIENTRY EXT_FUNC(glLinkProgramARB) (GLhandleARB program) +{ + /* Invalid cashed uniformlocation */ + GET_CURRENT_STATE(); + state->countUniformLocations = 0; + free(state->uniformLocations); + state->uniformLocations = NULL; + + CHECK_PROC(glLinkProgramARB); + long args[] = { UNSIGNED_INT_TO_ARG(program)}; + do_opengl_call(glLinkProgramARB_func, NULL, args, NULL); +} GLAPI void APIENTRY EXT_FUNC(glGetActiveUniformARB)(GLuint program, GLuint index, diff --git a/libGL/client_glx.c b/libGL/client_glx.c index 7a46193..12d006f 100755 --- a/libGL/client_glx.c +++ b/libGL/client_glx.c @@ -503,10 +503,24 @@ Bool glXQueryVersion( Display *dpy, int *maj, int *min ) */ static void _get_window_info(Display *dpy, Window win, WindowInfoStruct* info) { + xcb_generic_error_t *error; xcb_connection_t *xcb_conn = XGetXCBConnection(dpy); xcb_get_window_attributes_reply_t *attr = xcb_get_window_attributes_reply( xcb_conn, - xcb_get_window_attributes(xcb_conn, win), 0); + xcb_get_window_attributes(xcb_conn, win), &error); + +#ifndef XCB_EVENT_ERROR_BAD_MATCH +#define XCB_EVENT_ERROR_BAD_MATCH 8 +#endif + /* BAD_MATCH indicate the drawable is PIXMAP instead of window */ + if ( !attr && error->error_code != XCB_EVENT_ERROR_BAD_MATCH ) + { + info->width = 0; + info->height= 0; + info->map_state = IsUnviewable; + return; + } + if (attr) { if (attr->map_state == XCB_MAP_STATE_VIEWABLE) { info->map_state = IsViewable; @@ -515,24 +529,21 @@ static void _get_window_info(Display *dpy, Window win, WindowInfoStruct* info) } else { info->map_state = IsUnmapped; } - xcb_get_geometry_reply_t *geom = xcb_get_geometry_reply( - xcb_conn, - xcb_get_geometry(xcb_conn, win), 0); - free (attr); - - if (geom) { - info->width = geom->width; - info->height = geom->height; - free (geom); - } else { - info->width = 0; - info->height= 0; - } - } else { - // TODO: need error handling. Right now just simply set default value. + free (attr); + } else /* Keep rendering PIXMAP as it can be copied to any window */ + info->map_state = IsViewable; + + xcb_get_geometry_reply_t *geom = xcb_get_geometry_reply( + xcb_conn, + xcb_get_geometry(xcb_conn, win), 0); + + if (geom) { + info->width = geom->width; + info->height = geom->height; + free (geom); + } else { info->width = 0; info->height= 0; - info->map_state = IsUnviewable; } } @@ -1288,18 +1299,34 @@ GLAPI void APIENTRY glXDestroyGLXPixmap( Display *dpy, GLXPixmap pixmap ) log_gl("glXDestroyGLXPixmap : sorry, unsupported call and I don't really see how I could implement it..."); } -GLAPI GLXPixmap APIENTRY glXCreatePixmap( Display *dpy, GLXFBConfig config, +GLAPI GLXPixmap APIENTRY glXCreatePixmap( Display *dpy, GLXFBConfig fbconfig, Pixmap pixmap, const int *attribList ) { - CHECK_PROC_WITH_RET(glXCreatePixmap); - /* FIXME */ - log_gl("glXCreatePixmap : sorry, unsupported call and I don't really see how I could implement it..."); - return 0; + CHECK_PROC_WITH_RET(glXCreatePixmap); + + LOCK(glXCreatePixmap_func); + if (debug_gl) log_gl("glXCreatePixmap %p\n", (void*)fbconfig); + + int emptyAttribList = None; + if (attribList == NULL) attribList = &emptyAttribList; + GLXPixmap glxpixmap; + long args[] = { POINTER_TO_ARG(dpy), INT_TO_ARG(fbconfig), INT_TO_ARG(pixmap), + POINTER_TO_ARG(attribList) }; + int args_size[] = { 0, 0, 0, sizeof(int) * _compute_length_of_attrib_list_including_zero(attribList, 1) }; + do_opengl_call_no_lock(glXCreatePixmap_func, &glxpixmap, args, args_size); + if (glxpixmap) + { + /*XXX:maintain the info?*/ + } + UNLOCK(glXCreatePixmap_func); + + return glxpixmap; } GLAPI void APIENTRY glXDestroyPixmap( Display *dpy, GLXPixmap pixmap ) { CHECK_PROC(glXDestroyPixmap); + /* XXX:do nothing. Not sure about this implementation */ /* FIXME */ log_gl("glXDestroyPixmap : sorry, unsupported call and I don't really see how I could implement it..."); } @@ -2690,6 +2717,7 @@ static const char* global_glXGetProcAddress_request = "glTextureMaterialEXT\0" "glTextureNormalEXT\0" "glTextureRangeAPPLE\0" +//"glEGLImageTargetTexture2DOES\n" "glTrackMatrixNV\0" "glTransformFeedbackAttribsNV\0" "glTransformFeedbackVaryingsNV\0" diff --git a/libGL/common.h b/libGL/common.h index 36e09ca..a28aa49 100755 --- a/libGL/common.h +++ b/libGL/common.h @@ -41,7 +41,7 @@ extern int debug_gl; extern int debug_array_ptr; extern int disable_optim; -#define IS_GLX_CALL(x) (x >= glXChooseVisual_func && x <= glXSwapIntervalSGI_func) +#define IS_GLX_CALL(x) (x >= glXChooseVisual_func && x <= glXDestroyPixmap_func) #define SIZE_BUFFER_COMMAND (1024*64) //#define MAX_SIZE_BUFFER_COMMAND (1024*1024*10) diff --git a/libGL/gl_func_perso.h b/libGL/gl_func_perso.h index 3d45b51..7ae6e7d 100755 --- a/libGL/gl_func_perso.h +++ b/libGL/gl_func_perso.h @@ -58,6 +58,8 @@ MAGIC_MACRO(glXQueryExtension), MAGIC_MACRO(glXGetScreenDriver), MAGIC_MACRO(glXGetDriverConfig), MAGIC_MACRO(glXSwapIntervalSGI), +MAGIC_MACRO(glXCreatePixmap), +MAGIC_MACRO(glXDestroyPixmap), MAGIC_MACRO(glGetString), @@ -94,6 +96,7 @@ MAGIC_MACRO(glVertexNormalColorTexCoord012PointerInterlaced_fake), MAGIC_MACRO(glGenTextures_fake), MAGIC_MACRO(glGenBuffersARB_fake), MAGIC_MACRO(glGenLists_fake), +MAGIC_MACRO(glEGLImageTargetTexture2DOES_fake), MAGIC_MACRO(_glDrawElements_buffer), MAGIC_MACRO(_glDrawRangeElements_buffer), MAGIC_MACRO(_glMultiDrawElements_buffer), diff --git a/libGL/opengl_client.c b/libGL/opengl_client.c index e1b5a3c..3574faa 100755 --- a/libGL/opengl_client.c +++ b/libGL/opengl_client.c @@ -191,7 +191,7 @@ void do_opengl_call_no_lock(int func_number, void* ret_ptr, long* args, int* arg Signature *signature; static char *command_buffer; char *ret_buf = NULL; - int again, req_args_buffer, req_ret_buffer, req_total_buffer; + int again, req_args_buffer, req_ret_buffer, req_total_buffer, check_buf_full; int current_thread; int ret_int = 0; static int init, nr_serial, cur_ret_buf; @@ -266,6 +266,7 @@ void do_opengl_call_no_lock(int func_number, void* ret_ptr, long* args, int* arg * buffer. call_opengl() will detect this and split the call up for us. */ + check_buf_full = 0; again = 0; do { if(!command_buffer) @@ -317,7 +318,9 @@ void do_opengl_call_no_lock(int func_number, void* ret_ptr, long* args, int* arg cur_ret_buf = req_ret_buffer; buffer_args(func_number, signature, args, args_size_opt, &cur_args_buffer); nr_serial = 1; - } + } else { + check_buf_full = 1; + } } /* If call is not bufferable or the buffer is full. */ @@ -332,8 +335,14 @@ void do_opengl_call_no_lock(int func_number, void* ret_ptr, long* args, int* arg func_number == _render_surface_func)))) { ret_int = call_opengl(command_buffer, cur_args_buffer - command_buffer, cur_ret_buf, ret_buf); - decode_ret_buffer(func_number, signature, args, ret_buf?ret_buf:command_buffer, ret_ptr); + if (check_buf_full == 0 || func_number == _render_surface_func + || func_number == _resize_surface_func) { + decode_ret_buffer(func_number, signature, args, ret_buf?ret_buf:command_buffer, ret_ptr); + } else { + // FIX ME : this variable be used to prevent to copy return value to args + check_buf_full = 0; + } cur_args_buffer = NULL; // Reset pointers. if(again == 2) { diff --git a/libGL/opengl_func.h b/libGL/opengl_func.h index 7a32dc9..7d48aa0 100755 --- a/libGL/opengl_func.h +++ b/libGL/opengl_func.h @@ -438,11 +438,20 @@ static const int glXGetVideoSyncSGI_signature[] = { TYPE_INT, 1, 1, TYPE_OUT_1IN static const int glXSwapIntervalSGI_signature[] = { TYPE_INT, 0, 1, TYPE_INT }; +static const int glXCreatePixmap_signature[] = + { TYPE_INT, 0, 4, TYPE_IN_IGNORED_POINTER, TYPE_INT, TYPE_INT, TYPE_ARRAY_INT }; + +static const int glXDestroyPixmap_signature[] = + { TYPE_NONE, 0, 2, TYPE_IN_IGNORED_POINTER, TYPE_INT }; + static const int glXBindTexImageATI_signature[] = { TYPE_NONE, 0, 3, TYPE_IN_IGNORED_POINTER, TYPE_INT, TYPE_INT }; static const int glXReleaseTexImageATI_signature[] = { TYPE_NONE, 0, 3, TYPE_IN_IGNORED_POINTER, TYPE_INT, TYPE_INT }; static const int glXBindTexImageARB_signature[] = { TYPE_INT, 0, 3, TYPE_IN_IGNORED_POINTER, TYPE_INT, TYPE_INT }; static const int glXReleaseTexImageARB_signature[] = { TYPE_INT, 0, 3, TYPE_IN_IGNORED_POINTER, TYPE_INT, TYPE_INT }; +static const int glEGLImageTargetTexture2DOES_fake_signature[] = + { TYPE_NONE, 0, 2, TYPE_UNSIGNED_INT, TYPE_INT }; + /* const GLubyte * glGetString( GLenum name ) */ static const int glGetString_signature[] = {TYPE_CONST_CHAR, 0, 1, TYPE_INT}; diff --git a/libGL/parse_gl_h.c b/libGL/parse_gl_h.c index 21b200b..dd18c7c 100755 --- a/libGL/parse_gl_h.c +++ b/libGL/parse_gl_h.c @@ -795,6 +795,11 @@ static const char* just_for_server_side_list[] = "glGetActiveVaryingNV", + "glLinkProgram", + "glLinkProgramARB", + + /*"glEGLImageTargetTexture2DOES",*/ + NULL, }; diff --git a/packaging/simulator-opengl.spec b/packaging/simulator-opengl.spec index f249720..8ceeef5 100755 --- a/packaging/simulator-opengl.spec +++ b/packaging/simulator-opengl.spec @@ -1,7 +1,7 @@ #sbs-git:slp/sdk/simulator-opengl Name: simulator-opengl Summary: opengl-es acceleration module for emulator -Version: 0.1.22 +Version: 0.1.28 Release: 1 Group: TO_BE/FILLED_IN License: TO_BE/FILLED_IN @@ -51,6 +51,7 @@ cp -r include/KHR %{buildroot}/usr/include/ /usr/lib/libGL.* /usr/lib/libEGL.* /usr/lib/libGLES* +/usr/lib/host-gl/* %files devel -- cgit v1.2.3