scons: Ensure the OpenVG/EGL import libs are also prefixed with 'lib'.
[mesa.git] / src / gallium / targets / egl-static / egl_st.c
1 /*
2 * Mesa 3-D graphics library
3 * Version: 7.10
4 *
5 * Copyright (C) 2011 LunarG Inc.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23 * DEALINGS IN THE SOFTWARE.
24 *
25 * Authors:
26 * Chia-I Wu <olv@lunarg.com>
27 */
28 #include "util/u_debug.h"
29 #include "state_tracker/st_api.h"
30 #include "egl_st.h"
31
32 /* for st/mesa */
33 #include "state_tracker/st_gl_api.h"
34 /* for st/vega */
35 #include "vg_api.h"
36
37 static struct st_api *
38 st_GL_create_api(void)
39 {
40 #if FEATURE_GL || FEATURE_ES1 || FEATURE_ES2
41 return st_gl_api_create();
42 #else
43 return NULL;
44 #endif
45 }
46
47 static struct st_api *
48 st_OpenVG_create_api(void)
49 {
50 #if FEATURE_VG
51 return (struct st_api *) vg_api_get();
52 #else
53 return NULL;
54 #endif
55 }
56
57 struct st_api *
58 egl_st_create_api(enum st_api_type api)
59 {
60 struct st_api *stapi;
61
62 switch (api) {
63 case ST_API_OPENGL:
64 stapi = st_GL_create_api();
65 break;
66 case ST_API_OPENVG:
67 stapi = st_OpenVG_create_api();
68 break;
69 default:
70 assert(!"Unknown API Type\n");
71 stapi = NULL;
72 break;
73 }
74
75 return stapi;
76 }
77
78 uint
79 egl_st_get_profile_mask(enum st_api_type api)
80 {
81 uint mask = 0x0;
82
83 switch (api) {
84 case ST_API_OPENGL:
85 #if FEATURE_GL
86 mask |= ST_PROFILE_DEFAULT_MASK;
87 #endif
88 #if FEATURE_ES1
89 mask |= ST_PROFILE_OPENGL_ES1_MASK;
90 #endif
91 #if FEATURE_ES2
92 mask |= ST_PROFILE_OPENGL_ES2_MASK;
93 #endif
94 break;
95 case ST_API_OPENVG:
96 #if FEATURE_VG
97 mask |= ST_PROFILE_DEFAULT_MASK;
98 #endif
99 break;
100 default:
101 break;
102 }
103
104 return mask;
105 }