From 948e3fa27ca9112b903a180d1a18c61cfb2928dc Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Fri, 10 Sep 2010 12:59:43 +0800 Subject: 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. --- src/gallium/targets/egl-gdi/egl-static.c | 86 +++++++++----------------------- 1 file changed, 23 insertions(+), 63 deletions(-) (limited to 'src/gallium/targets/egl-gdi') diff --git a/src/gallium/targets/egl-gdi/egl-static.c b/src/gallium/targets/egl-gdi/egl-static.c index 4655d79117..da6e5ce339 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; -- cgit v1.2.3