Mesa (mesa_7_7_branch): vbo: make flush recursion check code per-context

Brian Paul brianp at kemper.freedesktop.org
Tue Dec 1 12:27:45 PST 2009


Module: Mesa
Branch: mesa_7_7_branch
Commit: c8cdce665790263bb2142d894a81c87abc4da9fb
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c8cdce665790263bb2142d894a81c87abc4da9fb

Author: Brian Paul <brianp at vmware.com>
Date:   Tue Dec  1 13:26:15 2009 -0700

vbo: make flush recursion check code per-context

This fixes invalid failed assertions when running multi-threaded apps.

---

 src/mesa/vbo/vbo_exec.h     |    4 ++++
 src/mesa/vbo/vbo_exec_api.c |   11 ++++++-----
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/mesa/vbo/vbo_exec.h b/src/mesa/vbo/vbo_exec.h
index 0a05b8d..98c1f36 100644
--- a/src/mesa/vbo/vbo_exec.h
+++ b/src/mesa/vbo/vbo_exec.h
@@ -138,6 +138,10 @@ struct vbo_exec_context
        */
       const struct gl_client_array *inputs[VERT_ATTRIB_MAX];
    } array;
+
+#ifdef DEBUG
+   GLint flush_call_depth;
+#endif
 };
 
 
diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c
index c90565e..f0a7eea 100644
--- a/src/mesa/vbo/vbo_exec_api.c
+++ b/src/mesa/vbo/vbo_exec_api.c
@@ -876,9 +876,8 @@ void vbo_exec_FlushVertices( GLcontext *ctx, GLuint flags )
 
 #ifdef DEBUG
    /* debug check: make sure we don't get called recursively */
-   static GLuint callDepth = 0;
-   callDepth++;
-   assert(callDepth == 1);
+   exec->flush_call_depth++;
+   assert(exec->flush_call_depth == 1);
 #endif
 
    if (0) _mesa_printf("%s\n", __FUNCTION__);
@@ -886,7 +885,8 @@ void vbo_exec_FlushVertices( GLcontext *ctx, GLuint flags )
    if (exec->ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) {
       if (0) _mesa_printf("%s - inside begin/end\n", __FUNCTION__);
 #ifdef DEBUG
-      callDepth--;
+      exec->flush_call_depth--;
+      assert(exec->flush_call_depth == 0);
 #endif
       return;
    }
@@ -903,7 +903,8 @@ void vbo_exec_FlushVertices( GLcontext *ctx, GLuint flags )
    exec->ctx->Driver.NeedFlush &= ~flags;
 
 #ifdef DEBUG
-   callDepth--;
+   exec->flush_call_depth--;
+   assert(exec->flush_call_depth == 0);
 #endif
 }
 



More information about the mesa-commit mailing list