diff options
author | Chia-I Wu <olv@lunarg.com> | 2010-09-10 13:23:06 +0800 |
---|---|---|
committer | Chia-I Wu <olv@lunarg.com> | 2010-09-10 15:43:34 +0800 |
commit | 0cd480f07639ec9ee01424aaa3e0c900b2204d4f (patch) | |
tree | 087ec60a0a29ebe5ba747f6f13c43616dac687d8 /src/gallium/state_trackers/dri/common/dri_context.c | |
parent | 4531356817ec8383ac35932903773de67af92e37 (diff) |
st/dri: Use profiles to create OpenGL ES contexts.
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/state_trackers/dri/common/dri_context.c')
-rw-r--r-- | src/gallium/state_trackers/dri/common/dri_context.c | 34 |
1 files changed, 6 insertions, 28 deletions
diff --git a/src/gallium/state_trackers/dri/common/dri_context.c b/src/gallium/state_trackers/dri/common/dri_context.c index 8948cfc2cc..22e1b6dd70 100644 --- a/src/gallium/state_trackers/dri/common/dri_context.c +++ b/src/gallium/state_trackers/dri/common/dri_context.c @@ -54,31 +54,23 @@ dri_create_context(gl_api api, const __GLcontextModes * visual, { __DRIscreen *sPriv = cPriv->driScreenPriv; struct dri_screen *screen = dri_screen(sPriv); - struct st_api *stapi; + struct st_api *stapi = screen->st_api; struct dri_context *ctx = NULL; struct st_context_iface *st_share = NULL; struct st_context_attribs attribs; memset(&attribs, 0, sizeof(attribs)); switch (api) { - case API_OPENGL: - stapi = screen->st_api[ST_API_OPENGL]; - attribs.profile = ST_PROFILE_DEFAULT; - break; case API_OPENGLES: - stapi = screen->st_api[ST_API_OPENGL_ES1]; attribs.profile = ST_PROFILE_OPENGL_ES1; break; case API_OPENGLES2: - stapi = screen->st_api[ST_API_OPENGL_ES2]; attribs.profile = ST_PROFILE_OPENGL_ES2; break; default: - stapi = NULL; + attribs.profile = ST_PROFILE_DEFAULT; break; } - if (!stapi) - return GL_FALSE; if (sharedContextPrivate) { st_share = ((struct dri_context *)sharedContextPrivate)->st; @@ -195,24 +187,10 @@ struct dri_context * dri_get_current(__DRIscreen *sPriv) { struct dri_screen *screen = dri_screen(sPriv); - struct st_api *stapi; - struct st_context_iface *st = NULL; - gl_api api; - - /* XXX: How do we do this when the screen supports - multiple rendering API's? Pick the first one, - like this? (NB: all three API's use the same - implementation of get_current (see st_manager.c), - so maybe it doesn't matter right now since - they'll all return the same result.) */ - for (api = API_OPENGL; api <= API_OPENGLES2; ++api) { - stapi = screen->st_api[api]; - if (!stapi) - continue; - st = stapi->get_current(stapi); - if (st) - break; - } + struct st_api *stapi = screen->st_api; + struct st_context_iface *st; + + st = stapi->get_current(stapi); return (struct dri_context *) (st) ? st->st_manager_private : NULL; } |