summaryrefslogtreecommitdiff
path: root/egl_1_4/34GetConfigAttrib.c
diff options
context:
space:
mode:
Diffstat (limited to 'egl_1_4/34GetConfigAttrib.c')
-rwxr-xr-xegl_1_4/34GetConfigAttrib.c117
1 files changed, 117 insertions, 0 deletions
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;
+}