[Mesa-dev] [RFC 4/4] mesa: compute version in _mesa_initialize_context
Jordan Justen
jordan.l.justen at intel.com
Wed Nov 14 10:32:22 PST 2012
In _mesa_initialize_context:
* Call Driver.InitializeVersionFeatures to allow the driver to
enable features which are significant to computing the versions
* Call _mesa_compute_version. It is important that this is done
before _mesa_create_exec_table is called.
In _mesa_make_current:
* Assert if the version wasn't previously set
Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
src/mesa/drivers/dri/intel/intel_context.c | 2 --
src/mesa/drivers/dri/swrast/swrast.c | 2 --
src/mesa/main/context.c | 13 ++++++++++++-
3 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
index 113af90..dffbdb6 100755
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -749,8 +749,6 @@ intelInitContext(struct intel_context *intel,
intel->RenderIndex = ~0;
- ctx->Driver.InitializeVersionFeatures(ctx);
-
INTEL_DEBUG = driParseDebugString(getenv("INTEL_DEBUG"), debug_control);
if (INTEL_DEBUG & DEBUG_BUFMGR)
dri_bufmgr_set_debug(intel->bufmgr, true);
diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c
index b2f2a34..0da2e98 100644
--- a/src/mesa/drivers/dri/swrast/swrast.c
+++ b/src/mesa/drivers/dri/swrast/swrast.c
@@ -792,8 +792,6 @@ dri_create_context(gl_api api,
_mesa_meta_init(mesaCtx);
- mesaCtx->Driver.InitializeVersionFeatures(mesaCtx);
-
*error = __DRI_CTX_ERROR_SUCCESS;
return GL_TRUE;
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 0508378..24adba4 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -935,6 +935,17 @@ _mesa_initialize_context(struct gl_context *ctx,
return GL_FALSE;
}
+ /* Allow the driver to initialize features which are important for
+ * calculating the context version.
+ */
+ assert(ctx->Driver.InitializeVersionFeatures != NULL);
+ ctx->Driver.InitializeVersionFeatures(ctx);
+
+ /* Compute context's supported version. Initialization past this
+ * point may use ctx->Version.
+ */
+ _mesa_compute_version(ctx);
+
/* setup the API dispatch tables */
ctx->Exec = _mesa_create_exec_table(ctx);
@@ -1462,7 +1473,7 @@ _mesa_make_current( struct gl_context *newCtx,
}
if (newCtx->FirstTimeCurrent) {
- _mesa_compute_version(newCtx);
+ assert(newCtx->Version > 0);
newCtx->Extensions.String = _mesa_make_extension_string(newCtx);
--
1.7.9.5
More information about the mesa-dev
mailing list