diff options
author | sungmin82.ha <sungmin82.ha@samsung.com> | 2013-07-30 15:21:43 +0900 |
---|---|---|
committer | sungmin82.ha <sungmin82.ha@samsung.com> | 2013-07-30 15:21:43 +0900 |
commit | 21f1eabcb6dcdeae221f0f667a8f80d0e06e1f01 (patch) | |
tree | 0ca6ce3510acadc63022998e51f59c9e2d9cb8d2 | |
parent | 7a766bf66498defb8e7477c6c402e23f1d04451b (diff) | |
download | simulator-opengl-21f1eabcb6dcdeae221f0f667a8f80d0e06e1f01.tar.gz simulator-opengl-21f1eabcb6dcdeae221f0f667a8f80d0e06e1f01.tar.bz2 simulator-opengl-21f1eabcb6dcdeae221f0f667a8f80d0e06e1f01.zip |
sync with tizen_2.2
Change-Id: I5659c55648529ef7f730e6da9bd7731152718594
Signed-off-by: Sungmin Ha <sungmin82.ha@samsung.com>
62 files changed, 1051 insertions, 116 deletions
@@ -1,4 +1,12 @@ -SangJin Kim <sangjin3.kim@samsung.com>
-DongKyun Yun <dk77.yun@samsung.com>
-MunKyu Im <munkyu.im@samsung.com>
-HyunGoo Kang <hyungoo1.kang@samsung.com>
+YeongKyoon Lee <yeongkyoon.lee@samsung.com> +DaiYoung Kim <daiyoung777.kim@samsung.com> +SeokYeon Hwang <syeon.hwang@samsung.com> +SangJin Kim <sangjin3.kim@samsung.com> +KiTae Kim <kt920.kim@samsung.com> +JinHyung Jo <jinhyung.jo@samsung.com> +SungMin Ha <sungmin82.ha@samsung.com> +MunKyu Im <munkyu.im@samsung.com> +JiHye Kim <jihye1128.kim@samsung.com> +GiWoong Kim <giwoong.kim@samsung.com> +SooYoung Ha <yoosah.ha@samsnung.com> +HyunGoo Kang <hyungoo1.kang@samsung.com> @@ -1,6 +1,8 @@ #!/bin/make default: + (rm -rf ./lib/host-gl) + (mkdir -p ./lib/host-gl) (cd egl_1_4; make) (cd es_1_1; make) (cd es_2_0; make) @@ -9,6 +11,7 @@ default: all: default install: + (mkdir -p ./lib/host-gl) (cd egl_1_4; make -f makefile-dynamic install) (cd es_1_1; make -f makefile-static install) (cd es_1_1; make -f makefile-dynamic install) @@ -17,6 +20,7 @@ install: (cd libGL; make install) clean: + (rm -rf ./lib/host-gl) (cd egl_1_4; make clean) (cd es_1_1; make -f makefile-static clean) (cd es_1_1; make -f makefile-dynamic clean) @@ -25,6 +29,7 @@ clean: (cd libGL; make clean) clobber: + (mkdir -p ./lib/host-gl) (cd egl_1_4; make clobber) (cd es_1_1; make -f makefile-static clobber) (cd es_1_1; make -f makefile-dynamic clobber) diff --git a/debian/changelog b/debian/changelog index 279d383..a81bdaa 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,91 @@ +simulator-opengl (0.2.9) unstable; urgency=low + + * Add dummy sw driver. + * Git: 112.106.1.251:sdk/simulator-opengl + * Tag: simulator-opengl_0.2.9 + + -- Sangjin Kim <sangjin3.kim@samsung.com> Mon, 01 Apr 2013 12:06:36 +0900 + +simulator-opengl (0.2.8) unstable; urgency=low + + * Enable pbuffer surface. + * Git: 112.106.1.251:sdk/simulator-opengl + * Tag: simulator-opengl_0.2.8 + + -- Sangjin Kim <sangjin3.kim@samsung.com> Tue, 12 Mar 2013 16:42:13 +0900 + +simulator-opengl (0.2.7) unstable; urgency=low + + * Add FBO extension of GLES1.1. + * Git: 112.106.1.251:sdk/simulator-opengl + * Tag: simulator-opengl_0.2.7 + + -- Sangjin Kim <sangjin3.kim@samsung.com> Tue, 05 Mar 2013 19:09:09 +0900 + +simulator-opengl (0.2.2) unstable; urgency=low + + * Fix the rotation bug. + * Git: 112.106.1.251:sdk/simulator-opengl + * Tag: simulator-opengl_0.2.2 + + -- Sangjin Kim <sangjin3.kim@samsung.com> Sat, 12 Jan 2013 10:36:27 +0900 + +simulator-opengl (0.2.1) unstable; urgency=low + + * Fix the context return value bug. + * Git: 112.106.1.251:sdk/simulator-opengl + * Tag: simulator-opengl_0.2.1 + + -- Sangjin Kim <sangjin3.kim@samsung.com> Fri, 04 Jan 2013 16:49:44 +0900 + +simulator-opengl (0.1.40) unstable; urgency=low + + * Obs build error fix. + * Git: 112.106.1.251:sdk/simulator-opengl + * Tag: simulator-opengl_0.1.40 + + -- Sangjin Kim <sangjin3.kim@samsung.com> Mon, 10 Dec 2012 11:53:23 +0900 + +simulator-opengl (0.1.39) unstable; urgency=low + + * Obs build error fix. + * Git: 112.106.1.251:sdk/simulator-opengl + * Tag: simulator-opengl_0.1.39 + + -- Sangjin Kim <sangjin3.kim@samsung.com> Tue, 27 Nov 2012 16:30:20 +0900 + +simulator-opengl (0.1.38) unstable; urgency=low + + * eglQueryContext() bug fix + * Git: 112.106.1.251:sdk/simulator-opengl + * Tag: simulator-opengl_0.1.38 + + -- Sangjin Kim <sangjin3.kim@samsung.com> Thu, 22 Nov 2012 17:06:37 +0900 + +simulator-opengl (0.1.37) unstable; urgency=low + + * pkgconfig name is changed. + * Git: 112.106.1.251:sdk/simulator-opengl + * Tag: simulator-opengl_0.1.37 + + -- Sangjin Kim <sangjin3.kim@samsung.com> Tue, 13 Nov 2012 11:04:30 +0900 + +simulator-opengl (0.1.36) unstable; urgency=low + + * Make sure the unique of the eglImage to avoid conflicts. + * Git: 112.106.1.251:sdk/simulator-opengl + * Tag: simulator-opengl_0.1.36 + + -- Sangjin Kim <sangjin3.kim@samsung.com> Tue, 30 Oct 2012 16:37:51 +0900 + +simulator-opengl (0.1.35) unstable; urgency=low + + * Fixed the intel_hangonman emulator crash problem. + * Git: 112.106.1.251:sdk/simulator-opengl + * Tag: simulator-opengl_0.1.35 + + -- Sangjin3.kim <sangjin3.kim@samsung.com> Tue, 09 Oct 2012 17:46:55 +0900 + simulator-opengl (0.1.34) unstable; urgency=low * pixmap detection check. diff --git a/egl_1_4/31Error.c b/egl_1_4/31Error.c index 5fadeba..a9acd9d 100755 --- a/egl_1_4/31Error.c +++ b/egl_1_4/31Error.c @@ -40,8 +40,7 @@ EGLint EGLAPIENTRY eglGetError(void) { } void EGLAPIENTRY EGLINTER(SetError)(EGLint iError) { - if (EGLINTER(global).iLastError == EGL_SUCCESS) { + EGLINTER(global).iLastError = iError; - } } diff --git a/egl_1_4/32GetDisplay.c b/egl_1_4/32GetDisplay.c index fda853d..bf0f6ec 100755 --- a/egl_1_4/32GetDisplay.c +++ b/egl_1_4/32GetDisplay.c @@ -70,5 +70,6 @@ EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType native) { } else { } + EGLINTER(SetError)(EGL_SUCCESS); return pDisplay->unique; } diff --git a/egl_1_4/32Initialize.c b/egl_1_4/32Initialize.c index 00a23d9..1029d7f 100755 --- a/egl_1_4/32Initialize.c +++ b/egl_1_4/32Initialize.c @@ -61,5 +61,6 @@ EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, EGLint* major, EGLint* mino } if (major != NULL) *major = HAZEL_EGL_MAJOR; if (minor != NULL) *minor = HAZEL_EGL_MINOR; + EGLINTER(SetError)(EGL_SUCCESS); return EGL_TRUE; } diff --git a/egl_1_4/32Terminate.c b/egl_1_4/32Terminate.c index 1ec3957..e8870a9 100755 --- a/egl_1_4/32Terminate.c +++ b/egl_1_4/32Terminate.c @@ -50,6 +50,7 @@ EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy) { pDisplay->pConfigAnswer = NULL; } pDisplay->bInitialized = EGL_FALSE; + EGLINTER(SetError)(EGL_SUCCESS); return EGL_TRUE; } diff --git a/egl_1_4/33QueryString.c b/egl_1_4/33QueryString.c index 68c85fd..10e54d1 100755 --- a/egl_1_4/33QueryString.c +++ b/egl_1_4/33QueryString.c @@ -44,6 +44,9 @@ const char* EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name) { EGLINTER(SetError)(EGL_NOT_INITIALIZED); return NULL; } + + EGLINTER(SetError)(EGL_SUCCESS); + switch (name) { case EGL_CLIENT_APIS: #if defined(PROVIDING_RUNTIME_BINDING) diff --git a/egl_1_4/34ChooseConfig.c b/egl_1_4/34ChooseConfig.c index d9a6719..8b145e2 100755 --- a/egl_1_4/34ChooseConfig.c +++ b/egl_1_4/34ChooseConfig.c @@ -113,12 +113,12 @@ EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy, const EGLint* attrib_list if (configs != NULL && config_size > 0) { configs[0] = (EGLConfig)pUnit; } - return EGL_TRUE; + goto SETSUCCESS; } pUnit++; } *num_config = 0; - return EGL_TRUE; + goto SETSUCCESS; } int nAnswer = 0; EGLConfig* pAnswer = pDisplay->pConfigAnswer; @@ -172,5 +172,7 @@ EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy, const EGLint* attrib_list *num_config = num; memcpy(configs, pDisplay->pConfigAnswer, num * sizeof(EGLConfig)); } +SETSUCCESS: + EGLINTER(SetError)(EGL_SUCCESS); return EGL_TRUE; } diff --git a/egl_1_4/34GetConfigAttrib.c b/egl_1_4/34GetConfigAttrib.c index 37269e8..5d763c3 100755 --- a/egl_1_4/34GetConfigAttrib.c +++ b/egl_1_4/34GetConfigAttrib.c @@ -113,5 +113,7 @@ EGLBoolean EGLAPIENTRY eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, return EGL_FALSE; } if (value != NULL) *value = answer; + + EGLINTER(SetError)(EGL_SUCCESS); return EGL_TRUE; } diff --git a/egl_1_4/34GetConfigs.c b/egl_1_4/34GetConfigs.c index 19222f1..908ecb5 100755 --- a/egl_1_4/34GetConfigs.c +++ b/egl_1_4/34GetConfigs.c @@ -114,7 +114,7 @@ int EGLAPIENTRY EGLINTER(PrepareConfig)(struct DisplayExtra* pDisplay) { struct ConfigExtra* pArea; struct ConfigExtra* pUnit; int nBytes; - int nTotalConfig = 0; + int nTotalConfig; int nConfig; int i; pDisplay->pConfigBuffer = FNPTR(ChooseFBConfig)(pDisplay->native, @@ -134,7 +134,8 @@ int EGLAPIENTRY EGLINTER(PrepareConfig)(struct DisplayExtra* pDisplay) { } } nTotalConfig = nConfig; - XFree(pDisplay->pConfigBuffer); + if (pDisplay->pConfigBuffer) + XFree(pDisplay->pConfigBuffer); pDisplay->pConfigBuffer = NULL; pDisplay->pConfigBuffer = FNPTR(ChooseFBConfig)(pDisplay->native, DefaultScreen(pDisplay->native), attribs_for_rgb, &nConfig); @@ -153,8 +154,18 @@ int EGLAPIENTRY EGLINTER(PrepareConfig)(struct DisplayExtra* pDisplay) { } } nTotalConfig += nConfig; - XFree(pDisplay->pConfigBuffer); + if (pDisplay->pConfigBuffer) + XFree(pDisplay->pConfigBuffer); pDisplay->pConfigBuffer = NULL; + + if (pDisplay->nConfigExtra == 0) { + if (pDisplay->pConfigAnswer) { + free(pDisplay->pConfigAnswer); + pDisplay->pConfigAnswer = NULL; + } + return 0; + } + nBytes = pDisplay->nConfigExtra * sizeof(EGLConfig); EGLConfig* pAnswerArea; if ((pAnswerArea = (EGLConfig*)realloc(pDisplay->pConfigAnswer, nBytes)) == NULL) { @@ -162,7 +173,6 @@ int EGLAPIENTRY EGLINTER(PrepareConfig)(struct DisplayExtra* pDisplay) { return 0; } pDisplay->pConfigAnswer = pAnswerArea; - //assert(nTotalConfig > 0); return nTotalConfig; } @@ -193,5 +203,7 @@ EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, configs[i] = (EGLConfig)(pDisplay->pConfigExtra + i); } } + + EGLINTER(SetError)(EGL_SUCCESS); return EGL_TRUE; } diff --git a/egl_1_4/35CreatePbufferFromClientBuffer.c b/egl_1_4/35CreatePbufferFromClientBuffer.c index 01c3fd1..9acf00f 100755 --- a/egl_1_4/35CreatePbufferFromClientBuffer.c +++ b/egl_1_4/35CreatePbufferFromClientBuffer.c @@ -66,11 +66,11 @@ EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer(EGLDisplay dpy, switch (*attrib_list++) { case EGL_WIDTH: *ptr++ = GLX_WIDTH; - *ptr++ = *attrib_list++; + *ptr++ = surfaceValue.width = *attrib_list++; break; case EGL_HEIGHT: *ptr++ = GLX_HEIGHT; - *ptr++ = *attrib_list++; + *ptr++ = surfaceValue.height = *attrib_list++; break; case EGL_TEXTURE_FORMAT: if (*attrib_list == EGL_NO_TEXTURE || *attrib_list == EGL_TEXTURE_RGB @@ -117,6 +117,24 @@ EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer(EGLDisplay dpy, } *ptr = None; - EGLINTER(SetError)(EGL_BAD_SURFACE); - return EGL_NO_SURFACE; + GLXPbuffer native = FNPTR(CreatePbuffer)(pDisplay->native, pConfig->native, buf); + EGLSurface unique = (EGLSurface)(native); + struct SurfaceExtra* pSurface = EGLINTER(LookUpSurface)(unique); + if (pSurface == NULL) { + pSurface = EGLINTER(InsertSurface)(unique); + if (pSurface == NULL) { + EGLINTER(SetError)(EGL_BAD_ALLOC); + return EGL_NO_SURFACE; + } + memcpy(pSurface, &surfaceValue, sizeof(struct SurfaceExtra)); + pSurface->unique = unique; + pSurface->native = native; + pSurface->display = dpy; + pSurface->config = config; + pSurface->type = EGL_PBUFFER_BIT; + } else { + EGLINTER(SetError)(EGL_BAD_SURFACE); + return EGL_NO_SURFACE; + } + return (EGLSurface)(pSurface->native); } diff --git a/egl_1_4/35CreatePbufferSurface.c b/egl_1_4/35CreatePbufferSurface.c index 7771c0a..a712da0 100755 --- a/egl_1_4/35CreatePbufferSurface.c +++ b/egl_1_4/35CreatePbufferSurface.c @@ -61,11 +61,11 @@ EGLSurface EGLAPIENTRY eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, switch (*attrib_list++) { case EGL_WIDTH: *ptr++ = GLX_WIDTH; - *ptr++ = *attrib_list++; + *ptr++ = surfaceValue.width = *attrib_list++; break; case EGL_HEIGHT: *ptr++ = GLX_HEIGHT; - *ptr++ = *attrib_list++; + *ptr++ = surfaceValue.height = *attrib_list++; break; case EGL_LARGEST_PBUFFER: *ptr++ = GLX_LARGEST_PBUFFER; @@ -135,5 +135,7 @@ EGLSurface EGLAPIENTRY eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, EGLINTER(SetError)(EGL_BAD_MATCH); return EGL_NO_SURFACE; } + + EGLINTER(SetError)(EGL_SUCCESS); return (EGLSurface)(pSurface->native); } diff --git a/egl_1_4/35CreatePixmapSurface.c b/egl_1_4/35CreatePixmapSurface.c index 915d7b1..58fce7a 100755 --- a/egl_1_4/35CreatePixmapSurface.c +++ b/egl_1_4/35CreatePixmapSurface.c @@ -124,5 +124,7 @@ EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLINTER(SetError)(EGL_BAD_MATCH); return EGL_NO_SURFACE; } + + EGLINTER(SetError)(EGL_SUCCESS); return (EGLSurface)(pSurface->native); } diff --git a/egl_1_4/35CreateWindowSurface.c b/egl_1_4/35CreateWindowSurface.c index 60f9cce..11a8910 100755 --- a/egl_1_4/35CreateWindowSurface.c +++ b/egl_1_4/35CreateWindowSurface.c @@ -123,5 +123,7 @@ EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLINTER(SetError)(EGL_BAD_MATCH); return EGL_NO_SURFACE; } + + EGLINTER(SetError)(EGL_SUCCESS); return (EGLSurface)(pSurface->native); } diff --git a/egl_1_4/35DestroySurface.c b/egl_1_4/35DestroySurface.c index 5bae4f2..9016a54 100755 --- a/egl_1_4/35DestroySurface.c +++ b/egl_1_4/35DestroySurface.c @@ -52,7 +52,14 @@ EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay dpy, EGLSurface surface) { return EGL_FALSE; } - FNPTR(DestroyWindow)(pDisplay->native, pSurface->native); + if (pSurface->type == EGL_WINDOW_BIT) + FNPTR(DestroyWindow)(pDisplay->native, pSurface->native); + else if (pSurface->type == EGL_PIXMAP_BIT) + FNPTR(DestroyPixmap)(pDisplay->native, pSurface->native); + else if (pSurface->type == EGL_PBUFFER_BIT) + FNPTR(DestroyPbuffer)(pDisplay->native, pSurface->native); + EGLINTER(DeleteSurface)(surface); + EGLINTER(SetError)(EGL_SUCCESS); return EGL_TRUE; } diff --git a/egl_1_4/36BindTexImage.c b/egl_1_4/36BindTexImage.c index c6fd366..333163f 100755 --- a/egl_1_4/36BindTexImage.c +++ b/egl_1_4/36BindTexImage.c @@ -48,7 +48,20 @@ EGLBoolean EGLAPIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLin return EGL_FALSE; } /* TODO */ - /* TODO */ + if ( pSurface->type != EGL_PBUFFER_BIT ) { + EGLINTER(SetError)(EGL_BAD_SURFACE); + return EGL_FALSE; + } + if ( pSurface->textureFormat == EGL_NO_TEXTURE ) { + EGLINTER(SetError)(EGL_BAD_MATCH); + return EGL_FALSE; + } + if ( buffer != EGL_BACK_BUFFER ) { + EGLINTER(SetError)(EGL_BAD_MATCH); + return EGL_FALSE; + } + FNPTR(BindTexImageARB)(pDisplay->native, pSurface->native, buffer ); + EGLINTER(SetError)(EGL_SUCCESS); return EGL_TRUE; } diff --git a/egl_1_4/36QuerySurface.c b/egl_1_4/36QuerySurface.c index 05e1101..8310bf4 100755 --- a/egl_1_4/36QuerySurface.c +++ b/egl_1_4/36QuerySurface.c @@ -58,12 +58,14 @@ EGLBoolean EGLAPIENTRY eglQuerySurface(EGLDisplay dpy, EGLSurface surface, answer = ((struct ConfigExtra*)(pSurface->config))->unique; break; case EGL_HEIGHT: - FNPTR(QueryDrawable)(pDisplay->native, pSurface->native, GLX_HEIGHT, - (unsigned int*)&answer); +/* FNPTR(QueryDrawable)(pDisplay->native, pSurface->native, GLX_HEIGHT,*/ +/* (unsigned int*)&answer);*/ + answer = pSurface->height; break; case EGL_WIDTH: - FNPTR(QueryDrawable)(pDisplay->native, pSurface->native, GLX_WIDTH, - (unsigned int*)&answer); +/* FNPTR(QueryDrawable)(pDisplay->native, pSurface->native, GLX_WIDTH, */ +/* (unsigned int*)&answer); */ + answer = pSurface->width; break; case EGL_LARGEST_PBUFFER: FNPTR(QueryDrawable)(pDisplay->native, pSurface->native, GLX_LARGEST_PBUFFER, @@ -129,5 +131,6 @@ EGLBoolean EGLAPIENTRY eglQuerySurface(EGLDisplay dpy, EGLSurface surface, break; } if (value != NULL) *value = answer; + EGLINTER(SetError)(EGL_SUCCESS); return EGL_TRUE; } diff --git a/egl_1_4/36ReleaseTexImage.c b/egl_1_4/36ReleaseTexImage.c index 50fd983..d1c5453 100755 --- a/egl_1_4/36ReleaseTexImage.c +++ b/egl_1_4/36ReleaseTexImage.c @@ -48,7 +48,20 @@ EGLBoolean EGLAPIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EG return EGL_FALSE; } /* TODO */ - /* TODO */ + if ( pSurface->type != EGL_PBUFFER_BIT ) { + EGLINTER(SetError)(EGL_BAD_SURFACE); + return EGL_FALSE; + } + if ( pSurface->textureFormat == EGL_NO_TEXTURE ) { + EGLINTER(SetError)(EGL_BAD_MATCH); + return EGL_FALSE; + } + if ( buffer != EGL_BACK_BUFFER ) { + EGLINTER(SetError)(EGL_BAD_MATCH); + return EGL_FALSE; + } + FNPTR(ReleaseTexImageARB)(pDisplay->native, pSurface->native, buffer); + EGLINTER(SetError)(EGL_SUCCESS); return EGL_TRUE; } diff --git a/egl_1_4/36SurfaceAttrib.c b/egl_1_4/36SurfaceAttrib.c index c46915e..997535d 100755 --- a/egl_1_4/36SurfaceAttrib.c +++ b/egl_1_4/36SurfaceAttrib.c @@ -77,5 +77,7 @@ EGLBoolean EGLAPIENTRY eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, return EGL_FALSE; break; } + + EGLINTER(SetError)(EGL_SUCCESS); return EGL_TRUE; } diff --git a/egl_1_4/37BindAPI.c b/egl_1_4/37BindAPI.c index 0fede7a..557a28f 100755 --- a/egl_1_4/37BindAPI.c +++ b/egl_1_4/37BindAPI.c @@ -39,10 +39,12 @@ EGLBoolean EGLAPIENTRY eglBindAPI(EGLenum api) { case EGL_OPENGL_ES_API: case EGL_OPENVG_API: EGLINTER(global).currentAPI = api; + EGLINTER(SetError)(EGL_SUCCESS); return EGL_TRUE; #else case EGL_OPENGL_ES_API: EGLINTER(global).currentAPI = api; + EGLINTER(SetError)(EGL_SUCCESS); return EGL_TRUE; case EGL_OPENGL_API: case EGL_OPENVG_API: diff --git a/egl_1_4/37CreateContext.c b/egl_1_4/37CreateContext.c index 95afd38..5c23a6a 100755 --- a/egl_1_4/37CreateContext.c +++ b/egl_1_4/37CreateContext.c @@ -171,5 +171,6 @@ EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config, return EGL_NO_CONTEXT; } + EGLINTER(SetError)(EGL_SUCCESS); return (EGLContext)(pContext->native); } diff --git a/egl_1_4/37MakeCurrent.c b/egl_1_4/37MakeCurrent.c index bb18f1f..ca0e3d7 100755 --- a/egl_1_4/37MakeCurrent.c +++ b/egl_1_4/37MakeCurrent.c @@ -281,5 +281,6 @@ EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, if (pPrevious != NULL && pPrevious->deleted && pPrevious != pContext) EGLINTER(FreeContext)(pPrevious); + EGLINTER(SetError)(EGL_SUCCESS); return EGL_TRUE; } diff --git a/egl_1_4/37QueryContext.c b/egl_1_4/37QueryContext.c index 34f5da4..28a4fad 100755 --- a/egl_1_4/37QueryContext.c +++ b/egl_1_4/37QueryContext.c @@ -52,12 +52,14 @@ EGLBoolean EGLAPIENTRY eglQueryContext(EGLDisplay dpy, EGLContext ctx, switch (attribute) { case EGL_CONFIG_ID: answer = ((struct ConfigExtra*)(pContext->config))->unique; break; case EGL_CONTEXT_CLIENT_TYPE: answer = EGL_OPENGL_ES_API; break; - case EGL_CONTEXT_CLIENT_VERSION: answer = 1; break; + case EGL_CONTEXT_CLIENT_VERSION: answer = pContext->apiVersion; break; case EGL_RENDER_BUFFER: answer = pContext->renderBuffer; break; default: EGLINTER(SetError)(EGL_BAD_ATTRIBUTE); return EGL_FALSE; } if (value != NULL) *value = answer; + + EGLINTER(SetError)(EGL_SUCCESS); return EGL_TRUE; } diff --git a/egl_1_4/39CopyBuffers.c b/egl_1_4/39CopyBuffers.c index bd0a4a5..f32cccb 100755 --- a/egl_1_4/39CopyBuffers.c +++ b/egl_1_4/39CopyBuffers.c @@ -53,6 +53,9 @@ EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, * glxCopyBuffers available */ FNPTR(SwapBuffers)(pDisplay->native, pSurface->native); + if (!target) + return EGL_TRUE; + Window root; int x, y; unsigned int width, height, border, depth; @@ -68,6 +71,8 @@ EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLINTER(SetError)(EGL_BAD_NATIVE_PIXMAP); return EGL_FALSE; } + + EGLINTER(SetError)(EGL_SUCCESS); return EGL_TRUE; } diff --git a/egl_1_4/41LockSurfaceKHR.c b/egl_1_4/41LockSurfaceKHR.c index f0b3a51..6b140da 100644 --- a/egl_1_4/41LockSurfaceKHR.c +++ b/egl_1_4/41LockSurfaceKHR.c @@ -1,3 +1,36 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Edwin Zhai <edwin.zhai@intel.com> + * SangJin Kim <sangjin3.kim@samsung.com> + * Yeongkyoon Lee <yeongkyoon.lee@samsung.com> + * HyunGoo Kang <hyungoo1.kang@samsung.com> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Contributors: + * - Intel Corporation + * - S-Core Co., Ltd + * + */ + /* * 41LockSurfaceKHR.c */ diff --git a/egl_1_4/41UnlockSurfaceKHR.c b/egl_1_4/41UnlockSurfaceKHR.c index e0b4994..1a83cde 100644 --- a/egl_1_4/41UnlockSurfaceKHR.c +++ b/egl_1_4/41UnlockSurfaceKHR.c @@ -1,3 +1,36 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Edwin Zhai <edwin.zhai@intel.com> + * SangJin Kim <sangjin3.kim@samsung.com> + * Yeongkyoon Lee <yeongkyoon.lee@samsung.com> + * HyunGoo Kang <hyungoo1.kang@samsung.com> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Contributors: + * - Intel Corporation + * - S-Core Co., Ltd + * + */ + /* * 41UnlockSurfaceKHR.c */ diff --git a/egl_1_4/42CreateImageKHR.c b/egl_1_4/42CreateImageKHR.c index 2ec99bd..6290559 100644 --- a/egl_1_4/42CreateImageKHR.c +++ b/egl_1_4/42CreateImageKHR.c @@ -1,3 +1,36 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Edwin Zhai <edwin.zhai@intel.com> + * SangJin Kim <sangjin3.kim@samsung.com> + * Yeongkyoon Lee <yeongkyoon.lee@samsung.com> + * HyunGoo Kang <hyungoo1.kang@samsung.com> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Contributors: + * - Intel Corporation + * - S-Core Co., Ltd + * + */ + /* * 42CreateImageKHR.c */ @@ -36,8 +69,15 @@ EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, return EGL_NO_IMAGE_KHR; } // assert (!EGLINTER(LookUpEGLImage)(unique)); - GLint unique = EGLINTER(global).nImageExtra; - unique ++; + + GLint unique = EGLINTER(global).nImageExtra + 1; + + /* Make sure the unique not used by others */ + while (EGLINTER(LookUpEGLImage)(unique)) + { + unique++; + } + struct ImageExtra *pArea = EGLINTER(InsertEGLImage)((EGLImageKHR)unique); // get the pixmap information here Window root; @@ -53,5 +93,6 @@ EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, pArea->dpy = pDisplay->native; pArea->pixmap = (Pixmap) buffer; + EGLINTER(SetError)(EGL_SUCCESS); return (EGLImageKHR) unique; } diff --git a/egl_1_4/42DestroyImageKHR.c b/egl_1_4/42DestroyImageKHR.c index 62b7c94..73264c3 100644 --- a/egl_1_4/42DestroyImageKHR.c +++ b/egl_1_4/42DestroyImageKHR.c @@ -1,3 +1,36 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Edwin Zhai <edwin.zhai@intel.com> + * SangJin Kim <sangjin3.kim@samsung.com> + * Yeongkyoon Lee <yeongkyoon.lee@samsung.com> + * HyunGoo Kang <hyungoo1.kang@samsung.com> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Contributors: + * - Intel Corporation + * - S-Core Co., Ltd + * + */ + /* * 42DestroyImageKHR.c */ diff --git a/egl_1_4/global.c b/egl_1_4/global.c index f5192aa..884cfe3 100755 --- a/egl_1_4/global.c +++ b/egl_1_4/global.c @@ -430,7 +430,7 @@ void EGLAPIENTRY EGLINTER(BindGLFnptrs)(struct GlobalStruct* ptr) { #undef ACTION } -void EGLAPIENTRY EGLINTER(BindES1Fnptrs)(struct GlobalStruct* ptr) { +void EGLAPIENTRY EGLINTER(BindES1Fnptrs)(volatile struct GlobalStruct* ptr) { if (EGLINTER(global).dlES1 == NULL) { if ((EGLINTER(global).dlES1 = dlopen(GL_ES1_SO_FILENAME, RTLD_NOW | RTLD_GLOBAL)) == NULL) { EGLINTER(SetError)(EGL_BAD_ACCESS); @@ -446,7 +446,7 @@ void EGLAPIENTRY EGLINTER(BindES1Fnptrs)(struct GlobalStruct* ptr) { #undef ACTION } -void EGLAPIENTRY EGLINTER(BindES2Fnptrs)(struct GlobalStruct* ptr) { +void EGLAPIENTRY EGLINTER(BindES2Fnptrs)(volatile struct GlobalStruct* ptr) { if (EGLINTER(global).dlES2 == NULL) { if ((EGLINTER(global).dlES2 = dlopen(GL_ES2_SO_FILENAME, RTLD_NOW | RTLD_GLOBAL)) == NULL) { EGLINTER(SetError)(EGL_BAD_ACCESS); diff --git a/egl_1_4/implement.h b/egl_1_4/implement.h index 33b9184..17a629c 100755 --- a/egl_1_4/implement.h +++ b/egl_1_4/implement.h @@ -125,6 +125,8 @@ struct SurfaceExtra { EGLenum swapBehavior; EGLenum multisampleResolve; + EGLint width; + EGLint height; }; struct ContextExtra { @@ -446,8 +448,8 @@ EGLAPI int EGLAPIENTRY EGLCROSS(GetEGLImagePixmapInfo)(EGLImageKHR img, EGLAPI void EGLAPIENTRY EGLINTER(ResetGLFnptrs)(struct GlobalStruct* ptr); EGLAPI void EGLAPIENTRY EGLINTER(BindGLFnptrs)(struct GlobalStruct* ptr); -EGLAPI void EGLAPIENTRY EGLINTER(BindES1Fnptrs)(struct GlobalStruct* ptr); -EGLAPI void EGLAPIENTRY EGLINTER(BindES2Fnptrs)(struct GlobalStruct* ptr); +EGLAPI void EGLAPIENTRY EGLINTER(BindES1Fnptrs)(volatile struct GlobalStruct* ptr); +EGLAPI void EGLAPIENTRY EGLINTER(BindES2Fnptrs)(volatile struct GlobalStruct* ptr); #endif diff --git a/egl_1_4/makefile-dynamic b/egl_1_4/makefile-dynamic index e3c8bef..ddeef9a 100755 --- a/egl_1_4/makefile-dynamic +++ b/egl_1_4/makefile-dynamic @@ -8,7 +8,10 @@ ARFLAGS = rucv #LIB = libEGLbind.a LIBBASE = libEGL.so -LIBVER = 1.0 +LIBMAJOR = 1 +LIBMINOR = 0 +LIBVER = $(LIBMAJOR).$(LIBMINOR) +LIBSONAME = $(LIBBASE).$(LIBMAJOR) LIB = $(LIBBASE).$(LIBVER) END = @@ -61,13 +64,13 @@ __touch__: touch 33QueryString.c $(LIB): $(OBJS) - $(CC) -shared -Wl,-soname,$(LIBBASE).1 -I../include -o $@ $(OBJS) -I../include -ldl -lX11 + $(CC) -shared -Wl,-soname,$(LIBSONAME) -I../include -o $@ $(OBJS) -I../include -ldl -lX11 # $(AR) $(ARFLAGS) $@ $(OBJS) install: $(LIB) cp $(LIB) ../lib/host-gl/ - + ln -s $(LIB) ../lib/host-gl/$(LIBSONAME) # supports diff --git a/es_1_1/60get.c b/es_1_1/60get.c index fba2f28..3e5b05f 100755 --- a/es_1_1/60get.c +++ b/es_1_1/60get.c @@ -203,6 +203,9 @@ GL_API const GLubyte* GL_APIENTRY EXTFN(GetString)(GLenum name) { #if defined(PROVIDING_OES_element_index_uint) "GL_OES_element_index_uint " #endif +#if defined(PROVIDING_OES_framebuffer_object) + "GL_OES_framebuffer_object " +#endif ""; break; default: diff --git a/es_1_1/81framebuffer.c b/es_1_1/81framebuffer.c new file mode 100644 index 0000000..1882f91 --- /dev/null +++ b/es_1_1/81framebuffer.c @@ -0,0 +1,343 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * SangJin Kim <sangjin3.kim@samsung.com> + * YeongKyoon Lee <yeongkyoon.lee@samsung.com> + * HyunGoo Kang <hyungoo1.kang@samsung.com> + * DongKyun Yun + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Contributors: + * - S-Core Co., Ltd + * + */ + +#include "gl_imp.h" +#include <GLES/glext.h> + + +GL_API void GL_APIENTRY EXTFN(GenFramebuffersOES)(GLsizei n, GLuint* framebuffers) { + if (n < 0) { + INTFN(SetError)(GL_INVALID_VALUE); + return; + } else if (n == 0) { + return; + } + FNPTR(GenFramebuffers)(n, framebuffers); +} + +GL_API void GL_APIENTRY EXTFN(GenRenderbuffersOES)(GLsizei n, GLuint* renderbuffers) { + if (n < 0) { + INTFN(SetError)(GL_INVALID_VALUE); + return; + } else if (n == 0) { + return; + } + FNPTR(GenRenderbuffers)(n, renderbuffers); +} + +GL_API void GL_APIENTRY EXTFN(DeleteFramebuffersOES)(GLsizei n, const GLuint* framebuffers) { + if (n < 0) { + INTFN(SetError)(GL_INVALID_VALUE); + return; + } + + FNPTR(DeleteFramebuffers)(n, framebuffers); +} + +GL_API void GL_APIENTRY EXTFN(DeleteRenderbuffersOES)(GLsizei n, const GLuint* renderbuffers) { + if (n < 0) { + INTFN(SetError)(GL_INVALID_VALUE); + return; + } + FNPTR(DeleteRenderbuffers)(n, renderbuffers); +} + +GL_API GLboolean GL_APIENTRY EXTFN(IsFramebufferOES)(GLuint framebuffer) { + register GLboolean bAnswer; + bAnswer = FNPTR(IsFramebuffer)(framebuffer); + return bAnswer; +} + +GL_API GLboolean GL_APIENTRY EXTFN(IsRenderbufferOES)(GLuint renderbuffer) { + register GLboolean bAnswer; + bAnswer = FNPTR(IsRenderbuffer)(renderbuffer); + return bAnswer; +} + +GL_API void GL_APIENTRY EXTFN(BindFramebufferOES)(GLenum target, GLuint framebuffer) { + if (target != GL_FRAMEBUFFER_OES) { + INTFN(SetError)(GL_INVALID_ENUM); + return; + } + FNPTR(BindFramebuffer)(target, framebuffer); +} + +GL_API void GL_APIENTRY EXTFN(BindRenderbufferOES)(GLenum target, GLuint renderbuffer) { + if (target != GL_RENDERBUFFER_OES) { + INTFN(SetError)(GL_INVALID_ENUM); + return; + } + FNPTR(BindRenderbuffer)(target, renderbuffer); +} + +GL_API void GL_APIENTRY EXTFN(RenderbufferStorageOES)(GLenum target, + GLenum internalformat, GLsizei width, GLsizei height) { + int iMaxSize; + GLuint uRenderBuffer; + if (target != GL_RENDERBUFFER_OES) { + INTFN(SetError)(GL_INVALID_ENUM); + return; + } + switch (internalformat) { + default: +#if defined(PROVIDING_OES_packed_depth_stencil) + case GL_DEPTH24_STENCIL8_OES: +#endif + case GL_DEPTH_STENCIL_OES: + INTFN(SetError)(GL_INVALID_ENUM); + return; +#if defined(PROVIDING_OES_rgb8_rgba8) + case GL_RGB8_OES: + case GL_RGBA8_OES: +#endif + case GL_RGBA4_OES: + case GL_RGB5_A1_OES: + case GL_DEPTH_COMPONENT16_OES: + case GL_DEPTH_COMPONENT24_OES: + case GL_DEPTH_COMPONENT32_OES: + case GL_STENCIL_INDEX1_OES: + case GL_STENCIL_INDEX4_OES: + case GL_STENCIL_INDEX8_OES: + break; + case GL_RGB565_OES: + internalformat = GL_RGB5_A1_OES; + break; + } + FNPTR(GetIntegerv)(GL_MAX_RENDERBUFFER_SIZE_OES, &iMaxSize); + if (width < 0 || iMaxSize < width || height < 0 || iMaxSize < height) { + INTFN(SetError)(GL_INVALID_VALUE); + return; + } + FNPTR(GetIntegerv)(GL_RENDERBUFFER_BINDING_OES, &uRenderBuffer); + if (uRenderBuffer == 0) { + INTFN(SetError)(GL_INVALID_OPERATION); + return; + } + FNPTR(RenderbufferStorage)(target, internalformat, width, height); +} + +GL_API void GL_APIENTRY EXTFN(GetRenderbufferParameterivOES)(GLenum target, GLenum pname, GLint* params) { + GLuint uRenderBuffer; + if (target != GL_RENDERBUFFER_OES) { + INTFN(SetError)(GL_INVALID_ENUM); + return; + } + switch (pname) { + default: + INTFN(SetError)(GL_INVALID_ENUM); + return; + case GL_RENDERBUFFER_WIDTH_OES: + case GL_RENDERBUFFER_HEIGHT_OES: + case GL_RENDERBUFFER_INTERNAL_FORMAT_OES: + case GL_RENDERBUFFER_RED_SIZE_OES: + case GL_RENDERBUFFER_GREEN_SIZE_OES: + case GL_RENDERBUFFER_BLUE_SIZE_OES: + case GL_RENDERBUFFER_ALPHA_SIZE_OES: + case GL_RENDERBUFFER_DEPTH_SIZE_OES: + case GL_RENDERBUFFER_STENCIL_SIZE_OES: + break; + } + FNPTR(GetIntegerv)(GL_RENDERBUFFER_BINDING_OES, &uRenderBuffer); + if (uRenderBuffer == 0) { + INTFN(SetError)(GL_INVALID_OPERATION); + return; + } + FNPTR(GetRenderbufferParameteriv)(target, pname, params); +} + +GL_API void GL_APIENTRY EXTFN(FramebufferRenderbufferOES)(GLenum target, GLenum attachment, + GLenum renderbuffertarget, GLuint renderbuffer) { + GLuint uBuffer; + if (target != GL_FRAMEBUFFER_OES) { + INTFN(SetError)(GL_INVALID_ENUM); + return; + } + FNPTR(GetIntegerv)(GL_FRAMEBUFFER_BINDING_OES, &uBuffer); + if (uBuffer == 0) { + INTFN(SetError)(GL_INVALID_OPERATION); + return; + } + if (renderbuffertarget != GL_RENDERBUFFER_OES) { + INTFN(SetError)(GL_INVALID_ENUM); + return; + } + if (renderbuffer != 0 && FNPTR(IsRenderbuffer)(renderbuffer) == GL_FALSE) { + INTFN(SetError)(GL_INVALID_OPERATION); + return; + } + switch (attachment) { + default: + INTFN(SetError)(GL_INVALID_ENUM); + return; + case GL_COLOR_ATTACHMENT0_OES: + case GL_DEPTH_ATTACHMENT_OES: + case GL_STENCIL_ATTACHMENT_OES: + break; + } + FNPTR(FramebufferRenderbuffer)(target, attachment, renderbuffertarget, renderbuffer); +} + +GL_API void GL_APIENTRY EXTFN(FramebufferTexture2DOES)(GLenum target, GLenum attachment, + GLenum textarget, GLuint texture, GLint level) { + GLuint uBuffer; + if (target != GL_FRAMEBUFFER_OES) { + INTFN(SetError)(GL_INVALID_ENUM); + return; + } + FNPTR(GetIntegerv)(GL_FRAMEBUFFER_BINDING_OES, &uBuffer); + if (uBuffer == 0) { + INTFN(SetError)(GL_INVALID_OPERATION); + return; + } + switch (attachment) { + default: + INTFN(SetError)(GL_INVALID_ENUM); + return; + case GL_COLOR_ATTACHMENT0_OES: + case GL_DEPTH_ATTACHMENT_OES: + case GL_STENCIL_ATTACHMENT_OES: + break; + } + if (texture == 0) { + FNPTR(FramebufferTexture2D)(target, attachment, textarget, texture, level); + return; + } + if (FNPTR(IsTexture)(texture) == GL_FALSE) { + INTFN(SetError)(GL_INVALID_OPERATION); + return; + } + if (level != 0) { + INTFN(SetError)(GL_INVALID_VALUE); + return; + } + // disable GenMipmap which caused driver crash on Ubuntu with Intel graphic card. +#if 0 + switch (textarget) { + default: + INTFN(SetError)(GL_INVALID_ENUM); + return; + case GL_TEXTURE_2D: + FNPTR(GenerateMipmap)(GL_TEXTURE_2D); + break; + case GL_TEXTURE_CUBE_MAP_POSITIVE_X: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: + FNPTR(GenerateMipmap)(GL_TEXTURE_CUBE_MAP); + break; + } +#endif + FNPTR(FramebufferTexture2D)(target, attachment, textarget, texture, level); +} + +GL_API void GL_APIENTRY EXTFN(GetFramebufferAttachmentParameterivOES)(GLenum target, + GLenum attachment, GLenum pname, GLint* params) { + GLuint uBuffer; + if (target != GL_FRAMEBUFFER_OES) { + INTFN(SetError)(GL_INVALID_ENUM); + return; + } + FNPTR(GetIntegerv)(GL_FRAMEBUFFER_BINDING_OES, &uBuffer); + if (uBuffer == 0) { + INTFN(SetError)(GL_INVALID_OPERATION); + return; + } + switch (attachment) { + default: + INTFN(SetError)(GL_INVALID_ENUM); + return; + case GL_COLOR_ATTACHMENT0_OES: + case GL_DEPTH_ATTACHMENT_OES: + case GL_STENCIL_ATTACHMENT_OES: + break; + } + switch (pname) { + default: + INTFN(SetError)(GL_INVALID_ENUM); + return; + case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES: + case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES: + case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES: + case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES: + break; + } + FNPTR(GetFramebufferAttachmentParameteriv)(target, attachment, pname, params); +} + +#if ! defined(GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT_OES) +#define GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT_OES 0x8CD8 +#endif +#if ! defined(GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_OES) +#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_OES 0x8CDB +#endif +#if ! defined(GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_OES) +#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_OES 0x8CDC +#endif +#if ! defined(GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT_OES) +#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT_OES 0x8CDA +#endif +#if ! defined(GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_OES) +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_OES 0x8D56 +#endif + +GL_API GLenum GL_APIENTRY EXTFN(CheckFramebufferStatusOES)(GLenum target) { + register GLenum eValue; + if (target != GL_FRAMEBUFFER_OES) { + INTFN(SetError)(GL_INVALID_ENUM); + } + eValue = FNPTR(CheckFramebufferStatus)(target); + switch (eValue) { + default: + case GL_FRAMEBUFFER_COMPLETE_OES: + case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES: + case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES: + case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES: + case GL_FRAMEBUFFER_UNSUPPORTED_OES: + break; + case GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT_OES: + case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_OES: + case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_OES: + eValue = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES; + break; + case GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT_OES: + case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_OES: + eValue = GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES; + break; + case 0: + eValue = GL_FRAMEBUFFER_UNSUPPORTED_OES; + break; + } + return (eValue == 0) ? GL_FRAMEBUFFER_UNSUPPORTED_OES : eValue; +} + diff --git a/es_1_1/EGLImage.c b/es_1_1/EGLImage.c index cadb554..e628583 100644 --- a/es_1_1/EGLImage.c +++ b/es_1_1/EGLImage.c @@ -1,3 +1,36 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Edwin Zhai <edwin.zhai@intel.com> + * SangJin Kim <sangjin3.kim@samsung.com> + * Yeongkyoon Lee <yeongkyoon.lee@samsung.com> + * HyunGoo Kang <hyungoo1.kang@samsung.com> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Contributors: + * - Intel Corporation + * - S-Core Co., Ltd + * + */ + /* * EGLImage.c * diff --git a/es_1_1/funcaction.inl b/es_1_1/funcaction.inl index 4ecc24a..1762086 100755 --- a/es_1_1/funcaction.inl +++ b/es_1_1/funcaction.inl @@ -106,3 +106,17 @@ ACTION( GetTexGeniv ); ACTION( GetTexGenfv ); #endif + ACTION( GenFramebuffers ); + ACTION( GenRenderbuffers ); + ACTION( DeleteFramebuffers ); + ACTION( DeleteRenderbuffers ); + ACTION( IsFramebuffer ); + ACTION( IsRenderbuffer ); + ACTION( BindFramebuffer ); + ACTION( BindRenderbuffer ); + ACTION( RenderbufferStorage ); + ACTION( GetRenderbufferParameteriv ); + ACTION( FramebufferRenderbuffer ); + ACTION( FramebufferTexture2D ); + ACTION( GetFramebufferAttachmentParameteriv ); + ACTION( CheckFramebufferStatus ); diff --git a/es_1_1/gl_context.h b/es_1_1/gl_context.h index 604190a..4eaabca 100755 --- a/es_1_1/gl_context.h +++ b/es_1_1/gl_context.h @@ -207,6 +207,21 @@ struct AGContext { void (*fpGetTexGeniv)(GLenum, GLenum, GLint*); void (*fpGetTexGenfv)(GLenum, GLenum, GLfloat*); #endif + void (*fpGenFramebuffers)(GLsizei n, GLuint* framebuffers); + void (*fpGenRenderbuffers)(GLsizei n, GLuint* renderbuffers); + void (*fpDeleteFramebuffers)(GLsizei n, const GLuint* framebuffers); + void (*fpDeleteRenderbuffers)(GLsizei n, const GLuint* renderbuffers); + GLboolean (*fpIsFramebuffer)(GLuint framebuffer); + GLboolean (*fpIsRenderbuffer)(GLuint renderbuffer); + void (*fpBindFramebuffer)(GLenum target, GLuint framebuffer); + void (*fpBindRenderbuffer)(GLenum target, GLuint renderbuffer); + void (*fpRenderbufferStorage)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); + void (*fpGetRenderbufferParameteriv)(GLenum target, GLenum pname, GLint* params); + void (*fpFramebufferRenderbuffer)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); + void (*fpFramebufferTexture2D)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); + void (*fpGetFramebufferAttachmentParameteriv)(GLenum target, GLenum attachment, GLenum pname, GLint* params); + GLenum (*fpCheckFramebufferStatus)(GLenum target); + }; diff --git a/es_1_1/makefile-dynamic b/es_1_1/makefile-dynamic index de5adb6..488e66e 100755 --- a/es_1_1/makefile-dynamic +++ b/es_1_1/makefile-dynamic @@ -17,11 +17,15 @@ CFLAGS += -DPROVIDING_OES_texture_cube_map CFLAGS += -DPROVIDING_OES_texture_env_crossbar CFLAGS += -DPROVIDING_OES_texture_mirrored_repeat CFLAGS += -DPROVIDING_OES_element_index_uint +CFLAGS += -DPROVIDING_OES_framebuffer_object # never CFLAGS += -DPROVIDING_OES_texture_3D # only for ES 2.0 # never CFLAGS += -DPROVIDING_OES_texture_npot # only for ES 2.0 LIBBASE = libGLESv1_CM.so -LIBVER = 1.0 +LIBMAJOR = 1 +LIBMINOR = 0 +LIBVER = $(LIBMAJOR).$(LIBMINOR) +LIBSONAME = $(LIBBASE).$(LIBMAJOR) LIB = $(LIBBASE).$(LIBVER) END = @@ -49,6 +53,7 @@ SRCS = \ 50flush.c \ 60get.c \ 80ext.c \ + 81framebuffer.c \ gl_real.c \ gl_context.c \ EGLImage.c \ @@ -63,10 +68,11 @@ __touch__: touch 60get.c $(LIB): $(OBJS) - $(CC) -shared -Wl,-soname,$(LIBBASE).1 -o $@ $(OBJS) -ldl + $(CC) -shared -Wl,-soname,$(LIBSONAME) -o $@ $(OBJS) -ldl install: $(LIB) cp $(LIB) ../lib/host-gl/ + ln -s $(LIB) ../lib/host-gl/$(LIBSONAME) # supports diff --git a/es_2_0/EGLImage.c b/es_2_0/EGLImage.c index e5bf78d..c1bd7ad 100644 --- a/es_2_0/EGLImage.c +++ b/es_2_0/EGLImage.c @@ -1,3 +1,36 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Edwin Zhai <edwin.zhai@intel.com> + * SangJin Kim <sangjin3.kim@samsung.com> + * Yeongkyoon Lee <yeongkyoon.lee@samsung.com> + * HyunGoo Kang <hyungoo1.kang@samsung.com> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Contributors: + * - Intel Corporation + * - S-Core Co., Ltd + * + */ + /* * EGLImage.c * @@ -40,12 +73,12 @@ void GL_APIENTRY ES2ENTRY(EGLImageTargetTexture2DOES) (GLenum target, (*fpGetEGLImagePixmapInfo)(image, &dpy, &pixmap, &width, &height, &depth); } - fprintf (stderr, "EGLImage: glEGLImageTargetTexture2DOES () was called!\n"); - fprintf (stderr, "======== target = 0x%x\n", (unsigned int)target); - fprintf (stderr, "======== image = 0x%x\n", (unsigned int)image); - fprintf (stderr, "======== width = 0x%x\n", (unsigned int)width); - fprintf (stderr, "======== height = 0x%x\n", (unsigned int)height); - fprintf (stderr, "======== depth = 0x%x\n", (unsigned int)depth); +// fprintf (stderr, "EGLImage: glEGLImageTargetTexture2DOES () was called!\n"); +// fprintf (stderr, "======== target = 0x%x\n", (unsigned int)target); +// fprintf (stderr, "======== image = 0x%x\n", (unsigned int)image); +// fprintf (stderr, "======== width = 0x%x\n", (unsigned int)width); +// fprintf (stderr, "======== height = 0x%x\n", (unsigned int)height); +// fprintf (stderr, "======== depth = 0x%x\n", (unsigned int)depth); /* EGLImageTargetTexture2DOES support 2D rendering results in the * xpixmap as texture, so firstly TexImage2D then trap into host, where @@ -60,7 +93,7 @@ void GL_APIENTRY ES2ENTRY(EGLImageTargetTexture2DOES) (GLenum target, /* 2D rendering from Xlib doesn't produce alpha channel. Make a * option(default off) to add alpha as 0xff for each pixel with * possible performance drop */ -//#define FILL_IN_ALPHA +#define FILL_IN_ALPHA #ifdef FILL_IN_ALPHA /* Add alpha channel if needed, as Xlib rendering doesn't produce it */ if ( img->bits_per_pixel == 32 ) diff --git a/es_2_0/makefile-dynamic b/es_2_0/makefile-dynamic index 3511dde..bdd162a 100755 --- a/es_2_0/makefile-dynamic +++ b/es_2_0/makefile-dynamic @@ -23,7 +23,10 @@ CFLAGS += -DPROVIDING_OES_rgb8_rgba8 CFLAGS += -DPROVIDING_OES_packed_depth_stencil LIBBASE = libGLESv2.so -LIBVER = 1.0 +LIBMAJOR = 1 +LIBMINOR = 0 +LIBVER = $(LIBMAJOR).$(LIBMINOR) +LIBSONAME = $(LIBBASE).$(LIBMAJOR) LIB = $(LIBBASE).$(LIBVER) END = @@ -68,10 +71,11 @@ __touch__: touch Get.c $(LIB): $(OBJS) - $(CC) -shared -Wl,-soname,$(LIBBASE).1 -o $@ $(OBJS) -ldl -lX11 + $(CC) -shared -Wl,-soname,$(LIBSONAME) -o $@ $(OBJS) -ldl -lX11 install: $(LIB) cp $(LIB) ../lib/host-gl/ + ln -s $(LIB) ../lib/host-gl/$(LIBSONAME) # supports diff --git a/lib/host-gl/libEGL.so.1.0 b/lib/host-gl/libEGL.so.1.0 Binary files differdeleted file mode 100755 index ffcab06..0000000 --- a/lib/host-gl/libEGL.so.1.0 +++ /dev/null diff --git a/lib/host-gl/libGL.so.1.2 b/lib/host-gl/libGL.so.1.2 Binary files differdeleted file mode 100755 index 97c4714..0000000 --- a/lib/host-gl/libGL.so.1.2 +++ /dev/null diff --git a/lib/host-gl/libGLESv1_CM.so.1.0 b/lib/host-gl/libGLESv1_CM.so.1.0 Binary files differdeleted file mode 100755 index 2edc1e5..0000000 --- a/lib/host-gl/libGLESv1_CM.so.1.0 +++ /dev/null diff --git a/lib/host-gl/libGLESv2.so.1.0 b/lib/host-gl/libGLESv2.so.1.0 Binary files differdeleted file mode 100755 index 7191753..0000000 --- a/lib/host-gl/libGLESv2.so.1.0 +++ /dev/null diff --git a/lib/libEGL.so b/lib/libEGL.so index b81a6fd..62c6fdc 120000 --- a/lib/libEGL.so +++ b/lib/libEGL.so @@ -1 +1 @@ -host-gl/libEGL.so.1.0
\ No newline at end of file +libEGL.so.1
\ No newline at end of file diff --git a/lib/libGL.so.1.0 b/lib/libGL.so.1.0 deleted file mode 120000 index 3a27339..0000000 --- a/lib/libGL.so.1.0 +++ /dev/null @@ -1 +0,0 @@ -host-gl/libGL.so.1.2
\ No newline at end of file diff --git a/lib/libGLESv1_CM.so b/lib/libGLESv1_CM.so index eaabe7d..d8752e2 120000 --- a/lib/libGLESv1_CM.so +++ b/lib/libGLESv1_CM.so @@ -1 +1 @@ -host-gl/libGLESv1_CM.so.1.0
\ No newline at end of file +libGLESv1_CM.so.1
\ No newline at end of file diff --git a/lib/libGLESv2.so b/lib/libGLESv2.so index c3dc772..d182d5e 120000 --- a/lib/libGLESv2.so +++ b/lib/libGLESv2.so @@ -1 +1 @@ -host-gl/libGLESv2.so.1.0
\ No newline at end of file +libGLESv2.so.1
\ No newline at end of file diff --git a/lib/pkgconfig/opengl.pc b/lib/pkgconfig/gles11.pc index 9e010b1..9e010b1 100644 --- a/lib/pkgconfig/opengl.pc +++ b/lib/pkgconfig/gles11.pc diff --git a/lib/pkgconfig/opengl2.pc b/lib/pkgconfig/gles20.pc index 451ab9f..451ab9f 100644 --- a/lib/pkgconfig/opengl2.pc +++ b/lib/pkgconfig/gles20.pc diff --git a/libGL/Makefile b/libGL/Makefile index 3f5c0d0..b4ee524 100755 --- a/libGL/Makefile +++ b/libGL/Makefile @@ -35,6 +35,7 @@ parse_mesa_get_c: parse_mesa_get_c.c mesa_gl.h mesa_glext.h install: libGL.so.1.2 cp libGL.so.1.2 ../lib/host-gl/ + ln -s libGL.so.1.2 ../lib/host-gl/libGL.so.1 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_glx.c b/libGL/client_glx.c index dd23ea1..bab9d7c 100755 --- a/libGL/client_glx.c +++ b/libGL/client_glx.c @@ -335,6 +335,7 @@ static void _create_context(GLXContext context, GLXContext shareList) glstates[nbGLStates]->context = context; glstates[nbGLStates]->shareList = shareList; glstates[nbGLStates]->viewport.width = 0; + glstates[nbGLStates]->arrayBuffers = glstates[nbGLStates]->ownArrayBuffers; if (shareList) { for(i=0; i<nbGLStates; i++) @@ -345,6 +346,8 @@ static void _create_context(GLXContext context, GLXContext shareList) glstates[nbGLStates]->textureAllocator = glstates[i]->textureAllocator; glstates[nbGLStates]->bufferAllocator = glstates[i]->bufferAllocator; glstates[nbGLStates]->listAllocator = glstates[i]->listAllocator; + /* arrayBuffers need to be shared between shareLists */ + glstates[nbGLStates]->arrayBuffers = glstates[i]->arrayBuffers; break; } } @@ -405,15 +408,15 @@ GLXContext glXCreateContext( Display *dpy, XVisualInfo *vis, GLXContext glXGetCurrentContext (void) { GET_CURRENT_STATE(); - if (debug_gl) log_gl("glXGetCurrentContext() -> %p\n", state->context); - return state->context; + if (debug_gl) log_gl("glXGetCurrentContext() -> %p\n", state ? state->context : NULL); + return state ? state->context : NULL; } GLXDrawable glXGetCurrentDrawable (void) { GET_CURRENT_STATE(); - if (debug_gl) log_gl("glXGetCurrentDrawable() -> %p\n", (void*)state->current_drawable); - return state->current_drawable; + if (debug_gl) log_gl("glXGetCurrentDrawable() -> %p\n", state ? (void*)state->current_drawable: None); + return state ? state->current_drawable: None; } static void _free_context(Display* dpy, int i, GLState* state) @@ -520,6 +523,7 @@ static void _get_window_info(Display *dpy, Window win, WindowInfoStruct* info) { info->width = 0; info->height= 0; + info->depth = 0; info->map_state = IsUnviewable; return; } @@ -543,10 +547,12 @@ static void _get_window_info(Display *dpy, Window win, WindowInfoStruct* info) if (geom) { info->width = geom->width; info->height = geom->height; + info->depth = geom->depth; free (geom); } else { info->width = 0; info->height= 0; + info->depth = 0; } } @@ -565,7 +571,7 @@ static void _get_window_info(Display *dpy, Window win, WindowInfoStruct* info) } #endif -RendererData *renderer_create_image(Display *dpy, int w, int h) +RendererData *renderer_create_image(Display *dpy, Window win, int w, int h, int depth) { RendererData *rdata = calloc(1, sizeof(*rdata)); @@ -574,8 +580,9 @@ RendererData *renderer_create_image(Display *dpy, int w, int h) rdata->w = w; rdata->h = h; + rdata->gc = XCreateGC(dpy, win, 0, NULL); - rdata->image = XShmCreateImage(dpy, DefaultVisual(dpy, 0), 24, ZPixmap, NULL, + rdata->image = XShmCreateImage(dpy, DefaultVisual(dpy, 0), depth, ZPixmap, NULL, &rdata->shminfo, w, h); if(!rdata->image) @@ -609,7 +616,7 @@ out_destroy_img: XDestroyImage(rdata->image); out_try_non_shm: // Fallback path - rdata->image = XCreateImage(dpy, DefaultVisual(dpy, 0), 24, ZPixmap, 0, NULL, w, h, 32, 0); + rdata->image = XCreateImage(dpy, DefaultVisual(dpy, 0), depth, ZPixmap, 0, NULL, w, h, 32, 0); if(rdata->image) { rdata->buffer = calloc(1, (rdata->image->bytes_per_line) * h); if(rdata->buffer) { @@ -618,6 +625,8 @@ out_try_non_shm: } } XDestroyImage(rdata->image); + if (rdata->gc) + XFreeGC(dpy, rdata->gc); free(rdata); out: return NULL; @@ -645,12 +654,12 @@ void renderer_destroy_image(Display *dpy, RendererData *rdata) { #define MAX_PBUFFERS 100 /* Do this only with lock held */ -static void _request_host_resize(Display *dpy, Window win, GLState *state, int w, int h) +static void _request_host_resize(Display *dpy, Window win, GLState *state, int w, int h, int depth) { if(state->renderer_data) renderer_destroy_image(dpy, state->renderer_data); - state->renderer_data = renderer_create_image(dpy, w, h); + state->renderer_data = renderer_create_image(dpy, win, w, h, depth); long args[] = { INT_TO_ARG(win), INT_TO_ARG(w), INT_TO_ARG(h)}; do_opengl_call_no_lock(_resize_surface_func, NULL, args, 0); @@ -658,6 +667,7 @@ static void _request_host_resize(Display *dpy, Window win, GLState *state, int w static void _update_renderer(Display *dpy, Window win) { GET_CURRENT_STATE(); + GC gc; WindowInfoStruct info; WindowInfoStruct *old_info = &state->last_win_state; @@ -666,23 +676,16 @@ static void _update_renderer(Display *dpy, Window win) { _get_window_info(dpy, win, &info); - if(info.map_state != IsViewable) { - if(state->renderer_data); - renderer_destroy_image(dpy, state->renderer_data); - state->renderer_data = NULL; - goto out; - } +// if(info.map_state != IsViewable) { +// goto out; +// } - if(!state->renderer_data) { - state->renderer_data = renderer_create_image(dpy, info.width, info.height); - _request_host_resize(dpy, win, state, info.width, info.height); + if(!state->renderer_data || info.width != old_info->width || info.height != old_info->height + || info.depth != old_info->depth) { + _request_host_resize(dpy, win, state, info.width, info.height, info.depth); goto out; } - if ((info.width != old_info->width) || (info.height != old_info->height)) { - _request_host_resize(dpy, win, state, info.width, info.height); - goto out; - } //fprintf(stderr, "render: win: %08x w: %d h: %d stride: %d\n", win, state->renderer_data->w, state->renderer_data->h, state->renderer_data->image->bytes_per_line); @@ -691,13 +694,18 @@ static void _update_renderer(Display *dpy, Window win) { int args_size[] = {0, 0, 0, state->renderer_data->image->bytes_per_line*state->renderer_data->h}; do_opengl_call_no_lock(_render_surface_func, NULL, args, args_size); + if (state->renderer_data->gc) + gc = state->renderer_data->gc; + else + gc = DefaultGC(dpy, 0); + /* draw into window */ if(state->renderer_data->use_shm) - XShmPutImage(dpy, win, DefaultGC(dpy, 0), state->renderer_data->image, + XShmPutImage(dpy, win, gc, state->renderer_data->image, 0, 0, 0, 0, state->renderer_data->w, state->renderer_data->h, False); else - XPutImage(dpy, win, DefaultGC(dpy, 0), state->renderer_data->image, 0, 0, + XPutImage(dpy, win, gc, state->renderer_data->image, 0, 0, 0, 0, state->renderer_data->w, state->renderer_data->h); XFlush(dpy); @@ -733,21 +741,15 @@ int _check_and_resize_window (GLState *state, Window win) { _get_window_info(state->display, win, &info); LOCK(_resize_surface_func); - if(info.map_state != IsViewable) { - if(state->renderer_data); - renderer_destroy_image(state->display, state->renderer_data); - state->renderer_data = NULL; - changed = 1; - } else if(!state->renderer_data) { - state->renderer_data = renderer_create_image(state->display, info.width, info.height); - _request_host_resize(state->display, win, state, info.width, info.height); - changed = 1; - } else if ((info.width != old_info->width) || (info.height != old_info->height)) { - _request_host_resize(state->display, win, state, info.width, info.height); - changed = 1; - } + if(!state->renderer_data || info.width != old_info->width || info.height != old_info->height || + info.depth != old_info->depth) { + _request_host_resize(state->display, win, state, info.width, info.height, info.depth); + changed = 1; + } memcpy(old_info, &info, sizeof(info)); + + UNLOCK(_resize_surface_func); return changed; @@ -756,7 +758,6 @@ int _check_and_resize_window (GLState *state, Window win) { Bool glXMakeCurrent_no_lock( Display *dpy, GLXDrawable drawable, GLXContext ctx) { Bool ret = False; - int i; #if 0 if (drawable == 0 && ctx == 0) return True; @@ -772,6 +773,12 @@ Bool glXMakeCurrent_no_lock( Display *dpy, GLXDrawable drawable, GLXContext ctx) ret = True; } + if (drawable == 0 && ctx == 0) + { + SET_CURRENT_STATE(NULL); + return ret; + } + if (ret) { int i; @@ -1266,7 +1273,7 @@ GLAPI Bool APIENTRY glXMakeContextCurrent( Display *dpy, GLXDrawable draw, } } ret = glXMakeCurrent(dpy, draw, ctx); - if (ret) + if (ret && ctx) state->current_read_drawable = read; return ret; } @@ -1332,33 +1339,78 @@ GLAPI GLXPixmap APIENTRY glXCreatePixmap( Display *dpy, GLXFBConfig fbconfig, 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..."); + CHECK_PROC(glXDestroyPixmap); + + LOCK(glXDestroyPixmap_func); + log_gl("glXDestroyPixmap 0x%x.\n", pixmap); + + long args[] = { POINTER_TO_ARG(dpy), INT_TO_ARG(pixmap) }; + do_opengl_call_no_lock(glXDestroyPixmap_func, NULL, args, NULL); + UNLOCK(glXDestroyPixmap_func); } -GLAPI GLXPbuffer APIENTRY glXCreatePbuffer( Display *dpy, GLXFBConfig config, +GLAPI GLXPbuffer APIENTRY glXCreatePbuffer( Display *dpy, GLXFBConfig fbconfig, const int *attribList ) { CHECK_PROC_WITH_RET(glXCreatePbuffer); - /* FIXME */ - log_gl("glXCreatePbuffer: sorry, unsupported call and I don't really see how I could implement it..."); - return 0; + LOCK(glXCreatePbuffer_func); + + if (debug_gl) log_gl("glXCreatePbuffer %p\n", (void*)fbconfig); + + int emptyAttribList = None; + if (attribList == NULL) attribList = &emptyAttribList; + GLXPbuffer glxpbuf; + + long args[] = { POINTER_TO_ARG(dpy), INT_TO_ARG(fbconfig), + POINTER_TO_ARG(attribList) }; + int args_size[] = { 0, 0, sizeof(int) * _compute_length_of_attrib_list_including_zero(attribList, 1) }; + do_opengl_call_no_lock(glXCreatePbuffer_func, &glxpbuf, args, args_size); + if (glxpbuf) + { + /*XXX:maintain the info?*/ + } + UNLOCK(glXCreatePbuffer_func); + + return glxpbuf; } GLAPI void APIENTRY glXDestroyPbuffer( Display *dpy, GLXPbuffer pbuf ) { CHECK_PROC(glXDestroyPbuffer); - /* FIXME */ - log_gl("glXDestroyPbuffer: sorry, unsupported call and I don't really see how I could implement it..."); + + LOCK(glXDestroyPbuffer_func); + log_gl("glXDestroyPbuffer 0x%x.\n", pbuf); + + long args[] = { POINTER_TO_ARG(dpy), INT_TO_ARG(pbuf) }; + do_opengl_call_no_lock(glXDestroyPbuffer_func, NULL, args, NULL); + UNLOCK(glXDestroyPbuffer_func); +} + +GLAPI Bool APIENTRY glXBindTexImageARB( Display *dpy, GLXDrawable drawable, + const int buffer) +{ + Bool ret = False; + CHECK_PROC(glXBindTexImageARB_fake); + long args[] = { POINTER_TO_ARG(dpy), INT_TO_ARG(drawable), INT_TO_ARG(buffer) }; + do_opengl_call(glXBindTexImageARB_fake_func, &ret, args, NULL); + return ret; +} + +GLAPI Bool APIENTRY glXReleaseTexImageARB( Display *dpy, GLXDrawable drawable, + const int buffer) +{ + Bool ret = False; + CHECK_PROC(glXReleaseTexImageARB_fake); + long args[] = { POINTER_TO_ARG(dpy), INT_TO_ARG(drawable), INT_TO_ARG(buffer) }; + do_opengl_call(glXReleaseTexImageARB_fake_func, &ret, args, NULL); + return ret; } GLAPI GLXDrawable APIENTRY glXGetCurrentReadDrawable( void ) { CHECK_PROC_WITH_RET(glXGetCurrentReadDrawable); GET_CURRENT_STATE(); - return state->current_read_drawable; + return state ? state->current_read_drawable : None; } GLAPI void APIENTRY glXSelectEvent( Display *dpy, GLXDrawable drawable, @@ -3103,7 +3155,7 @@ static const char* global_glXGetProcAddress_request = "glXBindHyperpipeSGIX\0" "glXBindSwapBarrierNV\0" "glXBindSwapBarrierSGIX\0" -"glXBindTexImageEXT\0" +"glXBindTexImageARB\0" "glXBindVideoImageNV\0" "glXChannelRectSGIX\0" "glXChannelRectSyncSGIX\0" @@ -3188,7 +3240,7 @@ static const char* global_glXGetProcAddress_request = "glXQuerySwapGroupNV\0" "glXQueryVersion\0" "glXReleaseBuffersMESA\0" -"glXReleaseTexImageEXT\0" +"glXReleaseTexImageARB\0" "glXReleaseVideoDeviceNV\0" "glXReleaseVideoImageNV\0" "glXResetFrameCountNV\0" diff --git a/libGL/common.h b/libGL/common.h index a28aa49..4364629 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 <= glXDestroyPixmap_func) +#define IS_GLX_CALL(x) (x >= glXChooseVisual_func && x <= glXDestroyPbuffer_func) #define SIZE_BUFFER_COMMAND (1024*64) //#define MAX_SIZE_BUFFER_COMMAND (1024*1024*10) @@ -179,6 +179,7 @@ typedef struct { int width; int height; + int depth; int map_state; } WindowInfoStruct; @@ -292,6 +293,7 @@ typedef struct XImage *image; XShmSegmentInfo shminfo; char *buffer; + GC gc; int w; int h; int use_shm; @@ -327,7 +329,8 @@ typedef struct int pixelUnpackBuffer; int pixelPackBuffer; - Buffer arrayBuffers[32768]; + Buffer ownArrayBuffers[32768]; + Buffer *arrayBuffers; Buffer elementArrayBuffers[32768]; Buffer pixelUnpackBuffers[32768]; Buffer pixelPackBuffers[32768]; diff --git a/libGL/gl_func_perso.h b/libGL/gl_func_perso.h index 7ae6e7d..60b9ca7 100755 --- a/libGL/gl_func_perso.h +++ b/libGL/gl_func_perso.h @@ -60,6 +60,10 @@ MAGIC_MACRO(glXGetDriverConfig), MAGIC_MACRO(glXSwapIntervalSGI), MAGIC_MACRO(glXCreatePixmap), MAGIC_MACRO(glXDestroyPixmap), +MAGIC_MACRO(glXBindTexImageARB_fake), +MAGIC_MACRO(glXReleaseTexImageARB_fake), +MAGIC_MACRO(glXCreatePbuffer), +MAGIC_MACRO(glXDestroyPbuffer), MAGIC_MACRO(glGetString), diff --git a/libGL/opengl_client.c b/libGL/opengl_client.c index 3574faa..2216dc4 100755 --- a/libGL/opengl_client.c +++ b/libGL/opengl_client.c @@ -109,8 +109,11 @@ static inline int call_opengl(char *buffer, int args_len, int ret_len, char *ret /* i[0] = pid; ...is filled in by the kernel module for virtio GL */ i[1] = args_len; i[2] = ret_len; + + /* following args_len is net load excluding OUT_HEADER */ + args_len -= SIZE_OUT_HEADER; - if(buffer == xfer_buffer) { + if(buffer == xfer_buffer) { // All data fits within one buffer fsync(glfd); } else { diff --git a/libGL/opengl_func.h b/libGL/opengl_func.h index 7d48aa0..99b58ec 100755 --- a/libGL/opengl_func.h +++ b/libGL/opengl_func.h @@ -446,8 +446,8 @@ static const int glXDestroyPixmap_signature[] = 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 glXBindTexImageARB_fake_signature[] = { TYPE_INT, 0, 3, TYPE_IN_IGNORED_POINTER, TYPE_INT, TYPE_INT }; +static const int glXReleaseTexImageARB_fake_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 }; diff --git a/packaging/simulator-opengl.changes b/packaging/simulator-opengl.changes new file mode 100644 index 0000000..e876a61 --- /dev/null +++ b/packaging/simulator-opengl.changes @@ -0,0 +1,6 @@ +* Tue Jul 16 17:47:42 KST 2013 Sangjin Kim <sangjin3.kim@samsung.com> +- Version update for popup display problem. +* Tue Jul 16 12:09:57 KST 2013 Sangjin Kim <sangjin3.kim@samsung.com> +- Version update for popup display problem. +* Mon Jul 8 11:08:16 KST 2013 Sangjin Kim <sangjin3.kim@samsung.com> +- Version update for gallery slideshow effect problem. diff --git a/packaging/simulator-opengl.manifest b/packaging/simulator-opengl.manifest new file mode 100644 index 0000000..017d22d --- /dev/null +++ b/packaging/simulator-opengl.manifest @@ -0,0 +1,5 @@ +<manifest> + <request> + <domain name="_"/> + </request> +</manifest> diff --git a/packaging/simulator-opengl.spec b/packaging/simulator-opengl.spec index 5bdce88..197b012 100755 --- a/packaging/simulator-opengl.spec +++ b/packaging/simulator-opengl.spec @@ -1,12 +1,12 @@ -#sbs-git:slp/sdk/simulator-opengl +#sbs-git:sdk/simulator-opengl Name: simulator-opengl Summary: opengl-es acceleration module for emulator -Version: 0.1.34 +Version: 0.2.17 Release: 1 -Group: TO_BE/FILLED_IN -License: TO_BE/FILLED_IN +License: MIT URL: http://www.khronos.org Source0: %{name}-%{version}.tar.gz +Source1001: packaging/simulator-opengl.manifest ExclusiveArch: %{ix86} BuildRequires: pkgconfig(xfixes) BuildRequires: pkgconfig(x11) @@ -21,7 +21,6 @@ This package contains 4 shared libraries, libGL, libEGL, libGLESv1, libGLESv2. %package devel Summary: opengl-es acceleration module for emulator (devel) -Group: TO_BE/FILLED_IN Requires: %{name} = %{version}-%{release} Requires: pkgconfig(x11) @@ -33,6 +32,7 @@ Opengl-es acceleration module for emulator. (devel) %setup -q %build +cp %{SOURCE1001} . make %install @@ -45,16 +45,32 @@ cp -r include/GL %{buildroot}/usr/include/ cp -r include/GLES %{buildroot}/usr/include/ cp -r include/GLES2 %{buildroot}/usr/include/ cp -r include/KHR %{buildroot}/usr/include/ + +mkdir -p %{buildroot}/etc/emulator +cp systemd/virtgl.sh %{buildroot}/etc/emulator/ +mkdir -p %{buildroot}/usr/lib/systemd/system +cp systemd/emul-opengl-mode.service %{buildroot}/usr/lib/systemd/system/ +cp systemd/emul-opengl-yagl.service %{buildroot}/usr/lib/systemd/system/ +mkdir -p %{buildroot}/usr/lib/systemd/system/emulator_preinit.target.wants +ln -s -f systemd/emul-opengl-mode.service %{buildroot}/usr/lib/systemd/system/emulator_preinit.target.wants/ +ln -s -f systemd/emul-opengl-yagl.service %{buildroot}/usr/lib/systemd/system/emulator_preinit.target.wants/ %files +%manifest simulator-opengl.manifest %defattr(-,root,root,-) -/usr/lib/libGL.* -/usr/lib/libEGL.* -/usr/lib/libGLES* +/usr/lib/libGL* +/usr/lib/libEGL* +/usr/lib/libGLES* /usr/lib/host-gl/* +/etc/emulator/virtgl.sh +/usr/lib/systemd/system/emul-opengl-mode.service +/usr/lib/systemd/system/emul-opengl-yagl.service +/usr/lib/systemd/system/emulator_preinit.target.wants/emul-opengl-mode.service +/usr/lib/systemd/system/emulator_preinit.target.wants/emul-opengl-yagl.service %files devel +%manifest simulator-opengl.manifest %defattr(-,root,root,-) /usr/include/EGL /usr/include/GL @@ -62,4 +78,3 @@ cp -r include/KHR %{buildroot}/usr/include/ /usr/include/GLES2 /usr/include/KHR /usr/lib/pkgconfig - diff --git a/systemd/emul-opengl-mode.service b/systemd/emul-opengl-mode.service new file mode 100644 index 0000000..3346513 --- /dev/null +++ b/systemd/emul-opengl-mode.service @@ -0,0 +1,11 @@ +[Unit] +Description=OpenGL mode +DefaultDependencies=no +Before=basic.target + +[Service] +Type=oneshot +ExecStart=/bin/sh -c '/etc/emulator/virtgl.sh' + +[Install] +WantedBy=emulator_preinit.target diff --git a/systemd/emul-opengl-yagl.service b/systemd/emul-opengl-yagl.service new file mode 100644 index 0000000..82b2e00 --- /dev/null +++ b/systemd/emul-opengl-yagl.service @@ -0,0 +1,13 @@ +[Unit] +Description=OpenGL "YAGL" +DefaultDependencies=no +After=emul-opengl-mode.service +Before=basic.target +ConditionKernelCommandLine=yagl=1 + +[Service] +Type=oneshot +ExecStart=/bin/sh -c 'systemctl set-environment LD_LIBRARY_PATH="/usr/lib/yagl${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"' + +[Install] +WantedBy=emulator_preinit.target diff --git a/systemd/virtgl.sh b/systemd/virtgl.sh new file mode 100644 index 0000000..df3a11d --- /dev/null +++ b/systemd/virtgl.sh @@ -0,0 +1,32 @@ + #!/bin/sh + +echo -e "[${_G} Opengl-es acceleration module setting. ${C_}]" +if grep "gles=1" /proc/cmdline ; then + echo -e "[${_G} Emulator support gles hw acceleration. ${C_}]" + echo -e "[${_G} Change permission of /dev/glmem. ${C_}]" + chmod 666 /dev/glmem + echo -e "[${_G} Apply to use hw gles library. ${C_}]" + ln -s -f /usr/lib/host-gl/libEGL.so.1.0 /usr/lib/libEGL.so + ln -s -f /usr/lib/host-gl/libEGL.so.1.0 /usr/lib/libEGL.so.1 + ln -s -f /usr/lib/host-gl/libGLESv1_CM.so.1.0 /usr/lib/libGLESv1_CM.so + ln -s -f /usr/lib/host-gl/libGLESv1_CM.so.1.0 /usr/lib/libGLESv1_CM.so.1 + ln -s -f /usr/lib/host-gl/libGLESv2.so.1.0 /usr/lib/libGLESv2.so + ln -s -f /usr/lib/host-gl/libGLESv2.so.1.0 /usr/lib/libGLESv2.so.1 + rm -f /usr/lib/st_GL.so + rm -f /usr/lib/egl_gallium.so + rm -f /usr/lib/libglapi.so* +else + echo -e "[${_G} Emulator does not support gles hw acceleration. ${C_}]" + echo -e "[${_G} Apply to use sw mesa gles library. ${C_}]" + ln -s -f /usr/lib/mesa-gl/libEGL.so.1.0 /usr/lib/libEGL.so + ln -s -f /usr/lib/mesa-gl/libEGL.so.1.0 /usr/lib/libEGL.so.1 + ln -s -f /usr/lib/mesa-gl/libGLESv1_CM.so.1.1.0 /usr/lib/libGLESv1_CM.so + ln -s -f /usr/lib/mesa-gl/libGLESv1_CM.so.1.1.0 /usr/lib/libGLESv1_CM.so.1 + ln -s -f /usr/lib/mesa-gl/libGLESv2.so.2.0.0 /usr/lib/libGLESv2.so + ln -s -f /usr/lib/mesa-gl/libGLESv2.so.2.0.0 /usr/lib/libGLESv2.so.1 + ln -s -f /usr/lib/mesa-gl/st_GL.so /usr/lib/st_GL.so + ln -s -f /usr/lib/mesa-gl/egl_gallium.so /usr/lib/egl_gallium.so + ln -s -f /usr/lib/mesa-gl/libglapi.so.0.0.0 /usr/lib/libglapi.so + ln -s -f /usr/lib/mesa-gl/libglapi.so.0.0.0 /usr/lib/libglapi.so.0 + ln -s -f /usr/lib/mesa-gl/libglapi.so.0.0.0 /usr/lib/libglapi.so.0.0.0 +fi |