gallium/stapi: move setting GL versions to the state tracker
authorMarek Olšák <marek.olsak@amd.com>
Sun, 3 Aug 2014 00:54:52 +0000 (02:54 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Mon, 11 Aug 2014 19:53:57 +0000 (21:53 +0200)
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>
src/gallium/include/state_tracker/st_api.h
src/gallium/state_trackers/dri/dri_screen.c
src/gallium/state_trackers/vega/vg_manager.c
src/mesa/state_tracker/st_manager.c

index 46f0436c0433b0e3317aafdd91da09cd80717612..4e563330c4dbc13849310a02c75fe0481ae6ce25 100644 (file)
@@ -485,6 +485,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.
     *
index b639f9ffd8b78e13aa299310fe3ac915bd76118e..697ebee0fb136157b46849cfe0fcb2b9cdbb6af9 100644 (file)
@@ -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);
 }
index 2c43d763dea47cf67f49f906b18c5c9ad5ce56f7..2894428a8bc74bf8e8da1bd4217c630c74ea2500 100644 (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 = {
    "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,
index 706af7fd13d59265788c41377bfe1e447e2f1a2d..dd9597be766182e28bf81e2091fb69f27cb58ce0 100644 (file)
@@ -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,