aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/targets/egl-gdi/egl-static.c
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2010-09-10 12:59:43 +0800
committerChia-I Wu <[email protected]>2010-09-10 15:44:11 +0800
commit948e3fa27ca9112b903a180d1a18c61cfb2928dc (patch)
tree80b9a684a2f12ed60a65757860203d2bff825fad /src/gallium/targets/egl-gdi/egl-static.c
parent0cd480f07639ec9ee01424aaa3e0c900b2204d4f (diff)
st/egl: Use profiles to create OpenGL ES contexts.
Replace all uses of ST_API_OPENGL_ES{1,2} by profiles. Having 3 st_api's to provide OpenGL, OpenGL ES 1.1, and OpenGL ES 2.0 is not a sane abstraction, since all of them share glapi for current context/dispatch management.
Diffstat (limited to 'src/gallium/targets/egl-gdi/egl-static.c')
-rw-r--r--src/gallium/targets/egl-gdi/egl-static.c86
1 files changed, 23 insertions, 63 deletions
diff --git a/src/gallium/targets/egl-gdi/egl-static.c b/src/gallium/targets/egl-gdi/egl-static.c
index 4655d791170..da6e5ce3396 100644
--- a/src/gallium/targets/egl-gdi/egl-static.c
+++ b/src/gallium/targets/egl-gdi/egl-static.c
@@ -35,27 +35,6 @@
static struct st_api *stapis[ST_API_COUNT];
-static uint
-get_api_mask(void)
-{
- uint api_mask = 0x0;
-
-#if FEATURE_GL
- api_mask |= 1 << ST_API_OPENGL;
-#endif
-#if FEATURE_ES1
- api_mask |= 1 << ST_API_OPENGL_ES1;
-#endif
-#if FEATURE_ES2
- api_mask |= 1 << ST_API_OPENGL_ES2;
-#endif
-#if FEATURE_VG
- api_mask |= 1 << ST_API_OPENVG;
-#endif
-
- return api_mask;
-}
-
static struct st_api *
get_st_api(enum st_api_type api)
{
@@ -66,28 +45,18 @@ get_st_api(enum st_api_type api)
return stapi;
switch (api) {
-#if FEATURE_GL
- case ST_API_OPENGL:
- stapi = st_gl_api_create();
- break;
-#endif
-#if FEATURE_ES1
- case ST_API_OPENGL_ES1:
- stapi = st_gl_api_create_es1();
- break;
-#endif
-#if FEATURE_ES2
- case ST_API_OPENGL_ES2:
- stapi = st_gl_api_create_es2();
- break;
+#if FEATURE_GL || FEATURE_ES1 || FEATURE_ES2
+ case ST_API_OPENGL:
+ stapi = st_gl_api_create();
+ break;
#endif
#if FEATURE_VG
- case ST_API_OPENVG:
- stapi = (struct st_api *) vg_api_get();
- break;
+ case ST_API_OPENVG:
+ stapi = (struct st_api *) vg_api_get();
+ break;
#endif
- default:
- break;
+ default:
+ break;
}
stapis[api] = stapi;
@@ -96,27 +65,9 @@ get_st_api(enum st_api_type api)
}
static struct st_api *
-guess_gl_api(void)
+guess_gl_api(enum st_profile_type profile)
{
- struct st_api *stapi = NULL;
-
-#if FEATURE_GL
- stapi = get_st_api(ST_API_OPENGL);
- if (stapi)
- return stapi;
-#endif
-#if FEATURE_ES1
- stapi = get_st_api(ST_API_OPENGL_ES1);
- if (stapi)
- return stapi;
-#endif
-#if FEATURE_ES2
- stapi = get_st_api(ST_API_OPENGL_ES2);
- if (stapi)
- return stapi;
-#endif
-
- return stapi;
+ return get_st_api(ST_API_OPENGL);
}
static struct pipe_screen *
@@ -140,10 +91,19 @@ create_sw_screen(struct sw_winsys *ws)
static void
init_loader(struct egl_g3d_loader *loader)
{
- if (loader->api_mask)
- return;
+#if FEATURE_GL
+ loader->profile_masks[ST_API_OPENGL] |= ST_PROFILE_DEFAULT_MASK;
+#endif
+#if FEATURE_ES1
+ loader->profile_masks[ST_API_OPENGL] |= ST_PROFILE_OPENGL_ES1_MASK;
+#endif
+#if FEATURE_ES2
+ loader->profile_masks[ST_API_OPENGL] |= ST_PROFILE_OPENGL_ES2_MASK;
+#endif
+#if FEATURE_VG
+ loader->profile_masks[ST_API_OPENVG] |= ST_PROFILE_DEFAULT_MASK;
+#endif
- loader->api_mask = get_api_mask();
loader->get_st_api = get_st_api;
loader->guess_gl_api = guess_gl_api;
loader->create_drm_screen = create_drm_screen;