[Mesa-dev] [RFC 2/4] swrast: add InitializeVersionFeatures driver function

Jordan Justen jordan.l.justen at intel.com
Wed Nov 14 10:32:20 PST 2012


Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
 src/mesa/drivers/dri/swrast/swrast.c |   74 +++++++++++++++++++---------------
 1 file changed, 41 insertions(+), 33 deletions(-)

diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c
index 45ef3c2..b2f2a34 100644
--- a/src/mesa/drivers/dri/swrast/swrast.c
+++ b/src/mesa/drivers/dri/swrast/swrast.c
@@ -632,18 +632,6 @@ static gl_format swrastChooseTextureFormat(struct gl_context * ctx,
     return _mesa_choose_tex_format(ctx, target, internalFormat, format, type);
 }
 
-static void
-swrast_init_driver_functions(struct dd_function_table *driver)
-{
-    driver->GetString = get_string;
-    driver->UpdateState = update_state;
-    driver->GetBufferSize = NULL;
-    driver->Viewport = viewport;
-    driver->ChooseTextureFormat = swrastChooseTextureFormat;
-    driver->MapRenderbuffer = swrast_map_renderbuffer;
-    driver->UnmapRenderbuffer = swrast_unmap_renderbuffer;
-}
-
 static const char *es2_extensions[] = {
    /* Used by mesa internally (cf all_mesa_extensions in ../common/utils.c) */
    "GL_EXT_blend_func_separate",
@@ -679,6 +667,46 @@ InitExtensionsES2(struct gl_context *ctx)
       _mesa_enable_extension(ctx, es2_extensions[i]);
 }
 
+static void
+initialize_version_features(struct gl_context * ctx)
+{
+    _mesa_enable_sw_extensions(ctx);
+
+    switch (ctx->API) {
+    case API_OPENGL_CORE:
+        /* XXX fix me, fall-through for now */
+    case API_OPENGL:
+        _mesa_enable_1_3_extensions(ctx);
+        _mesa_enable_1_4_extensions(ctx);
+        _mesa_enable_1_5_extensions(ctx);
+        _mesa_enable_2_0_extensions(ctx);
+        _mesa_enable_2_1_extensions(ctx);
+        break;
+    case API_OPENGLES:
+        _mesa_enable_1_3_extensions(ctx);
+        _mesa_enable_1_4_extensions(ctx);
+        _mesa_enable_1_5_extensions(ctx);
+
+        break;
+    case API_OPENGLES2:
+        InitExtensionsES2(ctx);
+        break;
+    }
+}
+
+static void
+swrast_init_driver_functions(struct dd_function_table *driver)
+{
+    driver->InitializeVersionFeatures = initialize_version_features;
+    driver->GetString = get_string;
+    driver->UpdateState = update_state;
+    driver->GetBufferSize = NULL;
+    driver->Viewport = viewport;
+    driver->ChooseTextureFormat = swrastChooseTextureFormat;
+    driver->MapRenderbuffer = swrast_map_renderbuffer;
+    driver->UnmapRenderbuffer = swrast_unmap_renderbuffer;
+}
+
 /**
  * Context-related functions.
  */
@@ -763,28 +791,8 @@ dri_create_context(gl_api api,
     }
 
     _mesa_meta_init(mesaCtx);
-    _mesa_enable_sw_extensions(mesaCtx);
-
-    switch (api) {
-    case API_OPENGL_CORE:
-        /* XXX fix me, fall-through for now */
-    case API_OPENGL:
-        _mesa_enable_1_3_extensions(mesaCtx);
-        _mesa_enable_1_4_extensions(mesaCtx);
-        _mesa_enable_1_5_extensions(mesaCtx);
-        _mesa_enable_2_0_extensions(mesaCtx);
-        _mesa_enable_2_1_extensions(mesaCtx);
-        break;
-    case API_OPENGLES:
-        _mesa_enable_1_3_extensions(mesaCtx);
-        _mesa_enable_1_4_extensions(mesaCtx);
-        _mesa_enable_1_5_extensions(mesaCtx);
 
-        break;
-    case API_OPENGLES2:
-        InitExtensionsES2( mesaCtx);
-        break;
-    }
+    mesaCtx->Driver.InitializeVersionFeatures(mesaCtx);
 
     *error = __DRI_CTX_ERROR_SUCCESS;
     return GL_TRUE;
-- 
1.7.9.5



More information about the mesa-dev mailing list