[Mesa-dev] [PATCH v3 7/7] mesa: assert if driver did not compute the version

Jordan Justen jordan.l.justen at intel.com
Mon Nov 19 17:01:36 PST 2012


Make sure drivers initialize the version before:
 * _mesa_initialize_exec_table is called
 * _mesa_initialize_exec_table_vbo is called
 * A context is made current

Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
 src/mapi/glapi/gen/gl_genexec.py |    1 +
 src/mesa/main/context.c          |    2 +-
 src/mesa/main/vtxfmt.c           |    2 ++
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/mapi/glapi/gen/gl_genexec.py b/src/mapi/glapi/gen/gl_genexec.py
index 461cfcf..ddf219a 100644
--- a/src/mapi/glapi/gen/gl_genexec.py
+++ b/src/mapi/glapi/gen/gl_genexec.py
@@ -127,6 +127,7 @@ _mesa_initialize_exec_table(struct gl_context *ctx)
    exec = ctx->Exec;
    assert(exec != NULL);
 
+   assert(ctx->Version > 0);
 """
 
 
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 339f6af..f5f3131 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1461,7 +1461,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);
 
diff --git a/src/mesa/main/vtxfmt.c b/src/mesa/main/vtxfmt.c
index faa40c1..600f3b8 100644
--- a/src/mesa/main/vtxfmt.c
+++ b/src/mesa/main/vtxfmt.c
@@ -47,6 +47,8 @@ static void
 install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
                const GLvertexformat *vfmt)
 {
+   assert(ctx->Version > 0);
+
    if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
       SET_Color4f(tab, vfmt->Color4f);
    }
-- 
1.7.10.4



More information about the mesa-dev mailing list