mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-27 19:10:14 +01:00
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.
This commit is contained in:
parent
4531356817
commit
0cd480f076
4 changed files with 13 additions and 45 deletions
|
|
@ -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;
|
||||
struct st_api *stapi = screen->st_api;
|
||||
struct st_context_iface *st;
|
||||
|
||||
/* 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;
|
||||
}
|
||||
st = stapi->get_current(stapi);
|
||||
|
||||
return (struct dri_context *) (st) ? st->st_manager_private : NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -344,12 +344,8 @@ dri_destroy_option_cache(struct dri_screen * screen)
|
|||
void
|
||||
dri_destroy_screen_helper(struct dri_screen * screen)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ST_API_COUNT; i++) {
|
||||
if (screen->st_api[i] && screen->st_api[i]->destroy)
|
||||
screen->st_api[i]->destroy(screen->st_api[i]);
|
||||
}
|
||||
if (screen->st_api && screen->st_api->destroy)
|
||||
screen->st_api->destroy(screen->st_api);
|
||||
|
||||
if (screen->base.screen)
|
||||
screen->base.screen->destroy(screen->base.screen);
|
||||
|
|
@ -383,14 +379,8 @@ dri_init_screen_helper(struct dri_screen *screen,
|
|||
screen->base.get_egl_image = dri_get_egl_image;
|
||||
screen->base.get_param = dri_get_param;
|
||||
|
||||
screen->st_api[ST_API_OPENGL] = st_gl_api_create();
|
||||
screen->st_api[ST_API_OPENGL_ES1] = st_gl_api_create_es1();
|
||||
screen->st_api[ST_API_OPENGL_ES2] = st_gl_api_create_es2();
|
||||
/* no ST_API_OPENVG */
|
||||
|
||||
if (!screen->st_api[ST_API_OPENGL] &&
|
||||
!screen->st_api[ST_API_OPENGL_ES1] &&
|
||||
!screen->st_api[ST_API_OPENGL_ES2])
|
||||
screen->st_api = st_gl_api_create();
|
||||
if (!screen->st_api)
|
||||
return NULL;
|
||||
|
||||
if(pscreen->get_param(pscreen, PIPE_CAP_NPOT_TEXTURES))
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ struct dri_screen
|
|||
{
|
||||
/* st_api */
|
||||
struct st_manager base;
|
||||
struct st_api *st_api[ST_API_COUNT];
|
||||
struct st_api *st_api;
|
||||
|
||||
/* on old libGL's invalidate doesn't get called as it should */
|
||||
boolean broken_invalidate;
|
||||
|
|
|
|||
|
|
@ -528,11 +528,11 @@ dri2_init_screen(__DRIscreen * sPriv)
|
|||
goto fail;
|
||||
|
||||
sPriv->api_mask = 0;
|
||||
if (screen->st_api[ST_API_OPENGL])
|
||||
if (screen->st_api->profile_mask & ST_PROFILE_DEFAULT_MASK)
|
||||
sPriv->api_mask |= 1 << __DRI_API_OPENGL;
|
||||
if (screen->st_api[ST_API_OPENGL_ES1])
|
||||
if (screen->st_api->profile_mask & ST_PROFILE_OPENGL_ES1_MASK)
|
||||
sPriv->api_mask |= 1 << __DRI_API_GLES;
|
||||
if (screen->st_api[ST_API_OPENGL_ES2])
|
||||
if (screen->st_api->profile_mask & ST_PROFILE_OPENGL_ES2_MASK)
|
||||
sPriv->api_mask |= 1 << __DRI_API_GLES2;
|
||||
|
||||
screen->auto_fake_front = dri_with_format(sPriv);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue