summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2014-08-03 02:54:52 +0200
committerMarek Olšák <[email protected]>2014-08-11 21:53:57 +0200
commitc6cbde5008e27cccb06411146bc673835991ae91 (patch)
treeab62bd9fbe95d9398e8300a06deaa65ba6128086
parent0127d26e6c25974a84102fba2f556e260ccbcaeb (diff)
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 <[email protected]>
-rw-r--r--src/gallium/include/state_tracker/st_api.h10
-rw-r--r--src/gallium/state_trackers/dri/dri_screen.c17
-rw-r--r--src/gallium/state_trackers/vega/vg_manager.c10
-rw-r--r--src/mesa/state_tracker/st_manager.c14
4 files changed, 39 insertions, 12 deletions
diff --git a/src/gallium/include/state_tracker/st_api.h b/src/gallium/include/state_tracker/st_api.h
index 46f0436c043..4e563330c4d 100644
--- a/src/gallium/include/state_tracker/st_api.h
+++ b/src/gallium/include/state_tracker/st_api.h
@@ -486,6 +486,16 @@ struct st_api
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.
*
* For GL this is the same as _glapi_get_proc_address.
diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c
index b639f9ffd8b..697ebee0fb1 100644
--- a/src/gallium/state_trackers/dri/dri_screen.c
+++ b/src/gallium/state_trackers/dri/dri_screen.c
@@ -455,18 +455,11 @@ dri_init_screen_helper(struct dri_screen *screen,
dri_postprocessing_init(screen);
- /* gallium drivers don't declare what version of GL they support, so we
- * check the computed Mesa context version after context creation and fail
- * out then.
- */
- if (screen->st_api->profile_mask & ST_PROFILE_DEFAULT_MASK)
- 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;
+ screen->st_api->query_versions(screen->st_api, &screen->base,
+ &screen->sPriv->max_gl_core_version,
+ &screen->sPriv->max_gl_compat_version,
+ &screen->sPriv->max_gl_es1_version,
+ &screen->sPriv->max_gl_es2_version);
return dri_fill_in_modes(screen);
}
diff --git a/src/gallium/state_trackers/vega/vg_manager.c b/src/gallium/state_trackers/vega/vg_manager.c
index 2c43d763dea..2894428a8bc 100644
--- a/src/gallium/state_trackers/vega/vg_manager.c
+++ b/src/gallium/state_trackers/vega/vg_manager.c
@@ -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 = {
"Vega " PACKAGE_VERSION,
ST_API_OPENVG,
ST_PROFILE_DEFAULT_MASK,
0,
vg_api_destroy,
+ vg_api_query_versions,
vg_api_get_proc_address,
vg_api_create_context,
vg_api_make_current,
diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
index 706af7fd13d..dd9597be766 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -910,6 +910,19 @@ st_manager_add_color_renderbuffer(struct st_context *st,
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 = {
"Mesa " PACKAGE_VERSION,
ST_API_OPENGL,
@@ -920,6 +933,7 @@ static const struct st_api st_gl_api = {
0,
ST_API_FEATURE_MS_VISUALS_MASK,
st_api_destroy,
+ st_api_query_versions,
st_api_get_proc_address,
st_api_create_context,
st_api_make_current,