diff options
Diffstat (limited to 'egl_1_4')
45 files changed, 5319 insertions, 0 deletions
diff --git a/egl_1_4/31Error.c b/egl_1_4/31Error.c new file mode 100755 index 0000000..5fadeba --- /dev/null +++ b/egl_1_4/31Error.c @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * DongKyun Yun <dk77.yun@samsung.com> + * SangJin Kim <sangjin3.kim@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: + * - S-Core Co., Ltd + * + */ + +#include "implement.h" +#include <stdarg.h> + + +EGLint EGLAPIENTRY eglGetError(void) { + EGLint iErrorCode = EGLINTER(global).iLastError; + EGLINTER(global).iLastError = EGL_SUCCESS; + return iErrorCode; +} + +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 new file mode 100755 index 0000000..fda853d --- /dev/null +++ b/egl_1_4/32GetDisplay.c @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * DongKyun Yun <dk77.yun@samsung.com> + * SangJin Kim <sangjin3.kim@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: + * - S-Core Co., Ltd + * + */ + +#include "implement.h" +#include <dlfcn.h> + + +EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType native) { + EGLBoolean bInvokedWithDefault = EGL_FALSE; + if (EGLINTER(global).dlGL == NULL) { + if ((EGLINTER(global).dlGL = dlopen(GL_SO_FILENAME, RTLD_NOW | RTLD_GLOBAL)) == NULL) { + EGLINTER(SetError)(EGL_BAD_ACCESS); + return; + } + EGLINTER(ResetFnptrs)(&(EGLINTER(global))); + EGLINTER(BindFnptrs)(&(EGLINTER(global))); +#if defined(PROVIDING_RUNTIME_BINDING) + EGLINTER(ResetGLFnptrs)(&(EGLINTER(global))); +#endif + } + if (native == EGL_DEFAULT_DISPLAY) { + native = XOpenDisplay(NULL); + if (native == NULL) { + return EGL_NO_DISPLAY; + } + bInvokedWithDefault = EGL_TRUE; + } + EGLDisplay unique = (EGLDisplay)(native); + struct DisplayExtra* pDisplay = EGLINTER(LookUpDisplay)(unique); + if (pDisplay == NULL) { + pDisplay = EGLINTER(InsertDisplay)(unique); + if (pDisplay == NULL) { + return EGL_NO_DISPLAY; + } + pDisplay->native = native; + pDisplay->bInitialized = EGL_FALSE; + pDisplay->bInvokedWithDefault = bInvokedWithDefault; + pDisplay->pConfigBuffer = NULL; + pDisplay->nConfigExtra = 0; + pDisplay->pConfigExtra = NULL; + pDisplay->pConfigAnswer = NULL; + } else { + + } + return pDisplay->unique; +} diff --git a/egl_1_4/32Initialize.c b/egl_1_4/32Initialize.c new file mode 100755 index 0000000..00a23d9 --- /dev/null +++ b/egl_1_4/32Initialize.c @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * DongKyun Yun <dk77.yun@samsung.com> + * SangJin Kim <sangjin3.kim@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: + * - S-Core Co., Ltd + * + */ + +#include "implement.h" +#include <dlfcn.h> + + +EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, EGLint* major, EGLint* minor) { + if (EGLINTER(global).dlGL == NULL) { + if ((EGLINTER(global).dlGL = dlopen(GL_SO_FILENAME, RTLD_NOW | RTLD_GLOBAL)) == NULL) { + EGLINTER(SetError)(EGL_BAD_ACCESS); + return; + } + EGLINTER(ResetFnptrs)(&(EGLINTER(global))); + EGLINTER(BindFnptrs)(&(EGLINTER(global))); +#if defined(PROVIDING_RUNTIME_BINDING) + EGLINTER(ResetGLFnptrs)(&(EGLINTER(global))); +#endif + } + struct DisplayExtra* pDisplay = EGLINTER(LookUpDisplay)(dpy); + if (pDisplay == NULL) { + EGLINTER(SetError)(EGL_BAD_DISPLAY); + return EGL_FALSE; + } + if (pDisplay->bInitialized == EGL_FALSE) { + int nConfig = EGLINTER(PrepareConfig)(pDisplay); + if (nConfig <= 0) { + EGLINTER(SetError)(EGL_NOT_INITIALIZED); + return EGL_FALSE; + } + + pDisplay->bInitialized = EGL_TRUE; + } + if (major != NULL) *major = HAZEL_EGL_MAJOR; + if (minor != NULL) *minor = HAZEL_EGL_MINOR; + return EGL_TRUE; +} diff --git a/egl_1_4/32Terminate.c b/egl_1_4/32Terminate.c new file mode 100755 index 0000000..1ec3957 --- /dev/null +++ b/egl_1_4/32Terminate.c @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * DongKyun Yun <dk77.yun@samsung.com> + * SangJin Kim <sangjin3.kim@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: + * - S-Core Co., Ltd + * + */ + +#include "implement.h" + + +EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy) { + struct DisplayExtra* pDisplay = EGLINTER(LookUpDisplay)(dpy); + if (pDisplay == NULL) { + EGLINTER(SetError)(EGL_BAD_DISPLAY); + return EGL_FALSE; + } + if (pDisplay->pConfigBuffer != NULL) { + XFree(pDisplay->pConfigBuffer); + pDisplay->pConfigBuffer = NULL; + } + if (pDisplay->pConfigExtra != NULL) { + free(pDisplay->pConfigExtra); + free(pDisplay->pConfigAnswer); + pDisplay->nConfigExtra = 0; + pDisplay->pConfigExtra = NULL; + pDisplay->pConfigAnswer = NULL; + } + pDisplay->bInitialized = EGL_FALSE; + return EGL_TRUE; +} + + diff --git a/egl_1_4/33QueryString.c b/egl_1_4/33QueryString.c new file mode 100755 index 0000000..68c85fd --- /dev/null +++ b/egl_1_4/33QueryString.c @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * DongKyun Yun <dk77.yun@samsung.com> + * SangJin Kim <sangjin3.kim@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: + * - S-Core Co., Ltd + * + */ + +#include "implement.h" + + +const char* EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name) { + struct DisplayExtra* pDisplay; + static char buf[256]; + pDisplay = EGLINTER(LookUpDisplay)(dpy); + if (pDisplay == NULL) { + EGLINTER(SetError)(EGL_BAD_DISPLAY); + return NULL; + } + if (pDisplay->bInitialized == EGL_FALSE) { + EGLINTER(SetError)(EGL_NOT_INITIALIZED); + return NULL; + } + switch (name) { + case EGL_CLIENT_APIS: +#if defined(PROVIDING_RUNTIME_BINDING) + return "OpenGL_ES OpenGL"; +#else + return "OpenGL_ES"; +#endif + break; + case EGL_VENDOR: +#if defined(PROVIDING_RUNTIME_BINDING) + return HAZEL_EGL_VENDOR " dynamic (compiled on " __DATE__ " " __TIME__ ")"; +#else + return HAZEL_EGL_VENDOR "(compiled on " __DATE__ " " __TIME__ ")"; +#endif + break; + case EGL_VERSION: + sprintf(buf, "%d.%d (on GLX %s %s)", HAZEL_EGL_MAJOR, HAZEL_EGL_MINOR, + FNPTR(GetClientString)(pDisplay->native, GLX_VENDOR), + FNPTR(GetClientString)(pDisplay->native, GLX_VERSION)); + return buf; + break; + case EGL_EXTENSIONS: + return "EGL_KHR_image"; + break; + default: + EGLINTER(SetError)(EGL_BAD_PARAMETER); + return NULL; + } +} + + diff --git a/egl_1_4/34ChooseConfig.c b/egl_1_4/34ChooseConfig.c new file mode 100755 index 0000000..d9a6719 --- /dev/null +++ b/egl_1_4/34ChooseConfig.c @@ -0,0 +1,176 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * DongKyun Yun <dk77.yun@samsung.com> + * SangJin Kim <sangjin3.kim@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: + * - S-Core Co., Ltd + * + */ + +#include "implement.h" + + +struct ConfigExtra configExtraDefault = { + EGL_DONT_CARE, (GLXFBConfig)EGL_DONT_CARE, + 0, 0, 0, 0, 0, 0, 0, + EGL_DONT_CARE, EGL_DONT_CARE, EGL_RGB_BUFFER, EGL_DONT_CARE, + EGL_DONT_CARE, 0, 0, + 0, 0, 0, + EGL_DONT_CARE, EGL_DONT_CARE, + EGL_DONT_CARE, EGL_DONT_CARE, EGL_DONT_CARE, + EGL_DONT_CARE, + 0, 0, 0, EGL_WINDOW_BIT, + EGL_NONE, EGL_DONT_CARE, EGL_DONT_CARE, EGL_DONT_CARE, +}; + +EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy, const EGLint* attrib_list, + EGLConfig* configs, EGLint config_size, EGLint* num_config) { + struct DisplayExtra* pDisplay; + struct ConfigExtra configValue; + pDisplay = EGLINTER(LookUpDisplay)(dpy); + if (pDisplay == NULL) { + EGLINTER(SetError)(EGL_BAD_DISPLAY); + return EGL_FALSE; + } + if (pDisplay->bInitialized == EGL_FALSE) { + EGLINTER(SetError)(EGL_NOT_INITIALIZED); + return EGL_FALSE; + } + if (num_config == NULL) { + EGLINTER(SetError)(EGL_BAD_PARAMETER); + return EGL_FALSE; + } + memcpy(&configValue, &configExtraDefault, sizeof(struct ConfigExtra)); + while (attrib_list && *attrib_list != EGL_NONE) { + switch (*attrib_list++) { + case EGL_CONFIG_ID: configValue.unique = *attrib_list++; break; + case EGL_BUFFER_SIZE: configValue.bufferSize = *attrib_list++; break; + case EGL_RED_SIZE: configValue.redSize = *attrib_list++; break; + case EGL_GREEN_SIZE: configValue.greenSize = *attrib_list++; break; + case EGL_BLUE_SIZE: configValue.blueSize = *attrib_list++; break; + case EGL_LUMINANCE_SIZE: configValue.luminanceSize = *attrib_list++; break; + case EGL_ALPHA_SIZE: configValue.alphaSize = *attrib_list++; break; + case EGL_ALPHA_MASK_SIZE: configValue.alphaMaskSize = *attrib_list++; break; + case EGL_BIND_TO_TEXTURE_RGB: configValue.bindToTexRGB = *attrib_list++; break; + case EGL_BIND_TO_TEXTURE_RGBA: configValue.bindToTexRGBA = *attrib_list++; break; + case EGL_COLOR_BUFFER_TYPE: configValue.colorBufferType = *attrib_list++; break; + case EGL_CONFIG_CAVEAT: configValue.configCaveat = *attrib_list++; break; + case EGL_CONFORMANT: configValue.conformant = *attrib_list++; break; + case EGL_DEPTH_SIZE: configValue.depthSize = *attrib_list++; break; + case EGL_LEVEL: configValue.level = *attrib_list++; break; + case EGL_MAX_PBUFFER_WIDTH: attrib_list++; break; + case EGL_MAX_PBUFFER_HEIGHT: attrib_list++; break; + case EGL_MAX_PBUFFER_PIXELS: attrib_list++; break; + case EGL_MAX_SWAP_INTERVAL: configValue.maxSwapInterval = *attrib_list++; break; + case EGL_MIN_SWAP_INTERVAL: configValue.minSwapInterval = *attrib_list++; break; + case EGL_NATIVE_RENDERABLE: configValue.nativeRenderable = *attrib_list++; break; + case EGL_NATIVE_VISUAL_ID: attrib_list++; break; + case EGL_NATIVE_VISUAL_TYPE: configValue.nativeVisualType = *attrib_list++; break; + case EGL_RENDERABLE_TYPE: configValue.renderableType = *attrib_list++; break; + case EGL_SAMPLE_BUFFERS: configValue.sampleBuffers = *attrib_list++; break; + case EGL_SAMPLES: configValue.samples = *attrib_list++; break; + case EGL_STENCIL_SIZE: configValue.stencilSize = *attrib_list++; break; + case EGL_SURFACE_TYPE: configValue.surfaceType = *attrib_list++; break; + case EGL_TRANSPARENT_TYPE: configValue.transparentType = *attrib_list++; break; + case EGL_TRANSPARENT_RED_VALUE: configValue.transparentRedValue = *attrib_list++; break; + case EGL_TRANSPARENT_GREEN_VALUE: configValue.transparentGreenValue = *attrib_list++; break; + case EGL_TRANSPARENT_BLUE_VALUE: configValue.transparentBlueValue = *attrib_list++; break; + case EGL_MATCH_NATIVE_PIXMAP: assert(0); break; + default: + EGLINTER(SetError)(EGL_BAD_ATTRIBUTE); + return EGL_FALSE; + } + } + struct ConfigExtra* pUnit = pDisplay->pConfigExtra; + int nCount = pDisplay->nConfigExtra; + int i; + if (configValue.unique != EGL_DONT_CARE) { + while (nCount--) { + if (pUnit->unique == configValue.unique) { + *num_config = 1; + if (configs != NULL && config_size > 0) { + configs[0] = (EGLConfig)pUnit; + } + return EGL_TRUE; + } + pUnit++; + } + *num_config = 0; + return EGL_TRUE; + } + int nAnswer = 0; + EGLConfig* pAnswer = pDisplay->pConfigAnswer; + for (; nCount--; pUnit++) { + if (pUnit->bufferSize < configValue.bufferSize) continue; + if (pUnit->redSize < configValue.redSize) continue; + if (pUnit->greenSize < configValue.greenSize) continue; + if (pUnit->blueSize < configValue.blueSize) continue; + if (pUnit->luminanceSize < configValue.luminanceSize) continue; + if (pUnit->alphaSize < configValue.alphaSize) continue; + if (pUnit->alphaMaskSize < configValue.alphaMaskSize) continue; + if (configValue.bindToTexRGB != EGL_DONT_CARE + && pUnit->bindToTexRGB != configValue.bindToTexRGB) continue; + if (configValue.bindToTexRGBA != EGL_DONT_CARE + && pUnit->bindToTexRGBA != configValue.bindToTexRGBA) continue; + if (pUnit->colorBufferType != configValue.colorBufferType) continue; + if (configValue.configCaveat != EGL_DONT_CARE + && pUnit->configCaveat != configValue.configCaveat) continue; + if (configValue.conformant != EGL_DONT_CARE + && (pUnit->conformant & configValue.conformant) == 0) continue; + if (pUnit->depthSize < configValue.depthSize) continue; + if (pUnit->level != configValue.level) continue; + if (configValue.maxSwapInterval != EGL_DONT_CARE + && pUnit->maxSwapInterval != configValue.maxSwapInterval) continue; + if (configValue.minSwapInterval != EGL_DONT_CARE + && pUnit->minSwapInterval != configValue.minSwapInterval) continue; + if (configValue.nativeRenderable != EGL_DONT_CARE + && pUnit->nativeRenderable != configValue.nativeRenderable) continue; + if (configValue.renderableType != EGL_DONT_CARE + && (pUnit->renderableType & configValue.renderableType) == 0) continue; + if (pUnit->sampleBuffers < configValue.sampleBuffers) continue; + if (pUnit->samples < configValue.samples) continue; + if (pUnit->stencilSize < configValue.stencilSize) continue; + if (pUnit->surfaceType & configValue.surfaceType == 0) continue; + if (pUnit->transparentType != configValue.transparentType) continue; + if (pUnit->transparentType != EGL_NONE + && pUnit->transparentRedValue != configValue.transparentRedValue) continue; + if (pUnit->transparentType != EGL_NONE + && pUnit->transparentGreenValue != configValue.transparentGreenValue) continue; + if (pUnit->transparentType != EGL_NONE + && pUnit->transparentBlueValue != configValue.transparentBlueValue) continue; + *pAnswer++ = pUnit; + nAnswer++; + } + int num = nAnswer; + if (configs == NULL) { + *num_config = num; + } else { + if (config_size < num) num = config_size; + if (num < 0) num = 0; + *num_config = num; + memcpy(configs, pDisplay->pConfigAnswer, num * sizeof(EGLConfig)); + } + return EGL_TRUE; +} diff --git a/egl_1_4/34GetConfigAttrib.c b/egl_1_4/34GetConfigAttrib.c new file mode 100755 index 0000000..37269e8 --- /dev/null +++ b/egl_1_4/34GetConfigAttrib.c @@ -0,0 +1,117 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * DongKyun Yun <dk77.yun@samsung.com> + * SangJin Kim <sangjin3.kim@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: + * - S-Core Co., Ltd + * + */ + +#include "implement.h" +#include <dlfcn.h> + +struct ConfigExtra* EGLINTER(LookUpConfig)(struct DisplayExtra* pDisplay, EGLConfig config) { + + struct ConfigExtra* pConfig = (struct ConfigExtra*)config; + struct ConfigExtra* pUnit = pDisplay->pConfigExtra; + int nCount = pDisplay->nConfigExtra; + while (nCount--) { + if (pConfig == pUnit) { + return pConfig; + } + pUnit++; + } + return NULL; +} + +EGLBoolean EGLAPIENTRY eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, + EGLint attribute, EGLint *value) { + struct DisplayExtra* pDisplay = EGLINTER(LookUpDisplay)(dpy); + if (pDisplay == NULL) { + EGLINTER(SetError)(EGL_BAD_DISPLAY); + return EGL_FALSE; + } + if (pDisplay->bInitialized == EGL_FALSE) { + EGLINTER(SetError)(EGL_NOT_INITIALIZED); + return EGL_FALSE; + } + struct ConfigExtra* pConfig = EGLINTER(LookUpConfig)(pDisplay, config); + if (pConfig == NULL) { + EGLINTER(SetError)(EGL_BAD_CONFIG); + return EGL_FALSE; + } + EGLint answer; + switch (attribute) { + case EGL_CONFIG_ID: answer = pConfig->unique; break; + case EGL_BUFFER_SIZE: answer = pConfig->bufferSize; break; + case EGL_RED_SIZE: answer = pConfig->redSize; break; + case EGL_GREEN_SIZE: answer = pConfig->greenSize; break; + case EGL_BLUE_SIZE: answer = pConfig->blueSize; break; + case EGL_LUMINANCE_SIZE: answer = pConfig->luminanceSize; break; + case EGL_ALPHA_SIZE: answer = pConfig->alphaSize; break; + case EGL_ALPHA_MASK_SIZE: answer = pConfig->alphaMaskSize; break; + case EGL_BIND_TO_TEXTURE_RGB: answer = pConfig->bindToTexRGB; break; + case EGL_BIND_TO_TEXTURE_RGBA: answer = pConfig->bindToTexRGBA; break; + case EGL_COLOR_BUFFER_TYPE: answer = pConfig->colorBufferType; break; + case EGL_CONFIG_CAVEAT: answer = pConfig->configCaveat; break; + case EGL_CONFORMANT: answer = pConfig->conformant; break; + case EGL_DEPTH_SIZE: answer = pConfig->depthSize; break; + case EGL_LEVEL: answer = pConfig->level; break; + case EGL_MAX_PBUFFER_WIDTH: answer = pConfig->maxPbufferWidth; break; + case EGL_MAX_PBUFFER_HEIGHT: answer = pConfig->maxPbufferHeight; break; + case EGL_MAX_PBUFFER_PIXELS: answer = pConfig->maxPbufferPixels; break; + case EGL_MAX_SWAP_INTERVAL: answer = pConfig->maxSwapInterval; break; + case EGL_MIN_SWAP_INTERVAL: answer = pConfig->minSwapInterval; break; + case EGL_NATIVE_RENDERABLE: answer = pConfig->nativeRenderable; break; + case EGL_NATIVE_VISUAL_ID: + { + XVisualInfo *vi; + XVisualInfo* (*fpGetVisualFromFBConfig)(Display*, GLXFBConfig) = NULL; + void* dl = dlopen("libGL.so", RTLD_NOW); + assert(dl != 0); + *(void**)(&fpGetVisualFromFBConfig) = dlsym(dl, "glXGetVisualFromFBConfig"); + assert(fpGetVisualFromFBConfig != NULL); + + vi = (*fpGetVisualFromFBConfig) (pDisplay->native, pConfig->native); + answer = vi->visualid; + break; + } + case EGL_NATIVE_VISUAL_TYPE: answer = pConfig->nativeVisualType; break; + case EGL_RENDERABLE_TYPE: answer = pConfig->renderableType; break; + case EGL_SAMPLE_BUFFERS: answer = pConfig->sampleBuffers; break; + case EGL_SAMPLES: answer = pConfig->samples; break; + case EGL_STENCIL_SIZE: answer = pConfig->stencilSize; break; + case EGL_SURFACE_TYPE: answer = pConfig->surfaceType; break; + case EGL_TRANSPARENT_TYPE: answer = pConfig->transparentType; break; + case EGL_TRANSPARENT_RED_VALUE: answer = pConfig->transparentRedValue; break; + case EGL_TRANSPARENT_GREEN_VALUE: answer = pConfig->transparentGreenValue; break; + case EGL_TRANSPARENT_BLUE_VALUE: answer = pConfig->transparentBlueValue; break; + default: + EGLINTER(SetError)(EGL_BAD_ATTRIBUTE); + return EGL_FALSE; + } + if (value != NULL) *value = answer; + return EGL_TRUE; +} diff --git a/egl_1_4/34GetConfigs.c b/egl_1_4/34GetConfigs.c new file mode 100755 index 0000000..700980a --- /dev/null +++ b/egl_1_4/34GetConfigs.c @@ -0,0 +1,197 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * DongKyun Yun <dk77.yun@samsung.com> + * SangJin Kim <sangjin3.kim@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: + * - S-Core Co., Ltd + * + */ + +#include "implement.h" + + +void EGLINTER(ConvertConfig)(struct DisplayExtra* pDisplay, + struct ConfigExtra* ptr, GLXFBConfig config) { + ptr->unique = EGLINTER(global).iConfigID++; + ptr->native = config; + int drawableType; + FNPTR(GetFBConfigAttrib)(pDisplay->native, config, GLX_DRAWABLE_TYPE, &drawableType); + ptr->surfaceType = 0; + if (drawableType & GLX_PBUFFER_BIT != 0) ptr->surfaceType |= EGL_PBUFFER_BIT; + if (drawableType & GLX_PIXMAP_BIT != 0) ptr->surfaceType |= EGL_PIXMAP_BIT; + if (drawableType & GLX_WINDOW_BIT != 0) ptr->surfaceType |= EGL_WINDOW_BIT; + ptr->bindToTexRGB = (ptr->surfaceType & EGL_PBUFFER_BIT != 0) ? EGL_TRUE : EGL_FALSE; + ptr->bindToTexRGBA = (ptr->surfaceType & EGL_PBUFFER_BIT != 0) ? EGL_TRUE : EGL_FALSE; + int configCaveat; + FNPTR(GetFBConfigAttrib)(pDisplay->native, config, GLX_CONFIG_CAVEAT, &configCaveat); + switch (configCaveat) { + case GLX_NONE: ptr->configCaveat = EGL_NONE; break; + case GLX_SLOW_CONFIG: ptr->configCaveat = EGL_SLOW_CONFIG; break; + case GLX_NON_CONFORMANT_CONFIG: ptr->configCaveat = EGL_NON_CONFORMANT_CONFIG; break; + default: assert(0); break; + } + int renderable; + FNPTR(GetFBConfigAttrib)(pDisplay->native, config, GLX_X_RENDERABLE, &renderable); + ptr->nativeRenderable = (renderable == True) ? EGL_TRUE : EGL_FALSE; + int transparentType; + FNPTR(GetFBConfigAttrib)(pDisplay->native, config, GLX_TRANSPARENT_TYPE, &transparentType); + ptr->transparentType = (transparentType == GLX_TRANSPARENT_RGB) ? EGL_TRANSPARENT_RGB : EGL_NONE; + FNPTR(GetFBConfigAttrib)(pDisplay->native, config, GLX_BUFFER_SIZE, &ptr->bufferSize); + FNPTR(GetFBConfigAttrib)(pDisplay->native, config, GLX_RED_SIZE, &ptr->redSize); + FNPTR(GetFBConfigAttrib)(pDisplay->native, config, GLX_GREEN_SIZE, &ptr->greenSize); + FNPTR(GetFBConfigAttrib)(pDisplay->native, config, GLX_BLUE_SIZE, &ptr->blueSize); + FNPTR(GetFBConfigAttrib)(pDisplay->native, config, GLX_ALPHA_SIZE, &ptr->alphaSize); + FNPTR(GetFBConfigAttrib)(pDisplay->native, config, GLX_DEPTH_SIZE, &ptr->depthSize); + FNPTR(GetFBConfigAttrib)(pDisplay->native, config, GLX_LEVEL, &ptr->level); + FNPTR(GetFBConfigAttrib)(pDisplay->native, config, GLX_MAX_PBUFFER_WIDTH, &ptr->maxPbufferWidth); + FNPTR(GetFBConfigAttrib)(pDisplay->native, config, GLX_MAX_PBUFFER_HEIGHT, &ptr->maxPbufferHeight); + FNPTR(GetFBConfigAttrib)(pDisplay->native, config, GLX_MAX_PBUFFER_PIXELS, &ptr->maxPbufferPixels); + FNPTR(GetFBConfigAttrib)(pDisplay->native, config, GLX_VISUAL_ID, (int*)&ptr->nativeVisualID); + FNPTR(GetFBConfigAttrib)(pDisplay->native, config, GLX_X_VISUAL_TYPE, (int*)&ptr->nativeVisualType); + FNPTR(GetFBConfigAttrib)(pDisplay->native, config, GLX_SAMPLE_BUFFERS, &ptr->sampleBuffers); + FNPTR(GetFBConfigAttrib)(pDisplay->native, config, GLX_SAMPLES, &ptr->samples); + FNPTR(GetFBConfigAttrib)(pDisplay->native, config, GLX_STENCIL_SIZE, &ptr->stencilSize); + FNPTR(GetFBConfigAttrib)(pDisplay->native, config, GLX_TRANSPARENT_RED_VALUE, &ptr->transparentRedValue); + FNPTR(GetFBConfigAttrib)(pDisplay->native, config, GLX_TRANSPARENT_GREEN_VALUE, &ptr->transparentGreenValue); + FNPTR(GetFBConfigAttrib)(pDisplay->native, config, GLX_TRANSPARENT_BLUE_VALUE, &ptr->transparentBlueValue); + ptr->luminanceSize = 0; + ptr->alphaMaskSize = 0; + ptr->colorBufferType = EGL_RGB_BUFFER; + ptr->conformant = EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT; + ptr->maxSwapInterval = 1000; + ptr->minSwapInterval = 0; + ptr->renderableType = EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT; +} + +int EGLAPIENTRY EGLINTER(PrepareConfig)(struct DisplayExtra* pDisplay) { + assert(pDisplay != NULL); + static int attribs_for_none[] = { + GLX_TRANSPARENT_TYPE, GLX_NONE, + GLX_DOUBLEBUFFER, True, + GLX_STEREO, False, + GLX_AUX_BUFFERS, 0, + GLX_ACCUM_RED_SIZE, 0, + GLX_ACCUM_GREEN_SIZE, 0, + GLX_ACCUM_BLUE_SIZE, 0, + GLX_ACCUM_ALPHA_SIZE, 0, + GLX_RENDER_TYPE, GLX_RGBA_BIT, + None, + }; + static int attribs_for_rgb[] = { + GLX_TRANSPARENT_TYPE, GLX_TRANSPARENT_RGB, + GLX_DOUBLEBUFFER, True, + GLX_STEREO, False, + GLX_AUX_BUFFERS, 0, + GLX_ACCUM_RED_SIZE, 0, + GLX_ACCUM_GREEN_SIZE, 0, + GLX_ACCUM_BLUE_SIZE, 0, + GLX_ACCUM_ALPHA_SIZE, 0, + GLX_RENDER_TYPE, GLX_RGBA_BIT, + None, + }; + struct ConfigExtra* pArea; + struct ConfigExtra* pUnit; + int nBytes; + int nTotalConfig = 0; + int nConfig; + int i; + pDisplay->pConfigBuffer = FNPTR(ChooseFBConfig)(pDisplay->native, + DefaultScreen(pDisplay->native), attribs_for_none, &nConfig); + if (nConfig > 0) { + nBytes = (pDisplay->nConfigExtra + nConfig) * sizeof(struct ConfigExtra); + if ((pArea = (struct ConfigExtra*)realloc(pDisplay->pConfigExtra, nBytes)) == NULL) { + EGLINTER(SetError)(EGL_BAD_ALLOC); + return 0; + } + pUnit = pArea + pDisplay->nConfigExtra; + pDisplay->nConfigExtra += nConfig; + pDisplay->pConfigExtra = pArea; + for (i = 0; i < nConfig; i++) { + EGLINTER(ConvertConfig)(pDisplay, pUnit, pDisplay->pConfigBuffer[i]); + pUnit++; + } + } + nTotalConfig = nConfig; + XFree(pDisplay->pConfigBuffer); + pDisplay->pConfigBuffer = NULL; + pDisplay->pConfigBuffer = FNPTR(ChooseFBConfig)(pDisplay->native, + DefaultScreen(pDisplay->native), attribs_for_rgb, &nConfig); + if (nConfig > 0) { + nBytes = (pDisplay->nConfigExtra + nConfig) * sizeof(struct ConfigExtra); + if ((pArea = (struct ConfigExtra*)realloc(pDisplay->pConfigExtra, nBytes)) == NULL) { + EGLINTER(SetError)(EGL_BAD_ALLOC); + return 0; + } + pUnit = pArea + pDisplay->nConfigExtra; + pDisplay->nConfigExtra += nConfig; + pDisplay->pConfigExtra = pArea; + for (i = 0; i < nConfig; i++) { + EGLINTER(ConvertConfig)(pDisplay, pUnit, pDisplay->pConfigBuffer[i]); + pUnit++; + } + } + nTotalConfig += nConfig; + XFree(pDisplay->pConfigBuffer); + pDisplay->pConfigBuffer = NULL; + nBytes = pDisplay->nConfigExtra * sizeof(EGLConfig); + EGLConfig* pAnswerArea; + if ((pAnswerArea = (EGLConfig*)realloc(pDisplay->pConfigAnswer, nBytes)) == NULL) { + EGLINTER(SetError)(EGL_BAD_ALLOC); + return 0; + } + pDisplay->pConfigAnswer = pAnswerArea; + assert(nTotalConfig > 0); + return nTotalConfig; +} + +EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, + EGLint config_size, EGLint *num_config) { + int i; + struct DisplayExtra* pDisplay = EGLINTER(LookUpDisplay)(dpy); + if (pDisplay == NULL) { + EGLINTER(SetError)(EGL_BAD_DISPLAY); + return EGL_FALSE; + } + if (pDisplay->bInitialized == EGL_FALSE) { + EGLINTER(SetError)(EGL_NOT_INITIALIZED); + return EGL_FALSE; + } + if (num_config == NULL) { + EGLINTER(SetError)(EGL_BAD_PARAMETER); + return EGL_FALSE; + } + int num = pDisplay->nConfigExtra; + if (configs == NULL) { + *num_config = num; + } else { + if (config_size < num) num = config_size; + if (num < 0) num = 0; + *num_config = num; + for (i = 0; i < num; i++) { + configs[i] = (EGLConfig)(pDisplay->pConfigExtra + i); + } + } + return EGL_TRUE; +} diff --git a/egl_1_4/35CreatePbufferFromClientBuffer.c b/egl_1_4/35CreatePbufferFromClientBuffer.c new file mode 100755 index 0000000..01c3fd1 --- /dev/null +++ b/egl_1_4/35CreatePbufferFromClientBuffer.c @@ -0,0 +1,122 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * DongKyun Yun <dk77.yun@samsung.com> + * SangJin Kim <sangjin3.kim@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: + * - S-Core Co., Ltd + * + */ + +#include "implement.h" + + +EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer(EGLDisplay dpy, + EGLenum buftype, EGLClientBuffer buffer, + EGLConfig config, const EGLint *attrib_list) { + struct DisplayExtra* pDisplay = EGLINTER(LookUpDisplay)(dpy); + if (pDisplay == NULL) { + EGLINTER(SetError)(EGL_BAD_DISPLAY); + return EGL_NO_SURFACE; + } + if (pDisplay->bInitialized == EGL_FALSE) { + EGLINTER(SetError)(EGL_NOT_INITIALIZED); + return EGL_NO_SURFACE; + } + struct ConfigExtra* pConfig = EGLINTER(LookUpConfig)(pDisplay, config); + if (pConfig == NULL) { + EGLINTER(SetError)(EGL_BAD_CONFIG); + return EGL_NO_SURFACE; + } + if (pConfig->surfaceType & EGL_PBUFFER_BIT == 0) { + EGLINTER(SetError)(EGL_BAD_MATCH); + return EGL_NO_SURFACE; + } + if (buftype != EGL_OPENVG_IMAGE) { + EGLINTER(SetError)(EGL_BAD_PARAMETER); + return EGL_NO_SURFACE; + } + struct SurfaceExtra surfaceValue; + memcpy(&surfaceValue, &surfaceExtraDefault, sizeof(struct SurfaceExtra)); + surfaceValue.renderBuffer = EGL_BACK_BUFFER; + int buf[32]; + int* ptr = &buf[0]; + while (attrib_list && *attrib_list != EGL_NONE) { + switch (*attrib_list++) { + case EGL_WIDTH: + *ptr++ = GLX_WIDTH; + *ptr++ = *attrib_list++; + break; + case EGL_HEIGHT: + *ptr++ = GLX_HEIGHT; + *ptr++ = *attrib_list++; + break; + case EGL_TEXTURE_FORMAT: + if (*attrib_list == EGL_NO_TEXTURE || *attrib_list == EGL_TEXTURE_RGB + || *attrib_list == EGL_TEXTURE_RGBA) { + surfaceValue.textureFormat = *attrib_list++; + } else { + EGLINTER(SetError)(EGL_BAD_PARAMETER); + return EGL_NO_SURFACE; + } + break; + case EGL_TEXTURE_TARGET: + if (*attrib_list == EGL_NO_TEXTURE || *attrib_list == EGL_TEXTURE_2D) { + surfaceValue.textureFormat = *attrib_list++; + } else { + EGLINTER(SetError)(EGL_BAD_PARAMETER); + return EGL_NO_SURFACE; + } + break; + case EGL_MIPMAP_TEXTURE: + surfaceValue.mipmapTexture = (*attrib_list++ == EGL_FALSE) ? EGL_FALSE : EGL_TRUE; + break; + case EGL_VG_ALPHA_FORMAT: + if (*attrib_list == EGL_VG_ALPHA_FORMAT_NONPRE + || *attrib_list == EGL_VG_ALPHA_FORMAT_PRE) { + surfaceValue.vgAlphaFormat = *attrib_list++; + } else { + EGLINTER(SetError)(EGL_BAD_PARAMETER); + return EGL_NO_SURFACE; + } + break; + case EGL_VG_COLORSPACE: + if (*attrib_list == EGL_VG_COLORSPACE_sRGB + || *attrib_list == EGL_VG_COLORSPACE_LINEAR) { + surfaceValue.vgColorSpace = *attrib_list++; + } else { + EGLINTER(SetError)(EGL_BAD_PARAMETER); + return EGL_NO_SURFACE; + } + break; + default: + EGLINTER(SetError)(EGL_BAD_ATTRIBUTE); + return EGL_NO_SURFACE; + } + } + *ptr = None; + + EGLINTER(SetError)(EGL_BAD_SURFACE); + return EGL_NO_SURFACE; +} diff --git a/egl_1_4/35CreatePbufferSurface.c b/egl_1_4/35CreatePbufferSurface.c new file mode 100755 index 0000000..7771c0a --- /dev/null +++ b/egl_1_4/35CreatePbufferSurface.c @@ -0,0 +1,139 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * DongKyun Yun <dk77.yun@samsung.com> + * SangJin Kim <sangjin3.kim@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: + * - S-Core Co., Ltd + * + */ + +#include "implement.h" + + +EGLSurface EGLAPIENTRY eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, + const EGLint *attrib_list) { + struct DisplayExtra* pDisplay = EGLINTER(LookUpDisplay)(dpy); + if (pDisplay == NULL) { + EGLINTER(SetError)(EGL_BAD_DISPLAY); + return EGL_NO_SURFACE; + } + if (pDisplay->bInitialized == EGL_FALSE) { + EGLINTER(SetError)(EGL_NOT_INITIALIZED); + return EGL_NO_SURFACE; + } + struct ConfigExtra* pConfig = EGLINTER(LookUpConfig)(pDisplay, config); + if (pConfig == NULL) { + EGLINTER(SetError)(EGL_BAD_CONFIG); + return EGL_NO_SURFACE; + } + if (pConfig->surfaceType & EGL_PBUFFER_BIT == 0) { + EGLINTER(SetError)(EGL_BAD_MATCH); + return EGL_NO_SURFACE; + } + struct SurfaceExtra surfaceValue; + memcpy(&surfaceValue, &surfaceExtraDefault, sizeof(struct SurfaceExtra)); + surfaceValue.renderBuffer = EGL_BACK_BUFFER; + int buf[32]; + int* ptr = &buf[0]; + while (attrib_list && *attrib_list != EGL_NONE) { + switch (*attrib_list++) { + case EGL_WIDTH: + *ptr++ = GLX_WIDTH; + *ptr++ = *attrib_list++; + break; + case EGL_HEIGHT: + *ptr++ = GLX_HEIGHT; + *ptr++ = *attrib_list++; + break; + case EGL_LARGEST_PBUFFER: + *ptr++ = GLX_LARGEST_PBUFFER; + *ptr++ = (*attrib_list++ == EGL_FALSE) ? False : True; + break; + case EGL_TEXTURE_FORMAT: + if (*attrib_list == EGL_NO_TEXTURE || *attrib_list == EGL_TEXTURE_RGB + || *attrib_list == EGL_TEXTURE_RGBA) { + surfaceValue.textureFormat = *attrib_list++; + } else { + EGLINTER(SetError)(EGL_BAD_PARAMETER); + return EGL_NO_SURFACE; + } + break; + case EGL_TEXTURE_TARGET: + if (*attrib_list == EGL_NO_TEXTURE || *attrib_list == EGL_TEXTURE_2D) { + surfaceValue.textureFormat = *attrib_list++; + } else { + EGLINTER(SetError)(EGL_BAD_PARAMETER); + return EGL_NO_SURFACE; + } + break; + case EGL_MIPMAP_TEXTURE: + surfaceValue.mipmapTexture = (*attrib_list++ == EGL_FALSE) ? EGL_FALSE : EGL_TRUE; + break; + case EGL_VG_ALPHA_FORMAT: + if (*attrib_list == EGL_VG_ALPHA_FORMAT_NONPRE + || *attrib_list == EGL_VG_ALPHA_FORMAT_PRE) { + surfaceValue.vgAlphaFormat = *attrib_list++; + } else { + EGLINTER(SetError)(EGL_BAD_PARAMETER); + return EGL_NO_SURFACE; + } + break; + case EGL_VG_COLORSPACE: + if (*attrib_list == EGL_VG_COLORSPACE_sRGB + || *attrib_list == EGL_VG_COLORSPACE_LINEAR) { + surfaceValue.vgColorSpace = *attrib_list++; + } else { + EGLINTER(SetError)(EGL_BAD_PARAMETER); + return EGL_NO_SURFACE; + } + break; + default: + EGLINTER(SetError)(EGL_BAD_ATTRIBUTE); + return EGL_NO_SURFACE; + } + } + *ptr = None; + 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_MATCH); + return EGL_NO_SURFACE; + } + return (EGLSurface)(pSurface->native); +} diff --git a/egl_1_4/35CreatePixmapSurface.c b/egl_1_4/35CreatePixmapSurface.c new file mode 100755 index 0000000..a1285e9 --- /dev/null +++ b/egl_1_4/35CreatePixmapSurface.c @@ -0,0 +1,107 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * DongKyun Yun <dk77.yun@samsung.com> + * SangJin Kim <sangjin3.kim@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: + * - S-Core Co., Ltd + * + */ + +#include "implement.h" + + +EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, + EGLNativePixmapType pixmap, const EGLint *attrib_list) { + struct DisplayExtra* pDisplay = EGLINTER(LookUpDisplay)(dpy); + if (pDisplay == NULL) { + EGLINTER(SetError)(EGL_BAD_DISPLAY); + return EGL_NO_SURFACE; + } + if (pDisplay->bInitialized == EGL_FALSE) { + EGLINTER(SetError)(EGL_NOT_INITIALIZED); + return EGL_NO_SURFACE; + } + struct ConfigExtra* pConfig = EGLINTER(LookUpConfig)(pDisplay, config); + if (pConfig == NULL) { + EGLINTER(SetError)(EGL_BAD_CONFIG); + return EGL_NO_SURFACE; + } + if (pConfig->surfaceType & EGL_PIXMAP_BIT == 0) { + EGLINTER(SetError)(EGL_BAD_MATCH); + return EGL_NO_SURFACE; + } + + + struct SurfaceExtra surfaceValue; + memcpy(&surfaceValue, &surfaceExtraDefault, sizeof(struct SurfaceExtra)); + surfaceValue.renderBuffer = EGL_SINGLE_BUFFER; + while (attrib_list && *attrib_list != EGL_NONE) { + switch (*attrib_list++) { + case EGL_VG_COLORSPACE: + if (*attrib_list == EGL_VG_COLORSPACE_sRGB + || *attrib_list == EGL_VG_COLORSPACE_LINEAR) { + surfaceValue.vgColorSpace = *attrib_list++; + } else { + EGLINTER(SetError)(EGL_BAD_PARAMETER); + return EGL_NO_SURFACE; + } + break; + case EGL_VG_ALPHA_FORMAT: + if (*attrib_list == EGL_VG_ALPHA_FORMAT_NONPRE + || *attrib_list == EGL_VG_ALPHA_FORMAT_PRE) { + surfaceValue.vgAlphaFormat = *attrib_list++; + } else { + EGLINTER(SetError)(EGL_BAD_PARAMETER); + return EGL_NO_SURFACE; + } + break; + default: + EGLINTER(SetError)(EGL_BAD_ATTRIBUTE); + return EGL_NO_SURFACE; + } + } + GLXPixmap native = FNPTR(CreatePixmap)(pDisplay->native, pConfig->native, pixmap, NULL); + 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->lowWinPix = pixmap; + pSurface->display = dpy; + pSurface->config = config; + pSurface->type = EGL_PIXMAP_BIT; + } else { + + EGLINTER(SetError)(EGL_BAD_MATCH); + return EGL_NO_SURFACE; + } + return (EGLSurface)(pSurface->native); +} diff --git a/egl_1_4/35CreateWindowSurface.c b/egl_1_4/35CreateWindowSurface.c new file mode 100755 index 0000000..60f9cce --- /dev/null +++ b/egl_1_4/35CreateWindowSurface.c @@ -0,0 +1,127 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * DongKyun Yun <dk77.yun@samsung.com> + * SangJin Kim <sangjin3.kim@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: + * - S-Core Co., Ltd + * + */ + +#include "implement.h" + + +struct SurfaceExtra surfaceExtraDefault = { + NULL, (GLXDrawable)NULL, (Drawable)NULL, + NULL, NULL, + 0, + EGL_NO_TEXTURE, EGL_NO_TEXTURE, EGL_FALSE, 0, + EGL_BACK_BUFFER, + EGL_VG_ALPHA_FORMAT_PRE, EGL_VG_COLORSPACE_LINEAR, + EGL_BUFFER_DESTROYED, EGL_MULTISAMPLE_RESOLVE_DEFAULT, +}; + + +EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, + EGLNativeWindowType win, const EGLint *attrib_list) { + struct DisplayExtra* pDisplay = EGLINTER(LookUpDisplay)(dpy); + if (pDisplay == NULL) { + EGLINTER(SetError)(EGL_BAD_DISPLAY); + return EGL_NO_SURFACE; + } + if (pDisplay->bInitialized == EGL_FALSE) { + EGLINTER(SetError)(EGL_NOT_INITIALIZED); + return EGL_NO_SURFACE; + } + struct ConfigExtra* pConfig = EGLINTER(LookUpConfig)(pDisplay, config); + if (pConfig == NULL) { + EGLINTER(SetError)(EGL_BAD_CONFIG); + return EGL_NO_SURFACE; + } + if ((pConfig->surfaceType & EGL_WINDOW_BIT) == 0) { + EGLINTER(SetError)(EGL_BAD_MATCH); + return EGL_NO_SURFACE; + } + + + struct SurfaceExtra surfaceValue; + memcpy(&surfaceValue, &surfaceExtraDefault, sizeof(struct SurfaceExtra)); + while (attrib_list && *attrib_list != EGL_NONE) { + switch (*attrib_list++) { + case EGL_RENDER_BUFFER: + if (*attrib_list == EGL_BACK_BUFFER) { + surfaceValue.renderBuffer = *attrib_list++; + } else if (*attrib_list == EGL_SINGLE_BUFFER) { + /* + EGLINTER(SetError)(EGL_BAD_MATCH); + return EGL_NO_SURFACE; + */ + } else { + EGLINTER(SetError)(EGL_BAD_PARAMETER); + return EGL_NO_SURFACE; + } + case EGL_VG_COLORSPACE: + if (*attrib_list == EGL_VG_COLORSPACE_sRGB || *attrib_list == EGL_VG_COLORSPACE_LINEAR) { + surfaceValue.vgColorSpace = *attrib_list++; + } else { + EGLINTER(SetError)(EGL_BAD_PARAMETER); + return EGL_NO_SURFACE; + } + break; + case EGL_VG_ALPHA_FORMAT: + if (*attrib_list == EGL_VG_ALPHA_FORMAT_NONPRE || *attrib_list == EGL_VG_ALPHA_FORMAT_PRE) { + surfaceValue.vgAlphaFormat = *attrib_list++; + } else { + EGLINTER(SetError)(EGL_BAD_PARAMETER); + return EGL_NO_SURFACE; + } + break; + default: + EGLINTER(SetError)(EGL_BAD_ATTRIBUTE); + return EGL_NO_SURFACE; + } + } + GLXWindow native = FNPTR(CreateWindow)(pDisplay->native, pConfig->native, win, NULL); + 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->lowWinPix = win; + pSurface->display = dpy; + pSurface->config = config; + pSurface->type = EGL_WINDOW_BIT; + } else { + + EGLINTER(SetError)(EGL_BAD_MATCH); + return EGL_NO_SURFACE; + } + return (EGLSurface)(pSurface->native); +} diff --git a/egl_1_4/35DestroySurface.c b/egl_1_4/35DestroySurface.c new file mode 100755 index 0000000..5bae4f2 --- /dev/null +++ b/egl_1_4/35DestroySurface.c @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * DongKyun Yun <dk77.yun@samsung.com> + * SangJin Kim <sangjin3.kim@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: + * - S-Core Co., Ltd + * + */ + +#include "implement.h" + + +EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay dpy, EGLSurface surface) { + struct DisplayExtra* pDisplay = EGLINTER(LookUpDisplay)(dpy); + if (pDisplay == NULL) { + EGLINTER(SetError)(EGL_BAD_DISPLAY); + return EGL_FALSE; + } + if (pDisplay->bInitialized == EGL_FALSE) { + EGLINTER(SetError)(EGL_NOT_INITIALIZED); + return EGL_FALSE; + } + struct SurfaceExtra* pSurface = EGLINTER(LookUpSurface)(surface); + if (pSurface == NULL) { + EGLINTER(SetError)(EGL_BAD_SURFACE); + return EGL_FALSE; + } + if (pSurface->display != pDisplay->unique) { + EGLINTER(SetError)(EGL_BAD_SURFACE); + return EGL_FALSE; + } + + FNPTR(DestroyWindow)(pDisplay->native, pSurface->native); + EGLINTER(DeleteSurface)(surface); + return EGL_TRUE; +} diff --git a/egl_1_4/36BindTexImage.c b/egl_1_4/36BindTexImage.c new file mode 100755 index 0000000..c6fd366 --- /dev/null +++ b/egl_1_4/36BindTexImage.c @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * DongKyun Yun <dk77.yun@samsung.com> + * SangJin Kim <sangjin3.kim@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: + * - S-Core Co., Ltd + * + */ + +#include "implement.h" + + +EGLBoolean EGLAPIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) { + struct DisplayExtra* pDisplay = EGLINTER(LookUpDisplay)(dpy); + if (pDisplay == NULL) { + EGLINTER(SetError)(EGL_BAD_DISPLAY); + return EGL_FALSE; + } + if (pDisplay->bInitialized == EGL_FALSE) { + EGLINTER(SetError)(EGL_NOT_INITIALIZED); + return EGL_FALSE; + } + struct SurfaceExtra* pSurface = EGLINTER(LookUpSurface)(surface); + if (pSurface == NULL) { + EGLINTER(SetError)(EGL_BAD_SURFACE); + return EGL_FALSE; + } + /* TODO */ + /* TODO */ + FNPTR(BindTexImageARB)(pDisplay->native, pSurface->native, buffer ); + return EGL_TRUE; +} diff --git a/egl_1_4/36QuerySurface.c b/egl_1_4/36QuerySurface.c new file mode 100755 index 0000000..05e1101 --- /dev/null +++ b/egl_1_4/36QuerySurface.c @@ -0,0 +1,133 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * DongKyun Yun <dk77.yun@samsung.com> + * SangJin Kim <sangjin3.kim@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: + * - S-Core Co., Ltd + * + */ + +#include "implement.h" + + +EGLBoolean EGLAPIENTRY eglQuerySurface(EGLDisplay dpy, EGLSurface surface, + EGLint attribute, EGLint *value) { + struct DisplayExtra* pDisplay = EGLINTER(LookUpDisplay)(dpy); + if (pDisplay == NULL) { + EGLINTER(SetError)(EGL_BAD_DISPLAY); + return EGL_FALSE; + } + if (pDisplay->bInitialized == EGL_FALSE) { + EGLINTER(SetError)(EGL_NOT_INITIALIZED); + return EGL_FALSE; + } + struct SurfaceExtra* pSurface = EGLINTER(LookUpSurface)(surface); + if (pSurface == NULL) { + EGLINTER(SetError)(EGL_BAD_SURFACE); + return EGL_FALSE; + } + if (pSurface->display != pDisplay->unique) { + EGLINTER(SetError)(EGL_BAD_SURFACE); + return EGL_FALSE; + } + EGLint answer; + switch (attribute) { + case EGL_CONFIG_ID: + answer = ((struct ConfigExtra*)(pSurface->config))->unique; + break; + case EGL_HEIGHT: + FNPTR(QueryDrawable)(pDisplay->native, pSurface->native, GLX_HEIGHT, + (unsigned int*)&answer); + break; + case EGL_WIDTH: + FNPTR(QueryDrawable)(pDisplay->native, pSurface->native, GLX_WIDTH, + (unsigned int*)&answer); + break; + case EGL_LARGEST_PBUFFER: + FNPTR(QueryDrawable)(pDisplay->native, pSurface->native, GLX_LARGEST_PBUFFER, + (unsigned int*)&answer); + break; + case EGL_TEXTURE_FORMAT: + answer = pSurface->textureFormat; + break; + case EGL_TEXTURE_TARGET: + answer = pSurface->textureTarget; + break; + case EGL_MIPMAP_TEXTURE: + answer = pSurface->mipmapTexture; + break; + case EGL_MIPMAP_LEVEL: + answer = pSurface->mipmapLevel; + break; + case EGL_RENDER_BUFFER: + answer = pSurface->renderBuffer; + break; + case EGL_VG_COLORSPACE: + answer = pSurface->vgColorSpace; + break; + case EGL_VG_ALPHA_FORMAT: + answer = pSurface->vgAlphaFormat; + break; + case EGL_HORIZONTAL_RESOLUTION: + if (pSurface->type == EGL_WINDOW_BIT) { + answer = EGL_DISPLAY_SCALING * 1000 + * DisplayWidth(pDisplay->native, DefaultScreen(pDisplay->native)) + / DisplayWidthMM(pDisplay->native, DefaultScreen(pDisplay->native)); + } else { + answer = EGL_UNKNOWN; + } + break; + case EGL_VERTICAL_RESOLUTION: + if (pSurface->type == EGL_WINDOW_BIT) { + answer = EGL_DISPLAY_SCALING * 1000 + * DisplayHeight(pDisplay->native, DefaultScreen(pDisplay->native)) + / DisplayHeightMM(pDisplay->native, DefaultScreen(pDisplay->native)); + } else { + answer = EGL_UNKNOWN; + } + break; + case EGL_PIXEL_ASPECT_RATIO: + if (pSurface->type == EGL_WINDOW_BIT) { + answer = EGL_DISPLAY_SCALING + * DisplayWidthMM(pDisplay->native, DefaultScreen(pDisplay->native)) + / DisplayHeightMM(pDisplay->native, DefaultScreen(pDisplay->native)); + } else { + answer = EGL_UNKNOWN; + } + break; + case EGL_SWAP_BEHAVIOR: + answer = pSurface->swapBehavior; + break; + case EGL_MULTISAMPLE_RESOLVE: + answer = pSurface->multisampleResolve; + break; + default: + EGLINTER(SetError)(EGL_BAD_ATTRIBUTE); + return EGL_FALSE; + break; + } + if (value != NULL) *value = answer; + return EGL_TRUE; +} diff --git a/egl_1_4/36ReleaseTexImage.c b/egl_1_4/36ReleaseTexImage.c new file mode 100755 index 0000000..50fd983 --- /dev/null +++ b/egl_1_4/36ReleaseTexImage.c @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * DongKyun Yun <dk77.yun@samsung.com> + * SangJin Kim <sangjin3.kim@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: + * - S-Core Co., Ltd + * + */ + +#include "implement.h" + + +EGLBoolean EGLAPIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) { + struct DisplayExtra* pDisplay = EGLINTER(LookUpDisplay)(dpy); + if (pDisplay == NULL) { + EGLINTER(SetError)(EGL_BAD_DISPLAY); + return EGL_FALSE; + } + if (pDisplay->bInitialized == EGL_FALSE) { + EGLINTER(SetError)(EGL_NOT_INITIALIZED); + return EGL_FALSE; + } + struct SurfaceExtra* pSurface = EGLINTER(LookUpSurface)(surface); + if (pSurface == NULL) { + EGLINTER(SetError)(EGL_BAD_SURFACE); + return EGL_FALSE; + } + /* TODO */ + /* TODO */ + FNPTR(ReleaseTexImageARB)(pDisplay->native, pSurface->native, buffer); + return EGL_TRUE; +} diff --git a/egl_1_4/36SurfaceAttrib.c b/egl_1_4/36SurfaceAttrib.c new file mode 100755 index 0000000..c46915e --- /dev/null +++ b/egl_1_4/36SurfaceAttrib.c @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * DongKyun Yun <dk77.yun@samsung.com> + * SangJin Kim <sangjin3.kim@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: + * - S-Core Co., Ltd + * + */ + +#include "implement.h" + + +EGLBoolean EGLAPIENTRY eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, + EGLint attribute, EGLint value) { + struct DisplayExtra* pDisplay = EGLINTER(LookUpDisplay)(dpy); + if (pDisplay == NULL) { + EGLINTER(SetError)(EGL_BAD_DISPLAY); + return EGL_FALSE; + } + if (pDisplay->bInitialized == EGL_FALSE) { + EGLINTER(SetError)(EGL_NOT_INITIALIZED); + return EGL_FALSE; + } + struct SurfaceExtra* pSurface = EGLINTER(LookUpSurface)(surface); + if (pSurface == NULL) { + EGLINTER(SetError)(EGL_BAD_SURFACE); + return EGL_FALSE; + } + if (pSurface->display != pDisplay->unique) { + EGLINTER(SetError)(EGL_BAD_SURFACE); + return EGL_FALSE; + } + switch (attribute) { + case EGL_MIPMAP_LEVEL: + pSurface->mipmapLevel = value; + break; + case EGL_SWAP_BEHAVIOR: + if (value == EGL_BUFFER_PRESERVED || value == EGL_BUFFER_DESTROYED) { + pSurface->swapBehavior = value; + } else { + EGLINTER(SetError)(EGL_BAD_PARAMETER); + return EGL_FALSE; + } + break; + case EGL_MULTISAMPLE_RESOLVE: + if (value == EGL_MULTISAMPLE_RESOLVE_DEFAULT || value == EGL_MULTISAMPLE_RESOLVE_BOX) { + pSurface->multisampleResolve = value; + } else { + EGLINTER(SetError)(EGL_BAD_PARAMETER); + return EGL_FALSE; + } + break; + default: + EGLINTER(SetError)(EGL_BAD_ATTRIBUTE); + return EGL_FALSE; + break; + } + return EGL_TRUE; +} diff --git a/egl_1_4/37BindAPI.c b/egl_1_4/37BindAPI.c new file mode 100755 index 0000000..e2db5a2 --- /dev/null +++ b/egl_1_4/37BindAPI.c @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * DongKyun Yun <dk77.yun@samsung.com> + * SangJin Kim <sangjin3.kim@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: + * - S-Core Co., Ltd + * + */ + +#include "implement.h" + + +EGLBoolean EGLAPIENTRY eglBindAPI(EGLenum api) { + switch (api) { +#if defined(PROVIDING_RUNTIME_BINDING) + case EGL_OPENGL_API: + case EGL_OPENGL_ES_API: + case EGL_OPENVG_API: + EGLINTER(global).currentAPI = api; + break; +#else + case EGL_OPENGL_ES_API: + EGLINTER(global).currentAPI = api; + return EGL_TRUE; + case EGL_OPENGL_API: + case EGL_OPENVG_API: +#endif + default: + EGLINTER(SetError)(EGL_BAD_PARAMETER); + return EGL_FALSE; + } +} + diff --git a/egl_1_4/37CreateContext.c b/egl_1_4/37CreateContext.c new file mode 100755 index 0000000..5ab239e --- /dev/null +++ b/egl_1_4/37CreateContext.c @@ -0,0 +1,173 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * DongKyun Yun <dk77.yun@samsung.com> + * SangJin Kim <sangjin3.kim@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: + * - S-Core Co., Ltd + * + */ + +#include "implement.h" +#include <dlfcn.h> + + +EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config, + EGLContext share_context, const EGLint *attrib_list) { + void* (*fpVGCreateContext)(void*) = NULL;//jcpark +#if defined(PROVIDING_RUNTIME_BINDING) + void* (*fpCreateContext)(void) = NULL; +#endif + EGLint apiVersion = 1; + struct DisplayExtra* pDisplay = EGLINTER(LookUpDisplay)(dpy); + if (pDisplay == NULL) { + EGLINTER(SetError)(EGL_BAD_DISPLAY); + return EGL_NO_CONTEXT; + } + if (pDisplay->bInitialized == EGL_FALSE) { + EGLINTER(SetError)(EGL_NOT_INITIALIZED); + return EGL_NO_CONTEXT; + } + struct ConfigExtra* pConfig = EGLINTER(LookUpConfig)(pDisplay, config); + if (pConfig == NULL) { + EGLINTER(SetError)(EGL_BAD_CONFIG); + return EGL_NO_CONTEXT; + } + struct ContextExtra* pShare = NULL; + if (share_context != EGL_NO_CONTEXT) { + pShare = EGLINTER(LookUpContext)(share_context); + if (pShare == NULL) { + EGLINTER(SetError)(EGL_BAD_CONTEXT); + return EGL_NO_CONTEXT; + } + } + while ((attrib_list != NULL) && (*attrib_list != EGL_NONE)) { + switch (*attrib_list) { + case EGL_CONTEXT_CLIENT_VERSION: + if (EGLINTER(global).currentAPI != EGL_OPENGL_ES_API) { + EGLINTER(SetError)(EGL_BAD_ATTRIBUTE); + return; + } + apiVersion = *(attrib_list + 1); + switch (apiVersion) { + default: + EGLINTER(SetError)(EGL_BAD_ATTRIBUTE); + return; + case 1: + if ((pConfig->renderableType & EGL_OPENGL_ES_BIT) == 0) { + EGLINTER(SetError)(EGL_BAD_ATTRIBUTE); + return; + } + break; + case 2: + if ((pConfig->renderableType & EGL_OPENGL_ES2_BIT) == 0) { + EGLINTER(SetError)(EGL_BAD_ATTRIBUTE); + return; + } + break; + } + attrib_list++; + break; + default: + EGLINTER(SetError)(EGL_BAD_ATTRIBUTE); + return EGL_NO_CONTEXT; + } + attrib_list++; + } + GLXContext native = FNPTR(CreateNewContext)(pDisplay->native, pConfig->native, + GLX_RGBA_TYPE, (pShare == NULL) ? NULL : pShare->native, True); + EGLContext unique = (EGLContext)(native); + struct ContextExtra* pContext = EGLINTER(LookUpContext)(unique); + if (pContext == NULL) { + pContext = EGLINTER(InsertContext)(unique); + if (pContext == NULL) { + EGLINTER(SetError)(EGL_BAD_ALLOC); + return EGL_NO_CONTEXT; + } + pContext->native = native; + pContext->display = dpy; + pContext->config = config; + pContext->renderBuffer = EGL_NONE; + pContext->apiKind = EGLINTER(global).currentAPI; + pContext->apiVersion = apiVersion; + switch (pContext->apiKind) { + default: + case EGL_OPENGL_API: + 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; + } + } + fpCreateContext = dlsym(EGLINTER(global).dlES2, EGLCROSS_PREFIX "CreateContext"); + if (fpCreateContext != NULL) { + pContext->apiContext = (*fpCreateContext)(); + } + } 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; + } + } + fpCreateContext = dlsym(EGLINTER(global).dlES1, EGLCROSS_PREFIX "CreateContext"); + if (fpCreateContext != NULL) { + pContext->apiContext = (*fpCreateContext)(); + } + } + break; +#else + case EGL_OPENGL_ES_API: + pContext->apiContext = EGLCROSS(CreateContext)(); + break; +#endif + case EGL_OPENVG_API: + /* TODO: OpenVG may need some action here */ //jcpark + if (EGLINTER(global).dlVG == NULL) { + if ((EGLINTER(global).dlVG = dlopen(VG_SO_FILENAME, RTLD_NOW | RTLD_GLOBAL)) + == NULL) { + EGLINTER(SetError)(EGL_BAD_ACCESS); + return; + } + } + fpVGCreateContext = dlsym(EGLINTER(global).dlVG, "vg4egl_CreateContext"); + if (fpVGCreateContext != NULL) { + pContext->apiContext = (*fpVGCreateContext)(NULL); + } + break; + } + } else { + + 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 new file mode 100755 index 0000000..1d9b22c --- /dev/null +++ b/egl_1_4/37DestroyContext.c @@ -0,0 +1,120 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * DongKyun Yun <dk77.yun@samsung.com> + * SangJin Kim <sangjin3.kim@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: + * - S-Core Co., Ltd + * + */ + +#include "implement.h" +#include <dlfcn.h> + + +EGLBoolean EGLAPIENTRY eglDestroyContext(EGLDisplay dpy, EGLContext ctx) { +void (*fpVGReleaseContext)(void*) = NULL;//jcpark +#if defined(PROVIDING_RUNTIME_BINDING) + void (*fpReleaseContext)(void*) = NULL; +#endif + struct DisplayExtra* pDisplay = EGLINTER(LookUpDisplay)(dpy); + if (pDisplay == NULL) { + EGLINTER(SetError)(EGL_BAD_DISPLAY); + return EGL_FALSE; + } + if (pDisplay->bInitialized == EGL_FALSE) { + 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; + } + FNPTR(DestroyContext)(pDisplay->native, pContext->native); + EGLINTER(DeleteContext)(ctx); + + return EGL_TRUE; +} diff --git a/egl_1_4/37GetCurrentContext.c b/egl_1_4/37GetCurrentContext.c new file mode 100755 index 0000000..e9b1a68 --- /dev/null +++ b/egl_1_4/37GetCurrentContext.c @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * DongKyun Yun <dk77.yun@samsung.com> + * SangJin Kim <sangjin3.kim@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: + * - S-Core Co., Ltd + * + */ + +#include "implement.h" + + +EGLContext EGLAPIENTRY eglGetCurrentContext(void) { + if (!FNPTR(GetCurrentContext)) + return EGL_NO_CONTEXT; + + GLXContext native = FNPTR(GetCurrentContext)(); + if (native == NULL) { + return EGL_NO_CONTEXT; + } + if (EGLINTER(global).currentAPI == EGL_NONE) { + return EGL_NO_CONTEXT; + } + EGLContext unique = (EGLContext)(native); + if (EGLINTER(LookUpContext)(unique) == NULL) { + return EGL_NO_CONTEXT; + } + return unique; +} diff --git a/egl_1_4/37GetCurrentDisplay.c b/egl_1_4/37GetCurrentDisplay.c new file mode 100755 index 0000000..db81a70 --- /dev/null +++ b/egl_1_4/37GetCurrentDisplay.c @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * DongKyun Yun <dk77.yun@samsung.com> + * SangJin Kim <sangjin3.kim@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: + * - S-Core Co., Ltd + * + */ + +#include "implement.h" + + +EGLDisplay EGLAPIENTRY eglGetCurrentDisplay(void) { + EGLNativeDisplayType native = FNPTR(GetCurrentDisplay)(); + if (native == NULL) { + return EGL_NO_DISPLAY; + } + EGLDisplay unique = (EGLDisplay)(native); + if (EGLINTER(LookUpDisplay)(unique) == NULL) { + return EGL_NO_DISPLAY; + } + return unique; +} diff --git a/egl_1_4/37GetCurrentSurface.c b/egl_1_4/37GetCurrentSurface.c new file mode 100755 index 0000000..70593bb --- /dev/null +++ b/egl_1_4/37GetCurrentSurface.c @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * DongKyun Yun <dk77.yun@samsung.com> + * SangJin Kim <sangjin3.kim@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: + * - S-Core Co., Ltd + * + */ + +#include "implement.h" + + +EGLSurface EGLAPIENTRY eglGetCurrentSurface(EGLint readdraw) { + GLXDrawable native; + switch (readdraw) { + case EGL_READ: + native = FNPTR(GetCurrentReadDrawable)(); + break; + case EGL_DRAW: + native = FNPTR(GetCurrentDrawable)(); + break; + default: + EGLINTER(SetError)(EGL_BAD_PARAMETER); + return EGL_NO_SURFACE; + break; + } + if (native == None) { + return EGL_NO_SURFACE; + } + EGLSurface unique = (EGLSurface)(native); + if (EGLINTER(LookUpSurface)(unique) == NULL) { + return EGL_NO_SURFACE; + } + return unique; +} diff --git a/egl_1_4/37MakeCurrent.c b/egl_1_4/37MakeCurrent.c new file mode 100755 index 0000000..ee19e5d --- /dev/null +++ b/egl_1_4/37MakeCurrent.c @@ -0,0 +1,280 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * DongKyun Yun <dk77.yun@samsung.com> + * SangJin Kim <sangjin3.kim@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: + * - S-Core Co., Ltd + * + */ + +#include "implement.h" +#include <dlfcn.h> + + +EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, + EGLSurface read, EGLContext ctx) { + void* (*fpVGMakeCurrent)(void*) = NULL;//jcpark + Bool(*fpVGSetSurfaceSize)(EGLint,EGLint) = NULL;//jcpark + Bool(*fpVGSetDrawSurface)(void*) = NULL;//jcpark + +#if defined(PROVIDING_RUNTIME_BINDING) + void (*fpMakeCurrent)(void*) = NULL; +#endif + struct DisplayExtra* pDisplay = EGLINTER(LookUpDisplay)(dpy); + if (pDisplay == NULL) { + EGLINTER(SetError)(EGL_BAD_DISPLAY); + return EGL_FALSE; + } + if (pDisplay->bInitialized == EGL_FALSE) { + EGLINTER(SetError)(EGL_NOT_INITIALIZED); + return EGL_FALSE; + } + struct SurfaceExtra* pDraw = NULL; + if (draw != EGL_NO_SURFACE) { + pDraw = EGLINTER(LookUpSurface)(draw); + if (pDraw == NULL) { + EGLINTER(SetError)(EGL_BAD_SURFACE); + return EGL_FALSE; + } + } + struct SurfaceExtra* pRead = NULL; + if (read == draw) { + pRead = pDraw; + } else if (read != EGL_NO_SURFACE) { + pRead = EGLINTER(LookUpSurface)(read); + if (pRead == NULL) { + EGLINTER(SetError)(EGL_BAD_SURFACE); + return EGL_FALSE; + } + } + struct ContextExtra* pContext = NULL; + if (ctx != EGL_NO_CONTEXT) { + if (draw == EGL_NO_SURFACE || read == EGL_NO_SURFACE) { + EGLINTER(SetError)(EGL_BAD_MATCH); + return EGL_FALSE; + } + pContext = EGLINTER(LookUpContext)(ctx); + if (pContext == NULL) { + EGLINTER(SetError)(EGL_BAD_CONTEXT); + return EGL_FALSE; + } + } else { + if (draw != EGL_NO_SURFACE || read != EGL_NO_SURFACE) { + EGLINTER(SetError)(EGL_BAD_MATCH); + return EGL_FALSE; + } + } + struct ContextExtra* pPrevious = NULL; + GLXContext nativePrevious = FNPTR(GetCurrentContext)(); + if (nativePrevious != NULL) { + EGLContext uniquePrevious = (EGLContext)(nativePrevious); + pPrevious = EGLINTER(LookUpContext)(uniquePrevious); + } + if (pPrevious != NULL) { + switch (pPrevious->apiKind) { + default: + case EGL_OPENGL_API: + break; +#if defined(PROVIDING_RUNTIME_BINDING) + case EGL_OPENGL_ES_API: + if (pPrevious->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; + } + } + fpMakeCurrent = dlsym(EGLINTER(global).dlES2, EGLCROSS_PREFIX "MakeCurrent"); + if (fpMakeCurrent != NULL) { + (*fpMakeCurrent)(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; + } + } + fpMakeCurrent = dlsym(EGLINTER(global).dlES1, EGLCROSS_PREFIX "MakeCurrent"); + if (fpMakeCurrent != NULL) { + (*fpMakeCurrent)(NULL); + } + } + break; +#else + case EGL_OPENGL_ES_API: + EGLCROSS(MakeCurrent)(NULL); + break; +#endif + case EGL_OPENVG_API: + + /* TODO: OpenVG may need some action here */ //jcpark + + if (EGLINTER(global).dlVG == NULL) { + if ((EGLINTER(global).dlVG = dlopen(VG_SO_FILENAME, RTLD_NOW | RTLD_GLOBAL)) + == NULL) { + EGLINTER(SetError)(EGL_BAD_ACCESS); + return; + } + } + fpVGMakeCurrent = dlsym(EGLINTER(global).dlVG, "vg4egl_SetContext"); + if (fpVGMakeCurrent != NULL) { + (*fpVGMakeCurrent)(pContext->apiContext); + } + else + { + printf("No symbol found for vg4egl_SetContext\n"); + } + fpVGSetSurfaceSize = dlsym(EGLINTER(global).dlVG, "vg4egl_SetSurfaceSize"); + if (fpVGSetSurfaceSize!= NULL) { + fpVGSetSurfaceSize(320,320); + } + else + { + printf("No symbol found for vg4egl_SetSurfaceSize\n"); + } + + + fpVGSetDrawSurface = dlsym(EGLINTER(global).dlVG, " vg4egl_SetDrawSurface"); + if (fpVGSetDrawSurface!= NULL) { + fpVGSetDrawSurface(pContext->apiContext); + } + else + { + printf("No symbol found for vg4egl_SetDrawSurface\n"); + } + + break; + } + } + Bool check = FNPTR(MakeContextCurrent)(pDisplay->native, + (pDraw == NULL) ? None : pDraw->native, + (pRead == NULL) ? None : pRead->native, + (pContext == NULL) ? NULL : pContext->native); + if (check == False) { + EGLINTER(SetError)(EGL_BAD_ALLOC); + return EGL_FALSE; + } + if (pContext != NULL) { + pContext->renderBuffer = pDraw->renderBuffer; + } +#if defined(PROVIDING_RUNTIME_BINDING) + if (pContext != NULL) { + switch (pContext->apiKind) { + default: + EGLINTER(ResetGLFnptrs)(&(EGLINTER(global))); + break; + case EGL_OPENGL_API: + EGLINTER(BindGLFnptrs)(&(EGLINTER(global))); + break; + 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; + } + } + fpMakeCurrent = dlsym(EGLINTER(global).dlES2, EGLCROSS_PREFIX "MakeCurrent"); + if (fpMakeCurrent != NULL) { + (*fpMakeCurrent)(pContext->apiContext); + } + EGLINTER(BindES2Fnptrs)(&(EGLINTER(global))); + } 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; + } + } + fpMakeCurrent = dlsym(EGLINTER(global).dlES1, EGLCROSS_PREFIX "MakeCurrent"); + if (fpMakeCurrent != NULL) { + (*fpMakeCurrent)(pContext->apiContext); + } + EGLINTER(BindES1Fnptrs)(&(EGLINTER(global))); + } + break; + case EGL_OPENVG_API: + /* TODO: OpenVG may need some action here */ //jcpark + if (EGLINTER(global).dlVG == NULL) { + if ((EGLINTER(global).dlVG = dlopen(VG_SO_FILENAME, RTLD_NOW | RTLD_GLOBAL)) + == NULL) { + EGLINTER(SetError)(EGL_BAD_ACCESS); + return; + } + } + fpMakeCurrent = dlsym(EGLINTER(global).dlVG, "vg4egl_SetContext"); + if (fpMakeCurrent != NULL) { + (*fpMakeCurrent)(pContext->apiContext); + } + + fpVGSetSurfaceSize = dlsym(EGLINTER(global).dlVG, "vg4egl_SetSurfaceSize"); + if (fpVGSetSurfaceSize!= NULL) { + fpVGSetSurfaceSize(320,320); + } + else + { + printf("No symbol found for vg4egl_SetSurfaceSize\n"); + } + + fpVGSetDrawSurface = dlsym(EGLINTER(global).dlVG, "vg4egl_SetDrawSurface"); + if (fpVGSetDrawSurface!= NULL) { + fpVGSetDrawSurface(pContext->apiContext); + } + else + { + printf("No symbol found for vg4egl_SetDrawSurface\n");//jcpark + } + + EGLINTER(BindES1Fnptrs)(&(EGLINTER(global))); + + break; + } + } else { + EGLINTER(ResetGLFnptrs)(&(EGLINTER(global))); + } +#else + if (pContext != NULL) { + switch (pContext->apiKind) { + default: + case EGL_OPENGL_API: + break; + case EGL_OPENGL_ES_API: + EGLCROSS(MakeCurrent)(pContext->apiContext); + break; + case EGL_OPENVG_API: + /* TODO: OpenVG may need some action here */ + //jcpark I don't know what to do here! + + break; + } + } +#endif + return EGL_TRUE; +} diff --git a/egl_1_4/37QueryAPI.c b/egl_1_4/37QueryAPI.c new file mode 100755 index 0000000..ad6d67e --- /dev/null +++ b/egl_1_4/37QueryAPI.c @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * DongKyun Yun <dk77.yun@samsung.com> + * SangJin Kim <sangjin3.kim@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: + * - S-Core Co., Ltd + * + */ + +#include "implement.h" + +EGLenum EGLAPIENTRY eglQueryAPI(void) { + register EGLenum eAnswer; + eAnswer = EGLINTER(global).currentAPI; + return eAnswer; +} + diff --git a/egl_1_4/37QueryContext.c b/egl_1_4/37QueryContext.c new file mode 100755 index 0000000..34f5da4 --- /dev/null +++ b/egl_1_4/37QueryContext.c @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * DongKyun Yun <dk77.yun@samsung.com> + * SangJin Kim <sangjin3.kim@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: + * - S-Core Co., Ltd + * + */ + +#include "implement.h" + + +EGLBoolean EGLAPIENTRY eglQueryContext(EGLDisplay dpy, EGLContext ctx, + EGLint attribute, EGLint *value) { + struct DisplayExtra* pDisplay = EGLINTER(LookUpDisplay)(dpy); + if (pDisplay == NULL) { + EGLINTER(SetError)(EGL_BAD_DISPLAY); + return EGL_FALSE; + } + if (pDisplay->bInitialized == EGL_FALSE) { + 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; + } + EGLint answer; + 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_RENDER_BUFFER: answer = pContext->renderBuffer; break; + default: + EGLINTER(SetError)(EGL_BAD_ATTRIBUTE); + return EGL_FALSE; + } + if (value != NULL) *value = answer; + return EGL_TRUE; +} diff --git a/egl_1_4/38WaitClient.c b/egl_1_4/38WaitClient.c new file mode 100755 index 0000000..22435e8 --- /dev/null +++ b/egl_1_4/38WaitClient.c @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * DongKyun Yun <dk77.yun@samsung.com> + * SangJin Kim <sangjin3.kim@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: + * - S-Core Co., Ltd + * + */ + +#include "implement.h" + + +EGLBoolean EGLAPIENTRY eglWaitClient(void) { + register EGLenum api; + api = eglQueryAPI(); + switch (api) { + case EGL_OPENGL_API: + case EGL_OPENGL_ES_API: + FNPTR(WaitGL)(); + break; + default: + break; + } + return EGL_TRUE; +} diff --git a/egl_1_4/38WaitGL.c b/egl_1_4/38WaitGL.c new file mode 100755 index 0000000..1a31545 --- /dev/null +++ b/egl_1_4/38WaitGL.c @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * DongKyun Yun <dk77.yun@samsung.com> + * SangJin Kim <sangjin3.kim@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: + * - S-Core Co., Ltd + * + */ + +#include "implement.h" + + +EGLBoolean EGLAPIENTRY eglWaitGL(void) { + EGLenum api = eglQueryAPI(); + switch (api) { + case EGL_OPENGL_API: + case EGL_OPENGL_ES_API: + FNPTR(WaitGL)(); + break; + default: + break; + } + return EGL_TRUE; +} diff --git a/egl_1_4/38WaitNative.c b/egl_1_4/38WaitNative.c new file mode 100755 index 0000000..03a1b8d --- /dev/null +++ b/egl_1_4/38WaitNative.c @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * DongKyun Yun <dk77.yun@samsung.com> + * SangJin Kim <sangjin3.kim@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: + * - S-Core Co., Ltd + * + */ + +#include "implement.h" + + +EGLBoolean EGLAPIENTRY eglWaitNative(EGLint engine) { + if (engine != EGL_CORE_NATIVE_ENGINE) { + EGLINTER(SetError)(EGL_BAD_PARAMETER); + return EGL_FALSE; + } + FNPTR(WaitX)(); + return EGL_TRUE; +} diff --git a/egl_1_4/39CopyBuffers.c b/egl_1_4/39CopyBuffers.c new file mode 100755 index 0000000..c1cf51b --- /dev/null +++ b/egl_1_4/39CopyBuffers.c @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * DongKyun Yun <dk77.yun@samsung.com> + * SangJin Kim <sangjin3.kim@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: + * - S-Core Co., Ltd + * + */ + +#include "implement.h" + + +EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, + EGLNativePixmapType target) { + struct DisplayExtra* pDisplay = EGLINTER(LookUpDisplay)(dpy); + if (pDisplay == NULL) { + EGLINTER(SetError)(EGL_BAD_DISPLAY); + return EGL_FALSE; + } + if (pDisplay->bInitialized == EGL_FALSE) { + EGLINTER(SetError)(EGL_NOT_INITIALIZED); + return EGL_FALSE; + } + struct SurfaceExtra* pSurface = EGLINTER(LookUpSurface)(surface); + if (pSurface == NULL) { + EGLINTER(SetError)(EGL_BAD_SURFACE); + return EGL_FALSE; + } + + Window root; + int x, y; + unsigned int width, height, border, depth; + if (XGetGeometry(pDisplay->native, (Drawable)target, &root, + &x, &y, &width, &height, &border, &depth) == 0) { + EGLINTER(SetError)(EGL_BAD_NATIVE_PIXMAP); + return EGL_FALSE; + } + + if (XCopyArea(pDisplay->native, pSurface->lowWinPix, target, + DefaultGC(pDisplay->native, DefaultScreen(pDisplay->native)), + 0, 0, width, height, 0, 0) == 0) { + EGLINTER(SetError)(EGL_BAD_NATIVE_PIXMAP); + return EGL_FALSE; + } + return EGL_TRUE; +} + diff --git a/egl_1_4/39SwapBuffers.c b/egl_1_4/39SwapBuffers.c new file mode 100755 index 0000000..9b31cab --- /dev/null +++ b/egl_1_4/39SwapBuffers.c @@ -0,0 +1,134 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * DongKyun Yun <dk77.yun@samsung.com> + * SangJin Kim <sangjin3.kim@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: + * - S-Core Co., Ltd + * + */ + +#include "implement.h" +#include <dlfcn.h>//jcpark + + +EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surface) { + struct DisplayExtra* pDisplay = EGLINTER(LookUpDisplay)(dpy); + if (pDisplay == NULL) { + EGLINTER(SetError)(EGL_BAD_DISPLAY); + return EGL_FALSE; + } + if (pDisplay->bInitialized == EGL_FALSE) { + EGLINTER(SetError)(EGL_NOT_INITIALIZED); + return EGL_FALSE; + } + struct SurfaceExtra* pSurface = EGLINTER(LookUpSurface)(surface); + if (pSurface == NULL) { + EGLINTER(SetError)(EGL_BAD_SURFACE); + return EGL_FALSE; + } + /* TODO */ + + /* TODO: OpenVG may need some action here */ //jcpark + struct ContextExtra* pPrevious = NULL; + GLXContext pContext = FNPTR(GetCurrentContext)(); + + if (pContext != NULL) { + EGLContext uniquePrevious = (EGLContext)(pContext); + pPrevious = EGLINTER(LookUpContext)(uniquePrevious); + } + + + void (*fpvgReadPixels)(void * , int, int, int, int, int, int)=NULL ;//jcpark + + unsigned char* buffer; + unsigned char* tmpbuf; + + int delta; + + //temp + int width = 320; + int height = 320; + int bpp = 4; + int i; + int unitsize; + switch( pPrevious->apiKind) + { + case EGL_OPENVG_API: + buffer = malloc( sizeof(unsigned char)*width * height * bpp ); + + + if (EGLINTER(global).dlVG == NULL) { + if ((EGLINTER(global).dlVG = dlopen(VG_SO_FILENAME, RTLD_NOW | RTLD_GLOBAL)) + == NULL) { + EGLINTER(SetError)(EGL_BAD_ACCESS); + return; + } + } + + fpvgReadPixels = dlsym(EGLINTER(global).dlVG, "vgReadPixels"); + if (fpvgReadPixels != NULL) { + fpvgReadPixels( buffer, width*bpp, VG_lRGBA_8888, 0, 0, width, height ); // VG ��⿡ ���� �Լ��� ���� + //RGBA -> ABGR + tmpbuf = malloc( sizeof(unsigned char)*width * height * bpp ); + unitsize = sizeof(unsigned char); + // tmpbuf - dest buffer - source + for(i=0;i<width*height;i++) + { + /* R */ *(tmpbuf+unitsize*0+i*bpp )=( *(buffer+unitsize*3+i*bpp) )& 0xFF; + /* G */ *(tmpbuf+unitsize*1+i*bpp )=( *(buffer+unitsize*2+i*bpp) )& 0xFF; + /* B */ *(tmpbuf+unitsize*2+i*bpp )=( *(buffer+unitsize*1+i*bpp) )& 0xFF; + /* A */ *(tmpbuf+unitsize*3+i*bpp )=( *(buffer+unitsize*0+i*bpp) )& 0xFF; + + } + + XVisualInfo* (*fpDrawPixels)( GLsizei width, GLsizei height, + GLenum format, GLenum type, + const GLvoid *pixels ) = NULL; + void* dl = dlopen("libGL.so", RTLD_NOW); + assert(dl != 0); + *(void**)(&fpDrawPixels) = dlsym(dl, "glDrawPixels"); + assert(fpDrawPixels != NULL); + + (*fpDrawPixels) ( width, height, GL_RGBA, GL_UNSIGNED_BYTE, tmpbuf); + +// glDrawPixels( width, height, GL_RGBA, GL_UNSIGNED_BYTE, tmpbuf); // GLES ��⿡ ���� �Լ��� ���� + + } + + //pContext->apiContext = NULL; + free( buffer ); + free( tmpbuf ); + + break; + + default: + + break; + + } + + FNPTR(SwapBuffers)(pDisplay->native, pSurface->native); + return EGL_TRUE; +} diff --git a/egl_1_4/39SwapInterval.c b/egl_1_4/39SwapInterval.c new file mode 100755 index 0000000..82825aa --- /dev/null +++ b/egl_1_4/39SwapInterval.c @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * DongKyun Yun <dk77.yun@samsung.com> + * SangJin Kim <sangjin3.kim@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: + * - S-Core Co., Ltd + * + */ + +#include "implement.h" + + +EGLBoolean EGLAPIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval) { + struct DisplayExtra* pDisplay = EGLINTER(LookUpDisplay)(dpy); + if (pDisplay == NULL) { + EGLINTER(SetError)(EGL_BAD_DISPLAY); + return EGL_FALSE; + } + if (pDisplay->bInitialized == EGL_FALSE) { + EGLINTER(SetError)(EGL_NOT_INITIALIZED); + return EGL_FALSE; + } + if (eglGetCurrentContext() == EGL_NO_CONTEXT) { + EGLINTER(SetError)(EGL_BAD_CONTEXT); + return EGL_FALSE; + } + if (eglGetCurrentSurface(EGL_DRAW) == EGL_NO_SURFACE) { + EGLINTER(SetError)(EGL_BAD_SURFACE); + return EGL_FALSE; + } + FNPTR(SwapIntervalSGI)(interval); + return EGL_TRUE; +} diff --git a/egl_1_4/3AGetProcAddress.c b/egl_1_4/3AGetProcAddress.c new file mode 100755 index 0000000..4708aba --- /dev/null +++ b/egl_1_4/3AGetProcAddress.c @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * DongKyun Yun <dk77.yun@samsung.com> + * SangJin Kim <sangjin3.kim@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: + * - S-Core Co., Ltd + * + */ + +#include "implement.h" +#include <dlfcn.h> + + +__eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress(const char *procname) { + void* fpAnswer = NULL; + if (procname == NULL) return NULL; + if (procname[0] == '\0') return NULL; + if (EGLINTER(global).dlEGL == NULL) { + if ((EGLINTER(global).dlEGL = dlopen(EGL_SO_FILENAME, RTLD_NOW | RTLD_GLOBAL)) == NULL) { + return NULL; + } + } + if ((fpAnswer = dlsym(EGLINTER(global).dlEGL, procname)) != NULL) { + return fpAnswer; + } + void** ptrDLL = NULL; + char* sofilename; + char* libname; + EGLContext eglContext = eglGetCurrentContext(); + if (eglContext != EGL_NO_CONTEXT) { + struct ContextExtra* pContext = EGLINTER(LookUpContext)(eglContext); + assert(pContext != NULL); + switch (pContext->apiKind) { + case EGL_OPENGL_API: + ptrDLL = &(EGLINTER(global).dlGL); + sofilename = GL_SO_FILENAME; + libname = "GL"; + break; + case EGL_OPENGL_ES_API: + if (pContext->apiVersion == 2) { + ptrDLL = &(EGLINTER(global).dlES2); + sofilename = GL_ES2_SO_FILENAME; + libname = "ES2"; + } else { + ptrDLL = &(EGLINTER(global).dlES1); + sofilename = GL_ES1_SO_FILENAME; + libname = "ES1"; + } + break; + default: + return NULL; + break; + } + if (*ptrDLL == NULL) { + if ((*ptrDLL = dlopen(sofilename, RTLD_NOW | RTLD_GLOBAL)) == NULL) { + return NULL; + } + } + if ((fpAnswer = dlsym(*ptrDLL, procname)) != NULL) { + return fpAnswer; + } + } +#if 1 + else { + ptrDLL = &(EGLINTER(global).dlES2); + sofilename = GL_ES2_SO_FILENAME; + libname = "ES2"; + if (*ptrDLL == NULL) { + if ((*ptrDLL = dlopen(sofilename, RTLD_NOW | RTLD_GLOBAL)) == NULL) { + return NULL; + } + } + if ((fpAnswer = dlsym(*ptrDLL, procname)) != NULL) { + return fpAnswer; + } + } +#endif + return NULL; +} diff --git a/egl_1_4/3BReleaseThread.c b/egl_1_4/3BReleaseThread.c new file mode 100755 index 0000000..537de26 --- /dev/null +++ b/egl_1_4/3BReleaseThread.c @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * DongKyun Yun <dk77.yun@samsung.com> + * SangJin Kim <sangjin3.kim@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: + * - S-Core Co., Ltd + * + */ + +#include "implement.h" + + +EGLBoolean EGLAPIENTRY eglReleaseThread(void) { + EGLDisplay dpy = eglGetCurrentDisplay(); + eglMakeCurrent(dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); + eglBindAPI(EGL_OPENGL_ES_API); + return EGL_TRUE; +} diff --git a/egl_1_4/41LockSurfaceKHR.c b/egl_1_4/41LockSurfaceKHR.c new file mode 100644 index 0000000..f0b3a51 --- /dev/null +++ b/egl_1_4/41LockSurfaceKHR.c @@ -0,0 +1,10 @@ +/* + * 41LockSurfaceKHR.c + */ +#include "implement.h" + +EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list) +{ + return EGL_FALSE; +} + diff --git a/egl_1_4/41UnlockSurfaceKHR.c b/egl_1_4/41UnlockSurfaceKHR.c new file mode 100644 index 0000000..e0b4994 --- /dev/null +++ b/egl_1_4/41UnlockSurfaceKHR.c @@ -0,0 +1,9 @@ +/* + * 41UnlockSurfaceKHR.c + */ +#include "implement.h" + +EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay display, EGLSurface surface) +{ + return EGL_FALSE; +} diff --git a/egl_1_4/42CreateImageKHR.c b/egl_1_4/42CreateImageKHR.c new file mode 100644 index 0000000..2ec99bd --- /dev/null +++ b/egl_1_4/42CreateImageKHR.c @@ -0,0 +1,57 @@ +/* + * 42CreateImageKHR.c + */ +#include "implement.h" + +EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, + EGLContext ctx, EGLenum target, + EGLClientBuffer buffer, + const EGLint *attrib_list) { +#if 1 + fprintf (stderr, "EGLImage: eglCreateImageKHR () was called!\n"); + fprintf (stderr, "======== ctx = %s\n",ctx == EGL_NO_CONTEXT ? "EGL_NO_CONTEXT" : "POINTER"); + if (target == EGL_NATIVE_PIXMAP_KHR) { + fprintf (stderr, "======== target = %s\n", "EGL_NATIVE_PIXMAP_KHR"); + } else { + fprintf (stderr, "======== target = %x\n", (unsigned int)target); + } + fprintf (stderr, "======== buffer = 0x%x\n", (unsigned int)buffer); +#endif + struct DisplayExtra* pDisplay = EGLINTER(LookUpDisplay)(dpy); + if (pDisplay == NULL) { + EGLINTER(SetError)(EGL_BAD_DISPLAY); + return EGL_NO_IMAGE_KHR; + } + if (pDisplay->bInitialized == EGL_FALSE) { + EGLINTER(SetError)(EGL_NOT_INITIALIZED); + return EGL_NO_IMAGE_KHR; + } + + if (ctx != EGL_NO_CONTEXT) { + EGLINTER(SetError)(EGL_BAD_CONTEXT); + return EGL_NO_IMAGE_KHR; + } + if (target != EGL_NATIVE_PIXMAP_KHR) { + fprintf (stderr, "EGLImage: Not yet supported target! (%x)\n", (unsigned int)target); + return EGL_NO_IMAGE_KHR; + } + // assert (!EGLINTER(LookUpEGLImage)(unique)); + GLint unique = EGLINTER(global).nImageExtra; + unique ++; + struct ImageExtra *pArea = EGLINTER(InsertEGLImage)((EGLImageKHR)unique); + // get the pixmap information here + Window root; + unsigned dummy; + if (XGetGeometry(pDisplay->native, (Pixmap)buffer, &root, + &dummy, &dummy, &pArea->width, &pArea->height, + &dummy, &pArea->depth) == 0) { + fprintf (stderr, "ZLV: Failed here???\n"); + EGLINTER(SetError)(EGL_BAD_NATIVE_PIXMAP); + return EGL_NO_IMAGE_KHR; + } + pArea->unique = (EGLImageKHR) unique; + pArea->dpy = pDisplay->native; + pArea->pixmap = (Pixmap) buffer; + + return (EGLImageKHR) unique; +} diff --git a/egl_1_4/42DestroyImageKHR.c b/egl_1_4/42DestroyImageKHR.c new file mode 100644 index 0000000..62b7c94 --- /dev/null +++ b/egl_1_4/42DestroyImageKHR.c @@ -0,0 +1,14 @@ +/* + * 42DestroyImageKHR.c + */ +#include "implement.h" + +EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image) +{ + fprintf (stderr, "EGLImage: eglDestroyImageKHR () was called!\n"); + // assert (EGLINTER(LookUpEGLImage)(image)); + + EGLINTER(DeleteEGLImage)(image); + return EGL_TRUE; +} + diff --git a/egl_1_4/binding.inl b/egl_1_4/binding.inl new file mode 100755 index 0000000..443343a --- /dev/null +++ b/egl_1_4/binding.inl @@ -0,0 +1,860 @@ + +GLboolean glIsBuffer(GLuint buffer) { + return FNPTR(IsBuffer)(buffer); +} + +GLboolean glIsEnabled(GLenum cap) { + return FNPTR(IsEnabled)(cap); +} + +GLboolean glIsFramebuffer(GLuint framebuffer) { + return FNPTR(IsFramebuffer)(framebuffer); +} + +GLboolean glIsProgram(GLuint program) { + return FNPTR(IsProgram)(program); +} + +GLboolean glIsRenderbuffer(GLuint renderbuffer) { + return FNPTR(IsRenderbuffer)(renderbuffer); +} + +GLboolean glIsShader(GLuint shader) { + return FNPTR(IsShader)(shader); +} + +GLboolean glIsTexture(GLuint texture) { + return FNPTR(IsTexture)(texture); +} + +GLenum glCheckFramebufferStatus(GLenum target) { + return FNPTR(CheckFramebufferStatus)(target); +} + +GLenum glGetError(void) { + return FNPTR(GetError)(); +} + +GLint glGetAttribLocation(GLuint program, const char* name) { + return FNPTR(GetAttribLocation)(program, name); +} + +GLint glGetUniformLocation(GLuint program, const char* name) { + return FNPTR(GetUniformLocation)(program, name); +} + +GLuint glCreateProgram(void) { + return FNPTR(CreateProgram)(); +} + +GLuint glCreateShader(GLenum type) { + return FNPTR(CreateShader)(type); +} + +const GLubyte* glGetString(GLenum name) { + return FNPTR(GetString)(name); +} + +void glActiveTexture(GLenum texture) { + FNPTR(ActiveTexture)(texture); +} + +void glAlphaFunc(GLenum func, GLclampf ref) { + FNPTR(AlphaFunc)(func, ref); +} + +void glAttachShader(GLuint program, GLuint shader) { + FNPTR(AttachShader)(program, shader); +} + +void glBindAttribLocation(GLuint program, GLuint index, const char* name) { + FNPTR(BindAttribLocation)(program, index, name); +} + +void glBindBuffer(GLenum target, GLuint buffer) { + FNPTR(BindBuffer)(target, buffer); +} + +void glBindFramebuffer(GLenum target, GLuint framebuffer) { + FNPTR(BindFramebuffer)(target, framebuffer); +} + +void glBindRenderbuffer(GLenum target, GLuint renderbuffer) { + FNPTR(BindRenderbuffer)(target, renderbuffer); +} + +void glBindTexture(GLenum target, GLuint texture) { + FNPTR(BindTexture)(target, texture); +} + +void glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { + FNPTR(BlendColor)(red, green, blue, alpha); +} + +void glBlendEquation(GLenum mode) { + FNPTR(BlendEquation)(mode); +} + +void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) { + FNPTR(BlendEquationSeparate)(modeRGB, modeAlpha); +} + +void glBlendFunc(GLenum sfactor, GLenum dfactor) { + FNPTR(BlendFunc)(sfactor, dfactor); +} + +void glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) { + FNPTR(BlendFuncSeparate)(srcRGB, dstRGB, srcAlpha, dstAlpha); +} + +void glBufferData(GLenum target, GLsizeiptr size, const void* data, GLenum usage) { + FNPTR(BufferData)(target, size, data, usage); +} + +void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void* data) { + FNPTR(BufferSubData)(target, offset, size, data); +} + +void glClear(GLbitfield mask) { + FNPTR(Clear)(mask); +} + +void glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { + FNPTR(ClearColor)(red, green, blue, alpha); +} + +void glClearColorx(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha) { + FNPTR(ClearColorx)(red, green, blue, alpha); +} + +void glClearDepthf(GLclampf depth) { + FNPTR(ClearDepthf)(depth); +} + +void glClearStencil(GLint s) { + FNPTR(ClearStencil)(s); +} + +void glClientActiveTexture(GLenum texture) { + FNPTR(ClientActiveTexture)(texture); +} + +void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) { + FNPTR(Color4f)(red, green, blue, alpha); +} + +void glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) { + FNPTR(Color4ub)(red, green, blue, alpha); +} + +void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) { + FNPTR(ColorMask)(red, green, blue, alpha); +} + +void glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid* pointer) { + FNPTR(ColorPointer)(size, type, stride, pointer); +} + +void glCompileShader(GLuint shader) { + FNPTR(CompileShader)(shader); +} + +void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data) { + FNPTR(CompressedTexImage2D)(target, level, internalformat, width, height, border, imageSize, data); +} + +void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data) { + FNPTR(CompressedTexSubImage2D)(target, level, xoffset, yoffset, width, height, format, imageSize, data); +} + +void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) { + FNPTR(CopyTexImage2D)(target, level, internalformat, x, y, width, height, border); +} + +void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) { + FNPTR(CopyTexSubImage2D)(target, level, xoffset, yoffset, x, y, width, height); +} + +void glCullFace(GLenum mode) { + FNPTR(CullFace)(mode); +} + +void glDeleteBuffers(GLsizei n, const GLuint* buffers) { + FNPTR(DeleteBuffers)(n, buffers); +} + +void glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers) { + FNPTR(DeleteFramebuffers)(n, framebuffers); +} + +void glDeleteProgram(GLuint program) { + FNPTR(DeleteProgram)(program); +} + +void glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers) { + FNPTR(DeleteRenderbuffers)(n, renderbuffers); +} + +void glDeleteShader(GLuint shader) { + FNPTR(DeleteShader)(shader); +} + +void glDeleteTextures(GLsizei n, const GLuint* textures) { + FNPTR(DeleteTextures)(n, textures); +} + +void glDepthFunc(GLenum func) { + FNPTR(DepthFunc)(func); +} + +void glDepthMask(GLboolean flag) { + FNPTR(DepthMask)(flag); +} + +void glDepthRangef(GLclampf zNear, GLclampf zFar) { + FNPTR(DepthRangef)(zNear, zFar); +} + +void glDetachShader(GLuint program, GLuint shader) { + FNPTR(DetachShader)(program, shader); +} + +void glDisable(GLenum cap) { + FNPTR(Disable)(cap); +} + +void glDisableClientState(GLenum array) { + FNPTR(DisableClientState)(array); +} + +void glDisableVertexAttribArray(GLuint index) { + FNPTR(DisableVertexAttribArray)(index); +} + +void glDrawArrays(GLenum mode, GLint first, GLsizei count) { + FNPTR(DrawArrays)(mode, first, count); +} + +void glDrawElements(GLenum mode, GLsizei count, GLenum type, const void* indices) { + FNPTR(DrawElements)(mode, count, type, indices); +} + +void glEnable(GLenum cap) { + FNPTR(Enable)(cap); +} + +void glEnableClientState(GLenum array) { + FNPTR(EnableClientState)(array); +} + +void glEnableVertexAttribArray(GLuint index) { + FNPTR(EnableVertexAttribArray)(index); +} + +void glFinish(void) { + FNPTR(Finish)(); +} + +void glFlush(void) { + FNPTR(Flush)(); +} + +void glFogf(GLenum pname, GLfloat param) { + FNPTR(Fogf)(pname, param); +} + +void glFogfv(GLenum pname, const GLfloat* params) { + FNPTR(Fogfv)(pname, params); +} + +void glFogi(GLenum pname, GLint param) { + FNPTR(Fogi)(pname, param); +} + +void glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) { + FNPTR(FramebufferRenderbuffer)(target, attachment, renderbuffertarget, renderbuffer); +} + +void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) { + FNPTR(FramebufferTexture2D)(target, attachment, textarget, texture, level); +} + +void glFrontFace(GLenum mode) { + FNPTR(FrontFace)(mode); +} + +void glGenBuffers(GLsizei n, GLuint* buffers) { + FNPTR(GenBuffers)(n, buffers); +} + +void glGenFramebuffers(GLsizei n, GLuint* framebuffers) { + FNPTR(GenFramebuffers)(n, framebuffers); +} + +void glGenRenderbuffers(GLsizei n, GLuint* renderbuffers) { + FNPTR(GenRenderbuffers)(n, renderbuffers); +} + +void glGenTextures(GLsizei n, GLuint* textures) { + FNPTR(GenTextures)(n, textures); +} + +void glGenerateMipmap(GLenum target) { + FNPTR(GenerateMipmap)(target); +} + +void glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) { + FNPTR(GetActiveAttrib)(program, index, bufsize, length, size, type, name); +} + +void glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) { + FNPTR(GetActiveUniform)(program, index, bufsize, length, size, type, name); +} + + +void glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) { + FNPTR(GetAttachedShaders)(program, maxcount, count, shaders); +} + + +void glGetBooleanv(GLenum pname, GLboolean* params) { + FNPTR(GetBooleanv)(pname, params); +} + + +void glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params) { + FNPTR(GetBufferParameteriv)(target, pname, params); +} + + +void glGetFloatv(GLenum pname, GLfloat* params) { + FNPTR(GetFloatv)(pname, params); +} + + +void glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params) { + FNPTR(GetFramebufferAttachmentParameteriv)(target, attachment, pname, params); +} + + +void glGetIntegerv(GLenum pname, GLint* params) { + FNPTR(GetIntegerv)(pname, params); +} + + +void glGetLightfv(GLenum light, GLenum pname, GLfloat* params) { + FNPTR(GetLightfv)(light, pname, params); +} + + +void glGetMaterialfv(GLenum face, GLenum pname, GLfloat* params) { + FNPTR(GetMaterialfv)(face, pname, params); +} + + +void glGetPointerv(GLenum pname, void** params) { + FNPTR(GetPointerv)(pname, params); +} + + +void glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog) { + FNPTR(GetProgramInfoLog)(program, bufsize, length, infolog); +} + + +void glGetProgramiv(GLuint program, GLenum pname, GLint* params) { + FNPTR(GetProgramiv)(program, pname, params); +} + + +void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params) { + FNPTR(GetRenderbufferParameteriv)(target, pname, params); +} + + +void glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog) { + FNPTR(GetShaderInfoLog)(shader, bufsize, length, infolog); +} + + +void glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source) { + FNPTR(GetShaderSource)(shader, bufsize, length, source); +} + + +void glGetShaderiv(GLuint shader, GLenum pname, GLint* params) { + FNPTR(GetShaderiv)(shader, pname, params); +} + + +void glGetTexEnvfv(GLenum env, GLenum pname, GLfloat* params) { + FNPTR(GetTexEnvfv)(env, pname, params); +} + + +void glGetTexEnviv(GLenum env, GLenum pname, GLint* params) { + FNPTR(GetTexEnviv)(env, pname, params); +} + + +void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params) { + FNPTR(GetTexParameterfv)(target, pname, params); +} + + +void glGetTexParameteriv(GLenum target, GLenum pname, GLint* params) { + FNPTR(GetTexParameteriv)(target, pname, params); +} + + +void glGetUniformfv(GLuint program, GLint location, GLfloat* params) { + FNPTR(GetUniformfv)(program, location, params); +} + + +void glGetUniformiv(GLuint program, GLint location, GLint* params) { + FNPTR(GetUniformiv)(program, location, params); +} + + +void glGetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer) { + FNPTR(GetVertexAttribPointerv)(index, pname, pointer); +} + + +void glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) { + FNPTR(GetVertexAttribfv)(index, pname, params); +} + + +void glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params) { + FNPTR(GetVertexAttribiv)(index, pname, params); +} + + +void glHint(GLenum target, GLenum mode) { + FNPTR(Hint)(target, mode); +} + + +void glLightModelf(GLenum pname, GLfloat param) { + FNPTR(LightModelf)(pname, param); +} + + +void glLightModelfv(GLenum pname, const GLfloat* params) { + FNPTR(LightModelfv)(pname, params); +} + + +void glLightf(GLenum light, GLenum pname, GLfloat param) { + FNPTR(Lightf)(light, pname, param); +} + + +void glLightfv(GLenum light, GLenum pname, const GLfloat* params) { + FNPTR(Lightfv)(light, pname, params); +} + + +void glLineWidth(GLfloat width) { + FNPTR(LineWidth)(width); +} + + +void glLinkProgram(GLuint program) { + FNPTR(LinkProgram)(program); +} + + +void glLoadIdentity(void) { + FNPTR(LoadIdentity)(); +} + + +void glLoadMatrixf(const GLfloat* m) { + FNPTR(LoadMatrixf)(m); +} + + +void glLogicOp(GLenum opcode) { + FNPTR(LogicOp)(opcode); +} + + +void glMaterialf(GLenum face, GLenum pname, GLfloat param) { + FNPTR(Materialf)(face, pname, param); +} + + +void glMaterialfv(GLenum face, GLenum pname, const GLfloat* params) { + FNPTR(Materialfv)(face, pname, params); +} + + +void glMatrixMode(GLenum mode) { + FNPTR(MatrixMode)(mode); +} + + +void glMultMatrixf(const GLfloat* m) { + FNPTR(MultMatrixf)(m); +} + + +void glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) { + FNPTR(MultiTexCoord4f)(target, s, t, r, q); +} + + +void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz) { + FNPTR(Normal3f)(nx, ny, nz); +} + + +void glNormalPointer(GLenum type, GLsizei stride, const GLvoid* pointer) { + FNPTR(NormalPointer)(type, stride, pointer); +} + +void glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near, GLdouble far) { + FNPTR(Ortho)(left, right, bottom, top, near, far); +} + +void glOrthof(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat near, GLfloat far) { + FNPTR(Orthof)(left, right, bottom, top, near, far); +} + +void glOrthox(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed near, GLfixed far) { + FNPTR(Orthox)(left, right, bottom, top, near, far); +} + + +void glPixelStorei(GLenum pname, GLint param) { + FNPTR(PixelStorei)(pname, param); +} + + +void glPointParameterf(GLenum pname, GLfloat param) { + FNPTR(PointParameterf)(pname, param); +} + + +void glPointParameterfv(GLenum pname, const GLfloat* params) { + FNPTR(PointParameterfv)(pname, params); +} + + +void glPointSize(GLfloat size) { + FNPTR(PointSize)(size); +} + + +void glPolygonOffset(GLfloat factor, GLfloat units) { + FNPTR(PolygonOffset)(factor, units); +} + + +void glPopMatrix(void) { + FNPTR(PopMatrix)(); +} + + +void glPushMatrix(void) { + FNPTR(PushMatrix)(); +} + + +void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels) { + FNPTR(ReadPixels)(x, y, width, height, format, type, pixels); +} + + +void glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) { + FNPTR(RenderbufferStorage)(target, internalformat, width, height); +} + + +void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) { + FNPTR(Rotatef)(angle, x, y, z); +} + +void glRotatex(GLfixed angle, GLfixed x, GLfixed y, GLfixed z) { + FNPTR(Rotatex)(angle, x, y, z); +} + +void glSampleCoverage(GLclampf value, GLboolean invert) { + FNPTR(SampleCoverage)(value, invert); +} + + +void glScalef(GLfloat x, GLfloat y, GLfloat z) { + FNPTR(Scalef)(x, y, z); +} + + +void glScissor(GLint x, GLint y, GLsizei width, GLsizei height) { + FNPTR(Scissor)(x, y, width, height); +} + + +void glShadeModel(GLenum mode) { + FNPTR(ShadeModel)(mode); +} + + +void glShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length) { + FNPTR(ShaderSource)(shader, count, string, length); +} + + +void glStencilFunc(GLenum func, GLint ref, GLuint mask) { + FNPTR(StencilFunc)(func, ref, mask); +} + + +void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) { + FNPTR(StencilFuncSeparate)(face, func, ref, mask); +} + + +void glStencilMask(GLuint mask) { + FNPTR(StencilMask)(mask); +} + + +void glStencilMaskSeparate(GLenum face, GLuint mask) { + FNPTR(StencilMaskSeparate)(face, mask); +} + + +void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass) { + FNPTR(StencilOp)(fail, zfail, zpass); +} + + +void glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) { + FNPTR(StencilOpSeparate)(face, fail, zfail, zpass); +} + + +void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid* pointer) { + FNPTR(TexCoordPointer)(size, type, stride, pointer); +} + + +void glTexEnvf(GLenum target, GLenum pname, GLfloat param) { + FNPTR(TexEnvf)(target, pname, param); +} + + +void glTexEnvfv(GLenum target, GLenum pname, const GLfloat* params) { + FNPTR(TexEnvfv)(target, pname, params); +} + + +void glTexEnvi(GLenum target, GLenum pname, GLint param) { + FNPTR(TexEnvi)(target, pname, param); +} + + +void glTexEnviv(GLenum target, GLenum pname, const GLint* params) { + FNPTR(TexEnviv)(target, pname, params); +} + + +void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels) { + FNPTR(TexImage2D)(target, level, internalformat, width, height, border, format, type, pixels); +} + + +void glTexParameterf(GLenum target, GLenum pname, GLfloat param) { + FNPTR(TexParameterf)(target, pname, param); +} + + +void glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params) { + FNPTR(TexParameterfv)(target, pname, params); +} + + +void glTexParameteri(GLenum target, GLenum pname, GLint param) { + FNPTR(TexParameteri)(target, pname, param); +} + + +void glTexParameteriv(GLenum target, GLenum pname, const GLint* params) { + FNPTR(TexParameteriv)(target, pname, params); +} + + +void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels) { + FNPTR(TexSubImage2D)(target, level, xoffset, yoffset, width, height, format, type, pixels); +} + + +void glTranslatef(GLfloat x, GLfloat y, GLfloat z) { + FNPTR(Translatef)(x, y, z); +} + +void glTranslatex(GLfixed x, GLfixed y, GLfixed z) { + FNPTR(Translatex)(x, y, z); +} + +void glUniform1f(GLint location, GLfloat x) { + FNPTR(Uniform1f)(location, x); +} + + +void glUniform1fv(GLint location, GLsizei count, const GLfloat* v) { + FNPTR(Uniform1fv)(location, count, v); +} + + +void glUniform1i(GLint location, GLint x) { + FNPTR(Uniform1i)(location, x); +} + + +void glUniform1iv(GLint location, GLsizei count, const GLint* v) { + FNPTR(Uniform1iv)(location, count, v); +} + + +void glUniform2f(GLint location, GLfloat x, GLfloat y) { + FNPTR(Uniform2f)(location, x, y); +} + + +void glUniform2fv(GLint location, GLsizei count, const GLfloat* v) { + FNPTR(Uniform2fv)(location, count, v); +} + + +void glUniform2i(GLint location, GLint x, GLint y) { + FNPTR(Uniform2i)(location, x, y); +} + + +void glUniform2iv(GLint location, GLsizei count, const GLint* v) { + FNPTR(Uniform2iv)(location, count, v); +} + + +void glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z) { + FNPTR(Uniform3f)(location, x, y, z); +} + + +void glUniform3fv(GLint location, GLsizei count, const GLfloat* v) { + FNPTR(Uniform3fv)(location, count, v); +} + + +void glUniform3i(GLint location, GLint x, GLint y, GLint z) { + FNPTR(Uniform3i)(location, x, y, z); +} + + +void glUniform3iv(GLint location, GLsizei count, const GLint* v) { + FNPTR(Uniform3iv)(location, count, v); +} + + +void glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { + FNPTR(Uniform4f)(location, x, y, z, w); +} + + +void glUniform4fv(GLint location, GLsizei count, const GLfloat* v) { + FNPTR(Uniform4fv)(location, count, v); +} + + +void glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w) { + FNPTR(Uniform4i)(location, x, y, z, w); +} + + +void glUniform4iv(GLint location, GLsizei count, const GLint* v) { + FNPTR(Uniform4iv)(location, count, v); +} + + +void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { + FNPTR(UniformMatrix2fv)(location, count, transpose, value); +} + + +void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { + FNPTR(UniformMatrix3fv)(location, count, transpose, value); +} + + +void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { + FNPTR(UniformMatrix4fv)(location, count, transpose, value); +} + + +void glUseProgram(GLuint program) { + FNPTR(UseProgram)(program); +} + + +void glValidateProgram(GLuint program) { + FNPTR(ValidateProgram)(program); +} + + +void glVertexAttrib1f(GLuint indx, GLfloat x) { + FNPTR(VertexAttrib1f)(indx, x); +} + + +void glVertexAttrib1fv(GLuint indx, const GLfloat* values) { + FNPTR(VertexAttrib1fv)(indx, values); +} + + +void glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) { + FNPTR(VertexAttrib2f)(indx, x, y); +} + + +void glVertexAttrib2fv(GLuint indx, const GLfloat* values) { + FNPTR(VertexAttrib2fv)(indx, values); +} + + +void glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z) { + FNPTR(VertexAttrib3f)(indx, x, y, z); +} + + +void glVertexAttrib3fv(GLuint indx, const GLfloat* values) { + FNPTR(VertexAttrib3fv)(indx, values); +} + + +void glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { + FNPTR(VertexAttrib4f)(indx, x, y, z, w); +} + + +void glVertexAttrib4fv(GLuint indx, const GLfloat* values) { + FNPTR(VertexAttrib4fv)(indx, values); +} + + +void glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr) { + FNPTR(VertexAttribPointer)(indx, size, type, normalized, stride, ptr); +} + + +void glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid* pointer) { + FNPTR(VertexPointer)(size, type, stride, pointer); +} + + +void glViewport(GLint x, GLint y, GLsizei width, GLsizei height) { + FNPTR(Viewport)(x, y, width, height); +} diff --git a/egl_1_4/glfunclist.inl b/egl_1_4/glfunclist.inl new file mode 100755 index 0000000..2bd73e8 --- /dev/null +++ b/egl_1_4/glfunclist.inl @@ -0,0 +1,191 @@ + ACTION( IsBuffer ); + ACTION( IsEnabled ); + ACTION( IsFramebuffer ); + ACTION( IsProgram ); + ACTION( IsRenderbuffer ); + ACTION( IsShader ); + ACTION( IsTexture ); + ACTION( CheckFramebufferStatus ); + ACTION( GetError ); + ACTION( GetAttribLocation ); + ACTION( GetUniformLocation ); + ACTION( CreateProgram ); + ACTION( CreateShader ); + ACTION( GetString ); + ACTION( ActiveTexture ); + ACTION( AlphaFunc ); + ACTION( AttachShader ); + ACTION( BindAttribLocation ); + ACTION( BindBuffer ); + ACTION( BindFramebuffer ); + ACTION( BindRenderbuffer ); + ACTION( BindTexture ); + ACTION( BlendColor ); + ACTION( BlendEquation ); + ACTION( BlendEquationSeparate ); + ACTION( BlendFunc ); + ACTION( BlendFuncSeparate ); + ACTION( BufferData ); + ACTION( BufferSubData ); + ACTION( Clear ); + ACTION( ClearColor ); + ACTION( ClearColorx ); + ACTION( ClearDepthf ); + ACTION( ClearStencil ); + ACTION( ClientActiveTexture ); + ACTION( Color4f ); + ACTION( Color4ub ); + ACTION( ColorMask ); + ACTION( ColorPointer ); + ACTION( CompileShader ); + ACTION( CompressedTexImage2D ); + ACTION( CompressedTexSubImage2D ); + ACTION( CopyTexImage2D ); + ACTION( CopyTexSubImage2D ); + ACTION( CullFace ); + ACTION( DeleteBuffers ); + ACTION( DeleteFramebuffers ); + ACTION( DeleteProgram ); + ACTION( DeleteRenderbuffers ); + ACTION( DeleteShader ); + ACTION( DeleteTextures ); + ACTION( DepthFunc ); + ACTION( DepthMask ); + ACTION( DepthRangef ); + ACTION( DetachShader ); + ACTION( Disable ); + ACTION( DisableClientState ); + ACTION( DisableVertexAttribArray ); + ACTION( DrawArrays ); + ACTION( DrawElements ); + ACTION( Enable ); + ACTION( EnableClientState ); + ACTION( EnableVertexAttribArray ); + ACTION( Finish ); + ACTION( Flush ); + ACTION( Fogf ); + ACTION( Fogfv ); + ACTION( Fogi ); + ACTION( FramebufferRenderbuffer ); + ACTION( FramebufferTexture2D ); + ACTION( FrontFace ); + ACTION( GenBuffers ); + ACTION( GenFramebuffers ); + ACTION( GenRenderbuffers ); + ACTION( GenTextures ); + ACTION( GenerateMipmap ); + ACTION( GetActiveAttrib ); + ACTION( GetActiveUniform ); + ACTION( GetAttachedShaders ); + ACTION( GetBooleanv ); + ACTION( GetBufferParameteriv ); + ACTION( GetBufferSubData ); + ACTION( GetFloatv ); + ACTION( GetFramebufferAttachmentParameteriv ); + ACTION( GetIntegerv ); + ACTION( GetLightfv ); + ACTION( GetMaterialfv ); + ACTION( GetPointerv ); + ACTION( GetProgramInfoLog ); + ACTION( GetProgramiv ); + ACTION( GetRenderbufferParameteriv ); + ACTION( GetShaderInfoLog ); + ACTION( GetShaderSource ); + ACTION( GetShaderiv ); + ACTION( GetTexEnvfv ); + ACTION( GetTexEnviv ); + ACTION( GetTexLevelParameteriv ); + ACTION( GetTexParameterfv ); + ACTION( GetTexParameteriv ); + ACTION( GetUniformfv ); + ACTION( GetUniformiv ); + ACTION( GetVertexAttribPointerv ); + ACTION( GetVertexAttribfv ); + ACTION( GetVertexAttribiv ); + ACTION( Hint ); + ACTION( LightModelf ); + ACTION( LightModelfv ); + ACTION( Lightf ); + ACTION( Lightfv ); + ACTION( LineWidth ); + ACTION( LinkProgram ); + ACTION( LoadIdentity ); + ACTION( LoadMatrixf ); + ACTION( LogicOp ); + ACTION( Materialf ); + ACTION( Materialfv ); + ACTION( MatrixMode ); + ACTION( MultMatrixf ); + ACTION( MultiTexCoord4f ); + ACTION( Normal3f ); + ACTION( NormalPointer ); + ACTION( Ortho ); + ACTION( Orthof ); + ACTION( Orthox ); + ACTION( PixelStorei ); + ACTION( PointParameterf ); + ACTION( PointParameterfv ); + ACTION( PointSize ); + ACTION( PolygonOffset ); + ACTION( PopMatrix ); + ACTION( PushMatrix ); + ACTION( ReadPixels ); + ACTION( RenderbufferStorage ); + ACTION( Rotatef ); + ACTION( Rotatex ); + ACTION( SampleCoverage ); + ACTION( Scalef ); + ACTION( Scissor ); + ACTION( ShadeModel ); + ACTION( ShaderSource ); + ACTION( StencilFunc ); + ACTION( StencilFuncSeparate ); + ACTION( StencilMask ); + ACTION( StencilMaskSeparate ); + ACTION( StencilOp ); + ACTION( StencilOpSeparate ); + ACTION( TexCoordPointer ); + ACTION( TexEnvf ); + ACTION( TexEnvfv ); + ACTION( TexEnvi ); + ACTION( TexEnviv ); + ACTION( TexImage2D ); + ACTION( TexParameterf ); + ACTION( TexParameterfv ); + ACTION( TexParameteri ); + ACTION( TexParameteriv ); + ACTION( TexSubImage2D ); + ACTION( Translatef ); + ACTION( Translatex ); + ACTION( Uniform1f ); + ACTION( Uniform1fv ); + ACTION( Uniform1i ); + ACTION( Uniform1iv ); + ACTION( Uniform2f ); + ACTION( Uniform2fv ); + ACTION( Uniform2i ); + ACTION( Uniform2iv ); + ACTION( Uniform3f ); + ACTION( Uniform3fv ); + ACTION( Uniform3i ); + ACTION( Uniform3iv ); + ACTION( Uniform4f ); + ACTION( Uniform4fv ); + ACTION( Uniform4i ); + ACTION( Uniform4iv ); + ACTION( UniformMatrix2fv ); + ACTION( UniformMatrix3fv ); + ACTION( UniformMatrix4fv ); + ACTION( UseProgram ); + ACTION( ValidateProgram ); + ACTION( VertexAttrib1f ); + ACTION( VertexAttrib1fv ); + ACTION( VertexAttrib2f ); + ACTION( VertexAttrib2fv ); + ACTION( VertexAttrib3f ); + ACTION( VertexAttrib3fv ); + ACTION( VertexAttrib4f ); + ACTION( VertexAttrib4fv ); + ACTION( VertexAttribPointer ); + ACTION( VertexPointer ); + ACTION( Viewport ); diff --git a/egl_1_4/global.c b/egl_1_4/global.c new file mode 100755 index 0000000..28bd842 --- /dev/null +++ b/egl_1_4/global.c @@ -0,0 +1,388 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * DongKyun Yun <dk77.yun@samsung.com> + * SangJin Kim <sangjin3.kim@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: + * - S-Core Co., Ltd + * + */ + +#include "implement.h" +#include <dlfcn.h> + + +struct GlobalStruct EGLINTER(global) = { + EGL_SUCCESS, + 1, + EGL_OPENGL_ES_API, + NULL, NULL, NULL, NULL, + 0, NULL, + 0, NULL, + 0, NULL, + 0, NULL, +}; + +void EGLAPIENTRY EGLINTER(NotBound)(void) { + fprintf(stderr, "EGL internal error: you are calling not-bound function\n"); +} + +void EGLAPIENTRY EGLINTER(ResetFnptrs)(struct GlobalStruct* ptr) { +#define ACTION(name) do { \ + *(void**)(&ptr->fp##name) = (void*)(&(EGLINTER(NotBound))); \ + } while (0) + ACTION( QueryVersion ); + ACTION( GetClientString ); + ACTION( QueryServerString ); + ACTION( ChooseFBConfig ); + ACTION( GetFBConfigAttrib ); + ACTION( CreatePbuffer ); + ACTION( CreatePixmap ); + ACTION( CreateWindow ); + ACTION( DestroyPbuffer ); + ACTION( DestroyPixmap ); + ACTION( DestroyWindow ); + ACTION( GetProcAddress ); + ACTION( QueryDrawable ); + ACTION( CreateNewContext ); + ACTION( DestroyContext ); + ACTION( GetCurrentContext ); + ACTION( GetCurrentDisplay ); + ACTION( GetCurrentReadDrawable ); + ACTION( GetCurrentDrawable ); + ACTION( MakeContextCurrent ); + ACTION( WaitGL ); + ACTION( WaitX ); + ACTION( SwapBuffers ); + ACTION( BindTexImageARB ); + ACTION( ReleaseTexImageARB ); + ACTION( SwapIntervalSGI ); +#undef ACTION +} + +void EGLAPIENTRY EGLINTER(BindFnptrs)(struct GlobalStruct* ptr) { + void* fnptr; + assert(ptr->dlGL != NULL); +#define ACTION(name) do { \ + fnptr = dlsym(ptr->dlGL, "glX" #name ); \ + if (fnptr != NULL) *(void**)(&ptr->fp##name) = fnptr; \ + } while (0) + ACTION( QueryVersion ); + ACTION( GetClientString ); + ACTION( QueryServerString ); + ACTION( ChooseFBConfig ); + ACTION( GetFBConfigAttrib ); + ACTION( CreatePbuffer ); + ACTION( CreatePixmap ); + ACTION( CreateWindow ); + ACTION( DestroyPbuffer ); + ACTION( DestroyPixmap ); + ACTION( DestroyWindow ); + ACTION( GetProcAddress ); + ACTION( QueryDrawable ); + ACTION( CreateNewContext ); + ACTION( DestroyContext ); + ACTION( GetCurrentContext ); + ACTION( GetCurrentDisplay ); + ACTION( GetCurrentReadDrawable ); + ACTION( GetCurrentDrawable ); + ACTION( MakeContextCurrent ); + ACTION( WaitGL ); + ACTION( WaitX ); + ACTION( SwapBuffers ); + ACTION( BindTexImageARB ); + ACTION( ReleaseTexImageARB ); + ACTION( SwapIntervalSGI ); +#undef ACTION +} + +struct DisplayExtra* EGLAPIENTRY EGLINTER(LookUpDisplay)(EGLDisplay unique) { + struct DisplayExtra* pUnit = EGLINTER(global).pDisplayExtra; + int nCount = EGLINTER(global).nDisplayExtra; + if (pUnit == NULL) return NULL; + if (unique == NULL) return NULL; + while (nCount--) { + if (pUnit->unique == unique) { + return pUnit; + } + pUnit++; + } + return NULL; +} + +struct DisplayExtra* EGLAPIENTRY EGLINTER(InsertDisplay)(EGLDisplay unique) { + struct DisplayExtra* pArea; + struct DisplayExtra* pUnit; + int nBytes = (EGLINTER(global).nDisplayExtra + 1) * sizeof(struct DisplayExtra); + if (unique == NULL) return NULL; + if ((pArea = (struct DisplayExtra*)realloc(EGLINTER(global).pDisplayExtra, nBytes)) == NULL) { + EGLINTER(SetError)(EGL_BAD_ALLOC); + return NULL; + } + pUnit = pArea + EGLINTER(global).nDisplayExtra; + memset(pUnit, 0, sizeof(struct DisplayExtra)); + pUnit->unique = unique; + EGLINTER(global).pDisplayExtra = pArea; + EGLINTER(global).nDisplayExtra++; + return pUnit; +} + +void EGLAPIENTRY EGLINTER(DeleteDisplay)(EGLDisplay unique) { + struct DisplayExtra* pUnit = EGLINTER(global).pDisplayExtra; + int nCount = EGLINTER(global).nDisplayExtra; + if (pUnit == NULL) return; + if (unique == NULL) return; + while (nCount--) { + if (pUnit->unique == unique) { + memmove(pUnit, pUnit + 1, nCount * sizeof(struct DisplayExtra)); + EGLINTER(global).nDisplayExtra--; + EGLINTER(global).pDisplayExtra + = (struct DisplayExtra*)realloc(EGLINTER(global).pDisplayExtra, + EGLINTER(global).nDisplayExtra * sizeof(struct DisplayExtra)); + return; + } + pUnit++; + } +} + +struct SurfaceExtra* EGLAPIENTRY EGLINTER(LookUpSurface)(EGLSurface unique) { + struct SurfaceExtra* pUnit = EGLINTER(global).pSurfaceExtra; + int nCount = EGLINTER(global).nSurfaceExtra; + if (pUnit == NULL) return NULL; + if (unique == NULL) return NULL; + while (nCount--) { + if (pUnit->unique == unique) { + return pUnit; + } + pUnit++; + } + return NULL; +} + +struct SurfaceExtra* EGLAPIENTRY EGLINTER(InsertSurface)(EGLSurface unique) { + struct SurfaceExtra* pArea; + struct SurfaceExtra* pUnit; + int nBytes = (EGLINTER(global).nSurfaceExtra + 1) * sizeof(struct SurfaceExtra); + if (unique == NULL) return NULL; + if ((pArea = (struct SurfaceExtra*)realloc(EGLINTER(global).pSurfaceExtra, nBytes)) == NULL) { + EGLINTER(SetError)(EGL_BAD_ALLOC); + return NULL; + } + pUnit = pArea + EGLINTER(global).nSurfaceExtra; + memset(pUnit, 0, sizeof(struct SurfaceExtra)); + pUnit->unique = unique; + EGLINTER(global).pSurfaceExtra = pArea; + EGLINTER(global).nSurfaceExtra++; + return pUnit; +} + +void EGLAPIENTRY EGLINTER(DeleteSurface)(EGLSurface unique) { + struct SurfaceExtra* pUnit = EGLINTER(global).pSurfaceExtra; + int nCount = EGLINTER(global).nSurfaceExtra; + if (pUnit == NULL) return; + if (unique == NULL) return; + while (nCount--) { + if (pUnit->unique == unique) { + memmove(pUnit, pUnit + 1, nCount * sizeof(struct SurfaceExtra)); + EGLINTER(global).nSurfaceExtra--; + EGLINTER(global).pSurfaceExtra + = (struct SurfaceExtra*)realloc(EGLINTER(global).pSurfaceExtra, + EGLINTER(global).nSurfaceExtra * sizeof(struct SurfaceExtra)); + return; + } + pUnit++; + } +} + +struct ContextExtra* EGLAPIENTRY EGLINTER(LookUpContext)(EGLContext unique) { + struct ContextExtra* pUnit = EGLINTER(global).pContextExtra; + int nCount = EGLINTER(global).nContextExtra; + if (pUnit == NULL) return NULL; + if (unique == NULL) return NULL; + while (nCount--) { + if (pUnit->unique == unique) { + return pUnit; + } + pUnit++; + } + return NULL; +} + +struct ContextExtra* EGLAPIENTRY EGLINTER(InsertContext)(EGLContext unique) { + struct ContextExtra* pArea; + struct ContextExtra* pUnit; + int nBytes = (EGLINTER(global).nContextExtra + 1) * sizeof(struct ContextExtra); + if (unique == NULL) return NULL; + if ((pArea = (struct ContextExtra*)realloc(EGLINTER(global).pContextExtra, nBytes)) == NULL) { + EGLINTER(SetError)(EGL_BAD_ALLOC); + return NULL; + } + pUnit = pArea + EGLINTER(global).nContextExtra; + memset(pUnit, 0, sizeof(struct ContextExtra)); + pUnit->unique = unique; + EGLINTER(global).pContextExtra = pArea; + EGLINTER(global).nContextExtra++; + return pUnit; +} + +void EGLAPIENTRY EGLINTER(DeleteContext)(EGLContext unique) { + struct ContextExtra* pUnit = EGLINTER(global).pContextExtra; + int nCount = EGLINTER(global).nContextExtra; + if (pUnit == NULL) return; + if (unique == NULL) return; + while (nCount--) { + if (pUnit->unique == unique) { + memmove(pUnit, pUnit + 1, nCount * sizeof(struct ContextExtra)); + EGLINTER(global).nContextExtra--; + EGLINTER(global).pContextExtra + = (struct ContextExtra*)realloc(EGLINTER(global).pContextExtra, + EGLINTER(global).nContextExtra * sizeof(struct ContextExtra)); + return; + } + pUnit++; + } +} +struct ImageExtra* EGLAPIENTRY EGLINTER(LookUpEGLImage)(EGLImageKHR unique) { + struct ImageExtra* pUnit = EGLINTER(global).pImageExtra; + int nCount = EGLINTER(global).nImageExtra; + if (pUnit == NULL) return NULL; + if (unique == NULL) return NULL; + while (nCount--) { + if (pUnit->unique == unique) { + return pUnit; + } + pUnit++; + } + return NULL; +} +struct ImageExtra* EGLAPIENTRY EGLINTER(InsertEGLImage)(EGLImageKHR unique) { + struct ImageExtra* pArea; + struct ImageExtra* pUnit; + int nBytes = (EGLINTER(global).nImageExtra + 1) * sizeof(struct ImageExtra); + if (unique == NULL) return NULL; + if ((pArea = (struct ImageExtra*)realloc(EGLINTER(global).pImageExtra, nBytes)) == NULL) { + EGLINTER(SetError)(EGL_BAD_ALLOC); + return NULL; + } + pUnit = pArea + EGLINTER(global).nImageExtra; + memset(pUnit, 0, sizeof(struct ImageExtra)); + pUnit->unique = unique; + EGLINTER(global).pImageExtra = pArea; + EGLINTER(global).nImageExtra++; + return pUnit; +} +void EGLAPIENTRY EGLINTER(DeleteEGLImage)(EGLImageKHR unique) { + struct ImageExtra* pUnit = EGLINTER(global).pImageExtra; + int nCount = EGLINTER(global).nImageExtra; + if (pUnit == NULL) return; + if (unique == NULL) return; + while (nCount--) { + if (pUnit->unique == unique) { + memmove(pUnit, pUnit + 1, nCount * sizeof(struct ImageExtra)); + EGLINTER(global).nImageExtra--; + EGLINTER(global).pImageExtra + = (struct ImageExtra*)realloc(EGLINTER(global).pImageExtra, + EGLINTER(global).nImageExtra * sizeof(struct ImageExtra)); + return; + } + pUnit++; + } +} +int EGLAPIENTRY EGLCROSS(GetEGLImagePixmapInfo)(EGLImageKHR img, + EGLNativeDisplayType *dpy, + Pixmap *pixmap, + int *width, int *height, int *depth) { + struct ImageExtra *pArea = EGLINTER(LookUpEGLImage)(img); + if (pArea == NULL) { + return -1; + } + *width = pArea->width; + *height = pArea->height; + *depth = pArea->depth; + *dpy = pArea->dpy; + *pixmap = pArea->pixmap; + return 0; +} + +#if defined(PROVIDING_RUNTIME_BINDING) + +void EGLAPIENTRY EGLINTER(ResetGLFnptrs)(struct GlobalStruct* ptr) { +#define ACTION(name) do { \ + *(void**)(&ptr->fp##name) = (void*)(&(EGLINTER(NotBound))); \ + } while (0) +#include "glfunclist.inl" +#undef ACTION +} + +void EGLAPIENTRY EGLINTER(BindGLFnptrs)(struct GlobalStruct* ptr) { + if (EGLINTER(global).dlGL == NULL) { + if ((EGLINTER(global).dlGL = dlopen(GL_SO_FILENAME, RTLD_NOW | RTLD_GLOBAL)) == NULL) { + EGLINTER(SetError)(EGL_BAD_ACCESS); + return; + } + } + void* dl = EGLINTER(global).dlGL; +#define ACTION(name) do { \ + *(void**)(&ptr->fp##name) = dlsym(dl, "gl" #name); \ + if (ptr->fp##name == NULL) *(void**)(&ptr->fp##name) = (void*)(&(EGLINTER(NotBound))); \ + } while (0) +#include "glfunclist.inl" +#undef ACTION +} + +void EGLAPIENTRY EGLINTER(BindES1Fnptrs)(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); + return; + } + } + void* dl = EGLINTER(global).dlES1; +#define ACTION(name) do { \ + *(void**)(&ptr->fp##name) = dlsym(dl, "gl" #name); \ + if (ptr->fp##name == NULL) *(void**)(&ptr->fp##name) = (void*)(&(EGLINTER(NotBound))); \ + } while (0) +#include "glfunclist.inl" +#undef ACTION +} + +void EGLAPIENTRY EGLINTER(BindES2Fnptrs)(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); + return; + } + } + void* dl = EGLINTER(global).dlES2; +#define ACTION(name) do { \ + *(void**)(&ptr->fp##name) = dlsym(dl, "gl" #name); \ + if (ptr->fp##name == NULL) *(void**)(&ptr->fp##name) = (void*)(&(EGLINTER(NotBound))); \ + } while (0) +#include "glfunclist.inl" +#undef ACTION +} + +#include "binding.inl" + +#endif diff --git a/egl_1_4/implement.h b/egl_1_4/implement.h new file mode 100755 index 0000000..8d82118 --- /dev/null +++ b/egl_1_4/implement.h @@ -0,0 +1,504 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * DongKyun Yun <dk77.yun@samsung.com> + * SangJin Kim <sangjin3.kim@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: + * - S-Core Co., Ltd + * + */ + +#ifndef _EGL_IMPLEMENT_H_ +#define _EGL_IMPLEMENT_H_ + +#include <EGL/egl.h> +#include <EGL/eglext.h> +#include <GL/glx.h> +#include <GL/glxext.h> +#include <assert.h> +#include <stdio.h> +#include <string.h> +#include <malloc.h> + + +#define HAZEL_EGL_VENDOR "Hazel" +#define HAZEL_EGL_MAJOR 1 +#define HAZEL_EGL_MINOR 4 + +#ifdef __cplusplus +extern "C" { +#endif + + +typedef int GLfixed; +typedef int GLclampx; + +#define EGLPREFIX "egl" +#define EGLEXTER(name) egl##name +#define EGLINTER(name) _hazel_egl_##name + + +struct ConfigExtra { + EGLint unique; + GLXFBConfig native; + EGLint bufferSize; + EGLint redSize; + EGLint greenSize; + EGLint blueSize; + EGLint luminanceSize; + EGLint alphaSize; + EGLint alphaMaskSize; + EGLBoolean bindToTexRGB; + EGLBoolean bindToTexRGBA; + EGLenum colorBufferType; + EGLenum configCaveat; + EGLenum conformant; + EGLint depthSize; + EGLint level; + EGLint maxPbufferWidth; + EGLint maxPbufferHeight; + EGLint maxPbufferPixels; + EGLint maxSwapInterval; + EGLint minSwapInterval; + EGLBoolean nativeRenderable; + XID nativeVisualID; + EGLenum nativeVisualType; + EGLenum renderableType; + EGLint sampleBuffers; + EGLint samples; + EGLint stencilSize; + EGLenum surfaceType; + EGLenum transparentType; + EGLint transparentRedValue; + EGLint transparentGreenValue; + EGLint transparentBlueValue; +}; + +struct DisplayExtra { + EGLDisplay unique; + EGLNativeDisplayType native; + EGLBoolean bInitialized; + EGLBoolean bInvokedWithDefault; + GLXFBConfig* pConfigBuffer; + EGLint nConfigExtra; + struct ConfigExtra* pConfigExtra; + EGLConfig* pConfigAnswer; +}; + +struct SurfaceExtra { + EGLSurface unique; + GLXDrawable native; + Drawable lowWinPix; + EGLDisplay display; + EGLConfig config; + EGLenum type; + + + EGLenum textureFormat; + EGLenum textureTarget; + EGLBoolean mipmapTexture; + EGLint mipmapLevel; + EGLenum renderBuffer; + EGLenum vgColorSpace; + EGLenum vgAlphaFormat; + + EGLenum swapBehavior; + EGLenum multisampleResolve; +}; + +struct ContextExtra { + EGLContext unique; + GLXContext native; + EGLDisplay display; + EGLConfig config; + EGLenum renderBuffer; + EGLenum apiKind; + EGLint apiVersion; + void* apiContext; +}; + +struct ImageExtra { + EGLImageKHR unique; + int width; + int height; + int depth; + 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 VG_SO_FILENAME "libOpenVG.so" //jcpark + +struct GlobalStruct { + EGLint iLastError; + EGLint iConfigID; + EGLenum currentAPI; + void* dlEGL; + void* dlGL; + void* dlES1; + void* dlES2; + void* dlVG;//jcpark + EGLint nDisplayExtra; + struct DisplayExtra* pDisplayExtra; + EGLint nSurfaceExtra; + struct SurfaceExtra* pSurfaceExtra; + EGLint nContextExtra; + struct ContextExtra* pContextExtra; + EGLint nImageExtra; + struct ImageExtra* pImageExtra; + Bool (*fpQueryVersion)(Display*, int*, int*); + const char* (*fpGetClientString)(Display*, int); + const char* (*fpQueryServerString)(Display*, int, int); + GLXFBConfig* (*fpChooseFBConfig)(Display*, int, const int*, int*); + int (*fpGetFBConfigAttrib)(Display*, GLXFBConfig, int, int*); + GLXPbuffer (*fpCreatePbuffer)(Display*, GLXFBConfig, const int*); + GLXPixmap (*fpCreatePixmap)(Display*, GLXFBConfig, Pixmap, const int*); + GLXWindow (*fpCreateWindow)(Display*, GLXFBConfig, Window, const int*); + void (*fpDestroyPbuffer)(Display*, GLXPbuffer); + void (*fpDestroyPixmap)(Display*, GLXPixmap); + void (*fpDestroyWindow)(Display*, GLXWindow); + __GLXextFuncPtr (*fpGetProcAddress)(const GLubyte*); + void (*fpQueryDrawable)(Display*, GLXDrawable, int, unsigned int*); + GLXContext (*fpCreateNewContext)(Display*, GLXFBConfig, int, GLXContext, Bool); + void (*fpDestroyContext)(Display*, GLXContext); + GLXContext (*fpGetCurrentContext)(void); + Display* (*fpGetCurrentDisplay)(void); + GLXDrawable (*fpGetCurrentReadDrawable)(void); + GLXDrawable (*fpGetCurrentDrawable)(void); + Bool (*fpMakeContextCurrent)(Display*, GLXDrawable, GLXDrawable, GLXContext); + void (*fpWaitGL)(void); + void (*fpWaitX)(void); + void (*fpSwapBuffers)(Display*, GLXDrawable); + void (*fpBindTexImageARB)(Display*, GLXDrawable, int ); + void (*fpReleaseTexImageARB)(Display*, GLXDrawable, int); + int (*fpSwapIntervalSGI)(int); +#if defined(PROVIDING_RUNTIME_BINDING) + GLboolean (*fpIsBuffer)(GLuint); + GLboolean (*fpIsEnabled)(GLenum); + GLboolean (*fpIsFramebuffer)(GLuint); + GLboolean (*fpIsProgram)(GLuint); + GLboolean (*fpIsRenderbuffer)(GLuint); + GLboolean (*fpIsShader)(GLuint); + GLboolean (*fpIsTexture)(GLuint); + GLenum (*fpCheckFramebufferStatus)(GLenum); + GLenum (*fpGetError)(void); + GLint (*fpGetAttribLocation)(GLuint, const GLchar*); + GLint (*fpGetUniformLocation)(GLuint, const GLchar*); + GLuint (*fpCreateProgram)(void); + GLuint (*fpCreateShader)(GLenum); + const GLubyte* (*fpGetString)(GLenum); + void (*fpActiveTexture)(GLenum); + void (*fpAlphaFunc)(GLenum, GLclampf); + void (*fpAttachShader)(GLuint, GLuint); + void (*fpBindAttribLocation)(GLuint, GLuint, const GLchar*); + void (*fpBindBuffer)(GLenum, GLuint); + void (*fpBindFramebuffer)(GLenum, GLuint); + void (*fpBindRenderbuffer)(GLenum, GLuint); + void (*fpBindTexture)(GLenum, GLuint); + void (*fpBlendColor)(GLclampf, GLclampf, GLclampf, GLclampf); + void (*fpBlendEquation)(GLenum); + void (*fpBlendEquationSeparate)(GLenum, GLenum); + void (*fpBlendFunc)(GLenum, GLenum); + void (*fpBlendFuncSeparate)(GLenum, GLenum, GLenum, GLenum); + void (*fpBufferData)(GLenum, GLsizeiptr, const GLvoid*, GLenum); + void (*fpBufferSubData)(GLenum, GLintptr, GLsizeiptr, const GLvoid*); + void (*fpClear)(GLbitfield); + void (*fpClearColor)(GLclampf, GLclampf, GLclampf, GLclampf); + void (*fpClearColorx)(GLclampx, GLclampx, GLclampx, GLclampx); + void (*fpClearDepthf)(GLclampd); + void (*fpClearStencil)(GLint); + void (*fpClientActiveTexture)(GLenum); + void (*fpClipPlane)(GLenum, const GLdouble*); + void (*fpColor4f)(GLfloat, GLfloat, GLfloat, GLfloat); + void (*fpColor4ub)(GLubyte, GLubyte, GLubyte, GLubyte); + void (*fpColorMask)(GLboolean, GLboolean, GLboolean, GLboolean); + void (*fpColorPointer)(GLint, GLenum, GLsizei, const GLvoid*); + void (*fpCompileShader)(GLuint); + void (*fpCompressedTexImage2D)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid*); + void (*fpCompressedTexSubImage2D)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid*); + void (*fpCopyTexImage2D)(GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint); + void (*fpCopyTexSubImage2D)(GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); + void (*fpCullFace)(GLenum); + void (*fpDeleteBuffers)(GLsizei, const GLuint*); + void (*fpDeleteFramebuffers)(GLsizei, const GLuint*); + void (*fpDeleteProgram)(GLuint); + void (*fpDeleteRenderbuffers)(GLsizei, const GLuint*); + void (*fpDeleteShader)(GLuint); + void (*fpDeleteTextures)(GLsizei, const GLuint*); + void (*fpDepthFunc)(GLenum); + void (*fpDepthMask)(GLboolean); + void (*fpDepthRangef)(GLclampf, GLclampf); + void (*fpDetachShader)(GLuint, GLuint); + void (*fpDisable)(GLenum); + void (*fpDisableClientState)(GLenum); + void (*fpDisableVertexAttribArray)(GLuint); + void (*fpDrawArrays)(GLenum, GLint, GLsizei); + void (*fpDrawElements)(GLenum, GLsizei, GLenum, const void*); + void (*fpEnable)(GLenum); + void (*fpEnableClientState)(GLenum); + void (*fpEnableVertexAttribArray)(GLuint); + void (*fpFinish)(void); + void (*fpFlush)(void); + void (*fpFogf)(GLenum, GLfloat); + void (*fpFogfv)(GLenum, const GLfloat*); + void (*fpFogi)(GLenum, GLint); + void (*fpFramebufferRenderbuffer)(GLenum, GLenum, GLenum, GLuint); + void (*fpFramebufferTexture2D)(GLenum, GLenum, GLenum, GLuint, GLint); + void (*fpFrontFace)(GLenum); + void (*fpGenBuffers)(GLsizei, GLuint*); + void (*fpGenFramebuffers)(GLsizei, GLuint*); + void (*fpGenRenderbuffers)(GLsizei, GLuint*); + void (*fpGenTextures)(GLsizei, GLuint*); + void (*fpGenerateMipmap)(GLenum); + void (*fpGetActiveAttrib)(GLuint, GLuint, GLsizei, GLsizei*, GLint*, GLenum*, GLchar*); + void (*fpGetActiveUniform)(GLuint, GLuint, GLsizei, GLsizei*, GLint*, GLenum*, GLchar*); + void (*fpGetAttachedShaders)(GLuint, GLsizei, GLsizei*, GLuint*); + void (*fpGetBooleanv)(GLenum, GLboolean*); + void (*fpGetBufferParameteriv)(GLenum, GLenum, GLint*); + void (*fpGetBufferSubData)(GLenum, GLintptr, GLsizeiptr, const GLvoid* data); + void (*fpGetClipPlane)(GLenum, GLdouble*); + void (*fpGetFloatv)(GLenum, GLfloat*); + void (*fpGetFramebufferAttachmentParameteriv)(GLenum, GLenum, GLenum, GLint*); + void (*fpGetIntegerv)(GLenum, GLint*); + void (*fpGetLightfv)(GLenum, GLenum, GLfloat*); + void (*fpGetMaterialfv)(GLenum, GLenum, GLfloat*); + void (*fpGetPointerv)(GLenum, GLvoid**); + void (*fpGetProgramInfoLog)(GLuint, GLsizei, GLsizei*, GLchar*); + void (*fpGetProgramiv)(GLuint, GLenum, GLint*); + void (*fpGetRenderbufferParameteriv)(GLenum, GLenum, GLint*); + void (*fpGetShaderInfoLog)(GLuint, GLsizei, GLsizei*, GLchar*); + void (*fpGetShaderSource)(GLuint, GLsizei, GLsizei*, GLchar*); + void (*fpGetShaderiv)(GLuint, GLenum, GLint*); + void (*fpGetTexEnvfv)(GLenum, GLenum, GLfloat*); + void (*fpGetTexEnviv)(GLenum, GLenum, GLint*); + void (*fpGetTexLevelParameteriv)(GLenum, GLint, GLenum, GLint*); + void (*fpGetTexParameterfv)(GLenum, GLenum, GLfloat*); + void (*fpGetTexParameteriv)(GLenum, GLenum, GLint*); + void (*fpGetUniformfv)(GLuint, GLint, GLfloat*); + void (*fpGetUniformiv)(GLuint, GLint, GLint*); + void (*fpGetVertexAttribPointerv)(GLuint, GLenum, void**); + void (*fpGetVertexAttribfv)(GLuint, GLenum, GLfloat*); + void (*fpGetVertexAttribiv)(GLuint, GLenum, GLint*); + void (*fpHint)(GLenum, GLenum); + void (*fpLightModelf)(GLenum, GLfloat); + void (*fpLightModelfv)(GLenum, const GLfloat*); + void (*fpLightf)(GLenum, GLenum, GLfloat); + void (*fpLightfv)(GLenum, GLenum, const GLfloat*); + void (*fpLineWidth)(GLfloat); + void (*fpLinkProgram)(GLuint); + void (*fpLoadIdentity)(void); + void (*fpLoadMatrixf)(const GLfloat*); + void (*fpLogicOp)(GLenum); + void (*fpMaterialf)(GLenum, GLenum, GLfloat); + void (*fpMaterialfv)(GLenum, GLenum, const GLfloat*); + void (*fpMatrixMode)(GLenum); + void (*fpMultMatrixf)(const GLfloat*); + void (*fpMultiTexCoord4f)(GLenum, GLfloat, GLfloat, GLfloat, GLfloat); + void (*fpNormal3f)(GLfloat, GLfloat, GLfloat); + void (*fpNormalPointer)(GLenum, GLsizei, const GLvoid*); + void (*fpOrtho)(GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble); + void (*fpOrthof)(GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); + void (*fpOrthox)(GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed); + void (*fpPixelStorei)(GLenum, GLint); + void (*fpPointParameterf)(GLenum, GLfloat); + void (*fpPointParameterfv)(GLenum, const GLfloat*); + void (*fpPointSize)(GLfloat); + void (*fpPolygonOffset)(GLfloat, GLfloat); + void (*fpPopMatrix)(void); + void (*fpPushMatrix)(void); + void (*fpReadPixels)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid*); + void (*fpRenderbufferStorage)(GLenum, GLenum, GLsizei, GLsizei); + void (*fpRotatef)(GLfloat, GLfloat, GLfloat, GLfloat); + void (*fpRotatex)(GLfixed, GLfixed, GLfixed, GLfixed); + void (*fpSampleCoverage)(GLclampf, GLboolean); + void (*fpScalef)(GLfloat, GLfloat, GLfloat); + void (*fpScissor)(GLint, GLint, GLsizei, GLsizei); + void (*fpShadeModel)(GLenum); + void (*fpShaderSource)(GLuint, GLsizei, const GLchar**, const GLint*); + void (*fpStencilFunc)(GLenum, GLint, GLuint); + void (*fpStencilFuncSeparate)(GLenum, GLenum, GLint, GLuint); + void (*fpStencilMask)(GLuint); + void (*fpStencilMaskSeparate)(GLenum, GLuint); + void (*fpStencilOp)(GLenum, GLenum, GLenum); + void (*fpStencilOpSeparate)(GLenum, GLenum, GLenum, GLenum); + void (*fpTexCoordPointer)(GLint, GLenum, GLsizei, const GLvoid*); + void (*fpTexEnvf)(GLenum, GLenum, GLfloat); + void (*fpTexEnvfv)(GLenum, GLenum, const GLfloat*); + void (*fpTexEnvi)(GLenum, GLenum, GLint); + void (*fpTexEnviv)(GLenum, GLenum, const GLint*); + void (*fpTexImage2D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid*); + void (*fpTexParameterf)(GLenum, GLenum, GLfloat); + void (*fpTexParameterfv)(GLenum, GLenum, const GLfloat*); + void (*fpTexParameteri)(GLenum, GLenum, GLint); + void (*fpTexParameteriv)(GLenum, GLenum, const GLint*); + void (*fpTexSubImage2D)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid*); + void (*fpTranslatef)(GLfloat, GLfloat, GLfloat); + void (*fpTranslatex)(GLfixed, GLfixed, GLfixed); + void (*fpUniform1f)(GLint, GLfloat); + void (*fpUniform1fv)(GLint, GLsizei, const GLfloat*); + void (*fpUniform1i)(GLint, GLint); + void (*fpUniform1iv)(GLint, GLsizei, const GLint*); + void (*fpUniform2f)(GLint, GLfloat, GLfloat); + void (*fpUniform2fv)(GLint, GLsizei, const GLfloat*); + void (*fpUniform2i)(GLint, GLint, GLint); + void (*fpUniform2iv)(GLint, GLsizei, const GLint*); + void (*fpUniform3f)(GLint, GLfloat, GLfloat, GLfloat); + void (*fpUniform3fv)(GLint, GLsizei, const GLfloat*); + void (*fpUniform3i)(GLint, GLint, GLint, GLint); + void (*fpUniform3iv)(GLint, GLsizei, const GLint*); + void (*fpUniform4f)(GLint, GLfloat, GLfloat, GLfloat, GLfloat); + void (*fpUniform4fv)(GLint, GLsizei, const GLfloat*); + void (*fpUniform4i)(GLint, GLint, GLint, GLint, GLint); + void (*fpUniform4iv)(GLint, GLsizei, const GLint*); + void (*fpUniformMatrix2fv)(GLint, GLsizei, GLboolean, const GLfloat*); + void (*fpUniformMatrix3fv)(GLint, GLsizei, GLboolean, const GLfloat*); + void (*fpUniformMatrix4fv)(GLint, GLsizei, GLboolean, const GLfloat*); + void (*fpUseProgram)(GLuint); + void (*fpValidateProgram)(GLuint); + void (*fpVertexAttrib1f)(GLuint, GLfloat); + void (*fpVertexAttrib1fv)(GLuint, const GLfloat*); + void (*fpVertexAttrib2f)(GLuint, GLfloat, GLfloat); + void (*fpVertexAttrib2fv)(GLuint, const GLfloat*); + void (*fpVertexAttrib3f)(GLuint, GLfloat, GLfloat, GLfloat); + void (*fpVertexAttrib3fv)(GLuint, const GLfloat*); + void (*fpVertexAttrib4f)(GLuint, GLfloat, GLfloat, GLfloat, GLfloat); + void (*fpVertexAttrib4fv)(GLuint, const GLfloat*); + void (*fpVertexAttribPointer)(GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid*); + void (*fpVertexPointer)(GLint, GLenum, GLsizei, const GLvoid*); + void (*fpViewport)(GLint, GLint, GLsizei, GLsizei); +#endif +}; + +extern struct GlobalStruct EGLINTER(global); + +#define FNPTR(name) (EGLINTER(global).fp##name) + +extern struct SurfaceExtra surfaceExtraDefault; + +EGLAPI void EGLAPIENTRY EGLINTER(NotBound)(void); + +EGLAPI void EGLAPIENTRY EGLINTER(SetError)(EGLint iError); + + +EGLAPI void EGLAPIENTRY EGLINTER(ResetFnptrs)(struct GlobalStruct* ptr); +EGLAPI void EGLAPIENTRY EGLINTER(BindFnptrs)(struct GlobalStruct* ptr); + +EGLAPI int EGLAPIENTRY EGLINTER(PrepareConfig)(struct DisplayExtra* pDisplay); +EGLAPI struct ConfigExtra* EGLINTER(LookUpConfig)(struct DisplayExtra* pDisplay, EGLConfig config); + +EGLAPI struct DisplayExtra* EGLAPIENTRY EGLINTER(LookUpDisplay)(EGLDisplay unique); +EGLAPI struct DisplayExtra* EGLAPIENTRY EGLINTER(InsertDisplay)(EGLDisplay unique); +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 struct ContextExtra* EGLAPIENTRY EGLINTER(LookUpContext)(EGLContext unique); +EGLAPI struct ContextExtra* EGLAPIENTRY EGLINTER(InsertContext)(EGLContext unique); +EGLAPI void EGLAPIENTRY EGLINTER(DeleteContext)(EGLContext unique); + +EGLAPI struct ImageExtra* EGLAPIENTRY EGLINTER(LookUpEGLImage)(EGLImageKHR unique); +EGLAPI struct ImageExtra* EGLAPIENTRY EGLINTER(InsertEGLImage)(EGLImageKHR unique); +EGLAPI void EGLAPIENTRY EGLINTER(DeleteEGLImage)(EGLImageKHR unique); + +#define EGLCROSS(name) __hazel_cross__##name +#define EGLCROSS_PREFIX "__hazel_cross__" + +EGLAPI void* EGLAPIENTRY EGLCROSS(CreateContext)(void); +EGLAPI void EGLAPIENTRY EGLCROSS(MakeCurrent)(void*); +EGLAPI void EGLAPIENTRY EGLCROSS(ReleaseContext)(void*); +EGLAPI int EGLAPIENTRY EGLCROSS(GetEGLImagePixmapInfo)(EGLImageKHR img, + EGLNativeDisplayType *dpy, + Pixmap *pixmap, + int *width, int *height, int *depth); + +#if defined(PROVIDING_RUNTIME_BINDING) + +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); + +#endif + + +// VG variables //jcpark +typedef enum { + /* RGB{A,X} channel ordering */ + VG_sRGBX_8888 = 0, + VG_sRGBA_8888 = 1, + VG_sRGBA_8888_PRE = 2, + VG_sRGB_565 = 3, + VG_sRGBA_5551 = 4, + VG_sRGBA_4444 = 5, + VG_sL_8 = 6, + VG_lRGBX_8888 = 7, + VG_lRGBA_8888 = 8, + VG_lRGBA_8888_PRE = 9, + VG_lL_8 = 10, + VG_A_8 = 11, + VG_BW_1 = 12, + VG_A_1 = 13, + VG_A_4 = 14, + + /* {A,X}RGB channel ordering */ + VG_sXRGB_8888 = 0 | (1 << 6), + VG_sARGB_8888 = 1 | (1 << 6), + VG_sARGB_8888_PRE = 2 | (1 << 6), + VG_sARGB_1555 = 4 | (1 << 6), + VG_sARGB_4444 = 5 | (1 << 6), + VG_lXRGB_8888 = 7 | (1 << 6), + VG_lARGB_8888 = 8 | (1 << 6), + VG_lARGB_8888_PRE = 9 | (1 << 6), + + /* BGR{A,X} channel ordering */ + VG_sBGRX_8888 = 0 | (1 << 7), + VG_sBGRA_8888 = 1 | (1 << 7), + VG_sBGRA_8888_PRE = 2 | (1 << 7), + VG_sBGR_565 = 3 | (1 << 7), + VG_sBGRA_5551 = 4 | (1 << 7), + VG_sBGRA_4444 = 5 | (1 << 7), + VG_lBGRX_8888 = 7 | (1 << 7), + VG_lBGRA_8888 = 8 | (1 << 7), + VG_lBGRA_8888_PRE = 9 | (1 << 7), + + /* {A,X}BGR channel ordering */ + VG_sXBGR_8888 = 0 | (1 << 6) | (1 << 7), + VG_sABGR_8888 = 1 | (1 << 6) | (1 << 7), + VG_sABGR_8888_PRE = 2 | (1 << 6) | (1 << 7), + VG_sABGR_1555 = 4 | (1 << 6) | (1 << 7), + VG_sABGR_4444 = 5 | (1 << 6) | (1 << 7), + VG_lXBGR_8888 = 7 | (1 << 6) | (1 << 7), + VG_lABGR_8888 = 8 | (1 << 6) | (1 << 7), + VG_lABGR_8888_PRE = 9 | (1 << 6) | (1 << 7) +} VGImageFormat; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/egl_1_4/makefile b/egl_1_4/makefile new file mode 100755 index 0000000..9d05ac4 --- /dev/null +++ b/egl_1_4/makefile @@ -0,0 +1,17 @@ +#!make + +default: + make -f makefile-dynamic clean + make -f makefile-dynamic install + +install: + make -f makefile-dynamic install + +clean: + make -f makefile-dynamic clean + +clobber: + make -f makefile-dynamic clobber + +wc: + make -f makefile-dynamic wc diff --git a/egl_1_4/makefile-dynamic b/egl_1_4/makefile-dynamic new file mode 100755 index 0000000..d1740df --- /dev/null +++ b/egl_1_4/makefile-dynamic @@ -0,0 +1,84 @@ +#!/bin/make + + +CFLAGS = -I. -I../include -fPIC -DPROVIDING_RUNTIME_BINDING -Werror-implicit-function-declaration -O0 -g3 +ARFLAGS = rucv + + +#LIB = libEGLbind.a + +LIBBASE = libEGL.so +LIBVER = 1.0 +LIB = $(LIBBASE).$(LIBVER) + +END = +SRCS = \ + 31Error.c \ + 32GetDisplay.c \ + 32Initialize.c \ + 32Terminate.c \ + 33QueryString.c \ + 34GetConfigs.c \ + 34ChooseConfig.c \ + 34GetConfigAttrib.c \ + 35CreateWindowSurface.c \ + 35CreatePbufferSurface.c \ + 35CreatePbufferFromClientBuffer.c \ + 35CreatePixmapSurface.c \ + 35DestroySurface.c \ + 36SurfaceAttrib.c \ + 36QuerySurface.c \ + 36BindTexImage.c \ + 36ReleaseTexImage.c \ + 37BindAPI.c \ + 37QueryAPI.c \ + 37CreateContext.c \ + 37DestroyContext.c \ + 37MakeCurrent.c \ + 37GetCurrentContext.c \ + 37GetCurrentSurface.c \ + 37GetCurrentDisplay.c \ + 37QueryContext.c \ + 38WaitClient.c \ + 38WaitGL.c \ + 38WaitNative.c \ + 39SwapBuffers.c \ + 39CopyBuffers.c \ + 39SwapInterval.c \ + 3AGetProcAddress.c \ + 3BReleaseThread.c \ + 41LockSurfaceKHR.c \ + 41UnlockSurfaceKHR.c \ + 42CreateImageKHR.c \ + 42DestroyImageKHR.c \ + global.c \ + $(END) +OBJS = $(SRCS:.c=.o) + +default: __touch__ $(LIB) + +__touch__: + touch 33QueryString.c + +$(LIB): $(OBJS) + $(CC) -shared -Wl,-soname,$(LIBBASE).1 -I../include -o $@ $(OBJS) -I../include -ldl -lX11 +# $(AR) $(ARFLAGS) $@ $(OBJS) + + +install: $(LIB) + cp $(LIB) ../lib + + +# supports + +clean: + $(RM) $(RMFLAGS) $(OBJS) + +clobber: clean + $(RM) $(RMFLAGS) $(LIB) core a.out + +wc: + wc $(SRCS) *.inl *.h + +#$(OBJS): EGL/egl.h EGL/eglext.h EGL/eglplatform.h +global.o: binding.inl diff --git a/egl_1_4/makefile-single b/egl_1_4/makefile-single new file mode 100755 index 0000000..3b880bf --- /dev/null +++ b/egl_1_4/makefile-single @@ -0,0 +1,84 @@ +#!/bin/make + + +CFLAGS = -I. -I../include -fPIC -Werror-implicit-function-declaration -O0 -g3 +ARFLAGS = rucv + + +#LIB = libEGL.a + +LIBBASE = libEGL.so +LIBVER = 1.0 +LIB = $(LIBBASE).$(LIBVER) + +END = +SRCS = \ + 31Error.c \ + 32GetDisplay.c \ + 32Initialize.c \ + 32Terminate.c \ + 33QueryString.c \ + 34GetConfigs.c \ + 34ChooseConfig.c \ + 34GetConfigAttrib.c \ + 35CreateWindowSurface.c \ + 35CreatePbufferSurface.c \ + 35CreatePbufferFromClientBuffer.c \ + 35CreatePixmapSurface.c \ + 35DestroySurface.c \ + 36SurfaceAttrib.c \ + 36QuerySurface.c \ + 36BindTexImage.c \ + 36ReleaseTexImage.c \ + 37BindAPI.c \ + 37QueryAPI.c \ + 37CreateContext.c \ + 37DestroyContext.c \ + 37MakeCurrent.c \ + 37GetCurrentContext.c \ + 37GetCurrentSurface.c \ + 37GetCurrentDisplay.c \ + 37QueryContext.c \ + 38WaitClient.c \ + 38WaitGL.c \ + 38WaitNative.c \ + 39SwapBuffers.c \ + 39CopyBuffers.c \ + 39SwapInterval.c \ + 3AGetProcAddress.c \ + 3BReleaseThread.c \ + 41LockSurfaceKHR.c \ + 41UnlockSurfaceKHR.c \ + 42CreateImageKHR.c \ + 42DestroyImageKHR.c \ + global.c \ + $(END) +OBJS = $(SRCS:.c=.o) + + +default: __touch__ $(LIB) + +__touch__: + touch 33QueryString.c + +$(LIB): $(OBJS) + $(CC) -shared -Wl,-soname,$(LIBBASE).1 -o $@ $(OBJS) + +# $(AR) $(ARFLAGS) $@ $(OBJS) + +install: $(LIB) + cp $(LIB) ../lib + + +# supports + +clean: + $(RM) $(RMFLAGS) $(OBJS) + +clobber: clean + $(RM) $(RMFLAGS) $(LIB) core a.out + +wc: + wc $(SRCS) *.inl *.h + +$(OBJS): EGL/egl.h EGL/eglext.h EGL/eglplatform.h |