Initial commit
[profile/ivi/simulator-opengl.git] / egl_1_4 / 33QueryString.c
1 /* 
2  * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
3  * 
4  * Contact:
5  * DongKyun Yun <dk77.yun@samsung.com>
6  * SangJin Kim <sangjin3.kim@samsung.com>
7  * HyunGoo Kang <hyungoo1.kang@samsung.com>
8  *
9  * Permission is hereby granted, free of charge, to any person obtaining a copy of
10  * this software and associated documentation files (the "Software"), to deal in
11  * the Software without restriction, including without limitation the rights to
12  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
13  * of the Software, and to permit persons to whom the Software is furnished to do
14  * so, subject to the following conditions:
15  * 
16  * The above copyright notice and this permission notice shall be included in all
17  * copies or substantial portions of the Software.
18  * 
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25  * SOFTWARE.
26  * 
27  * Contributors:
28  * - S-Core Co., Ltd
29  *
30  */
31
32 #include "implement.h"
33
34
35 const char* EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name) {
36         struct DisplayExtra* pDisplay;
37         static char buf[256];
38         pDisplay = EGLINTER(LookUpDisplay)(dpy);
39         if (pDisplay == NULL) {
40                 EGLINTER(SetError)(EGL_BAD_DISPLAY);
41                 return NULL;
42         }
43         if (pDisplay->bInitialized == EGL_FALSE) {
44                 EGLINTER(SetError)(EGL_NOT_INITIALIZED);
45                 return NULL;
46         }
47         switch (name) {
48         case EGL_CLIENT_APIS:
49 #if defined(PROVIDING_RUNTIME_BINDING)
50                 return "OpenGL_ES OpenGL";
51 #else
52                 return "OpenGL_ES";      
53 #endif
54                 break;
55         case EGL_VENDOR:
56 #if defined(PROVIDING_RUNTIME_BINDING)
57                 return HAZEL_EGL_VENDOR " dynamic (compiled on " __DATE__ " " __TIME__ ")";
58 #else
59                 return HAZEL_EGL_VENDOR "(compiled on " __DATE__ " " __TIME__ ")";
60 #endif
61                 break;
62         case EGL_VERSION:
63                 sprintf(buf, "%d.%d (on GLX %s %s)", HAZEL_EGL_MAJOR, HAZEL_EGL_MINOR,
64                         FNPTR(GetClientString)(pDisplay->native, GLX_VENDOR),
65                         FNPTR(GetClientString)(pDisplay->native, GLX_VERSION));
66                 return buf;
67                 break;
68         case EGL_EXTENSIONS:
69                 return "EGL_KHR_image";
70                 break;
71         default:
72                 EGLINTER(SetError)(EGL_BAD_PARAMETER);
73                 return NULL;
74         }
75 }
76
77