aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/vbo/vbo_exec_api.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2011-03-01 17:16:53 -0700
committerBrian Paul <[email protected]>2011-03-01 17:16:53 -0700
commit8731f0363fea81394417b2da8a9ac9788a0dcfc6 (patch)
tree8de7216cdf6ad4243ea34e3c6fc49e6c95763c9c /src/mesa/vbo/vbo_exec_api.c
parenta2924b488b8d77381779bbb5a0097c467678d39b (diff)
vbo: add vbo_always_unmap_buffers()
Drivers can call this function as needed. It tells the VBO module to always unmap the current glBegin/glEnd VBO when we flush. Otherwise it's possible to be in a flushed state but still have the VBO mapped.
Diffstat (limited to 'src/mesa/vbo/vbo_exec_api.c')
-rw-r--r--src/mesa/vbo/vbo_exec_api.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c
index 0116c1725cb..fcd544de763 100644
--- a/src/mesa/vbo/vbo_exec_api.c
+++ b/src/mesa/vbo/vbo_exec_api.c
@@ -839,6 +839,19 @@ void vbo_use_buffer_objects(struct gl_context *ctx)
}
+/**
+ * If this function is called, all VBO buffers will be unmapped when
+ * we flush.
+ * Otherwise, if a simple command like glColor3f() is called and we flush,
+ * the current VBO may be left mapped.
+ */
+void
+vbo_always_unmap_buffers(struct gl_context *ctx)
+{
+ struct vbo_exec_context *exec = &vbo_context(ctx)->exec;
+ exec->begin_vertices_flags |= FLUSH_STORED_VERTICES;
+}
+
void vbo_exec_vtx_init( struct vbo_exec_context *exec )
{
@@ -894,6 +907,8 @@ void vbo_exec_vtx_init( struct vbo_exec_context *exec )
}
exec->vtx.vertex_size = 0;
+
+ exec->begin_vertices_flags = FLUSH_UPDATE_CURRENT;
}
@@ -942,7 +957,9 @@ void vbo_exec_BeginVertices( struct gl_context *ctx )
vbo_exec_vtx_map( exec );
assert((ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT) == 0);
- ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT;
+ assert(exec->begin_vertices_flags);
+
+ ctx->Driver.NeedFlush |= exec->begin_vertices_flags;
}