+
+static unsigned
+get_version(struct pipe_screen *screen,
+ struct st_config_options *options, gl_api api)
+{
+ struct gl_constants consts = {0};
+ struct gl_extensions extensions = {0};
+ GLuint version;
+
+ if (_mesa_override_gl_version_contextless(&consts, &api, &version)) {
+ return version;
+ }
+
+ _mesa_init_constants(&consts, api);
+ _mesa_init_extensions(&extensions);
+
+ st_init_limits(screen, &consts, &extensions);
+ st_init_extensions(screen, &consts, &extensions, options, api);
+
+ return _mesa_get_version(&extensions, &consts, api);
+}
+
+
+static void
+st_api_query_versions(struct st_api *stapi, struct st_manager *sm,
+ struct st_config_options *options,
+ int *gl_core_version,
+ int *gl_compat_version,
+ int *gl_es1_version,
+ int *gl_es2_version)
+{
+ *gl_core_version = get_version(sm->screen, options, API_OPENGL_CORE);
+ *gl_compat_version = get_version(sm->screen, options, API_OPENGL_COMPAT);
+ *gl_es1_version = get_version(sm->screen, options, API_OPENGLES);
+ *gl_es2_version = get_version(sm->screen, options, API_OPENGLES2);
+}
+
+
+static const struct st_api st_gl_api = {
+ .name = "Mesa " PACKAGE_VERSION,
+ .api = ST_API_OPENGL,
+ .profile_mask = ST_PROFILE_DEFAULT_MASK |
+ ST_PROFILE_OPENGL_CORE_MASK |
+ ST_PROFILE_OPENGL_ES1_MASK |
+ ST_PROFILE_OPENGL_ES2_MASK |
+ 0,
+ .feature_mask = ST_API_FEATURE_MS_VISUALS_MASK,
+ .destroy = st_api_destroy,
+ .query_versions = st_api_query_versions,
+ .create_context = st_api_create_context,
+ .make_current = st_api_make_current,
+ .get_current = st_api_get_current,
+ .destroy_drawable = st_api_destroy_drawable,