gallium/stapi: move setting GL versions to the state tracker

All flags are set for st/mesa, so the state tracker doesn't have to check
them.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
This commit is contained in:
Marek Olšák
2014-08-03 02:54:52 +02:00
parent 0127d26e6c
commit c6cbde5008
4 changed files with 39 additions and 12 deletions

View File

@@ -485,6 +485,16 @@ struct st_api
*/ */
void (*destroy)(struct st_api *stapi); void (*destroy)(struct st_api *stapi);
/**
* Query supported OpenGL versions. (if applicable)
* The format is (major*10+minor).
*/
void (*query_versions)(struct st_api *stapi, struct st_manager *sm,
int *gl_core_version,
int *gl_compat_version,
int *gl_es1_version,
int *gl_es2_version);
/** /**
* Return an API entry point. * Return an API entry point.
* *

View File

@@ -455,18 +455,11 @@ dri_init_screen_helper(struct dri_screen *screen,
dri_postprocessing_init(screen); dri_postprocessing_init(screen);
/* gallium drivers don't declare what version of GL they support, so we screen->st_api->query_versions(screen->st_api, &screen->base,
* check the computed Mesa context version after context creation and fail &screen->sPriv->max_gl_core_version,
* out then. &screen->sPriv->max_gl_compat_version,
*/ &screen->sPriv->max_gl_es1_version,
if (screen->st_api->profile_mask & ST_PROFILE_DEFAULT_MASK) &screen->sPriv->max_gl_es2_version);
screen->sPriv->max_gl_compat_version = 30;
if (screen->st_api->profile_mask & ST_PROFILE_OPENGL_CORE_MASK)
screen->sPriv->max_gl_core_version = 33;
if (screen->st_api->profile_mask & ST_PROFILE_OPENGL_ES1_MASK)
screen->sPriv->max_gl_es1_version = 11;
if (screen->st_api->profile_mask & ST_PROFILE_OPENGL_ES2_MASK)
screen->sPriv->max_gl_es2_version = 30;
return dri_fill_in_modes(screen); return dri_fill_in_modes(screen);
} }

View File

@@ -369,12 +369,22 @@ vg_api_destroy(struct st_api *stapi)
{ {
} }
static void
vg_api_query_versions(struct st_api *stapi, struct st_manager *sm,
int *gl_core_version,
int *gl_compat_version,
int *gl_es1_version,
int *gl_es2_version)
{
}
static const struct st_api vg_api = { static const struct st_api vg_api = {
"Vega " PACKAGE_VERSION, "Vega " PACKAGE_VERSION,
ST_API_OPENVG, ST_API_OPENVG,
ST_PROFILE_DEFAULT_MASK, ST_PROFILE_DEFAULT_MASK,
0, 0,
vg_api_destroy, vg_api_destroy,
vg_api_query_versions,
vg_api_get_proc_address, vg_api_get_proc_address,
vg_api_create_context, vg_api_create_context,
vg_api_make_current, vg_api_make_current,

View File

@@ -910,6 +910,19 @@ st_manager_add_color_renderbuffer(struct st_context *st,
return TRUE; return TRUE;
} }
static void
st_api_query_versions(struct st_api *stapi, struct st_manager *sm,
int *gl_core_version,
int *gl_compat_version,
int *gl_es1_version,
int *gl_es2_version)
{
*gl_core_version = 33;
*gl_compat_version = 30;
*gl_es1_version = 11;
*gl_es2_version = 30;
}
static const struct st_api st_gl_api = { static const struct st_api st_gl_api = {
"Mesa " PACKAGE_VERSION, "Mesa " PACKAGE_VERSION,
ST_API_OPENGL, ST_API_OPENGL,
@@ -920,6 +933,7 @@ static const struct st_api st_gl_api = {
0, 0,
ST_API_FEATURE_MS_VISUALS_MASK, ST_API_FEATURE_MS_VISUALS_MASK,
st_api_destroy, st_api_destroy,
st_api_query_versions,
st_api_get_proc_address, st_api_get_proc_address,
st_api_create_context, st_api_create_context,
st_api_make_current, st_api_make_current,