From 4531356817ec8383ac35932903773de67af92e37 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Fri, 10 Sep 2010 10:31:06 +0800 Subject: gallium: Add context profile support to st_api. Add struct st_context_attribs to describe context profiles and attributes. Modify st_api::create_context to take the new struct instead of an st_visual. st_context_attribs can be used to support GLX_ARB_create_context_profile and GLX_EXT_create_context_es2_profile in the future. But the motivation for doing it now is to be able to replace ST_API_OPENGL_ES1 and ST_API_OPENGL_ES2 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/state_trackers/dri/common/dri_context.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/gallium/state_trackers/dri') diff --git a/src/gallium/state_trackers/dri/common/dri_context.c b/src/gallium/state_trackers/dri/common/dri_context.c index f9ebe1edcce..8948cfc2ccb 100644 --- a/src/gallium/state_trackers/dri/common/dri_context.c +++ b/src/gallium/state_trackers/dri/common/dri_context.c @@ -57,17 +57,21 @@ dri_create_context(gl_api api, const __GLcontextModes * visual, struct st_api *stapi; struct dri_context *ctx = NULL; struct st_context_iface *st_share = NULL; - struct st_visual stvis; + 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; @@ -92,8 +96,8 @@ dri_create_context(gl_api api, const __GLcontextModes * visual, driParseConfigFiles(&ctx->optionCache, &screen->optionCache, sPriv->myNum, "dri"); - dri_fill_st_visual(&stvis, screen, visual); - ctx->st = stapi->create_context(stapi, &screen->base, &stvis, st_share); + dri_fill_st_visual(&attribs.visual, screen, visual); + ctx->st = stapi->create_context(stapi, &screen->base, &attribs, st_share); if (ctx->st == NULL) goto fail; ctx->st->st_manager_private = (void *) ctx; -- cgit v1.2.3