summaryrefslogtreecommitdiffstats
path: root/src/mesa/vbo/vbo_exec_draw.c
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2009-03-04 17:01:47 +0000
committerKeith Whitwell <[email protected]>2009-03-04 17:01:47 +0000
commit368ca83a3fdfbe8dfe591ab73d29c500d1a91c0a (patch)
tree8110070eeb63858e4f916bdbf3da63cfb24da939 /src/mesa/vbo/vbo_exec_draw.c
parent89f1f8f0b8fb684a7b1fce5bfbb961e4521745d7 (diff)
vbo: second attempt - avoid getting buffer_ptr and buffer_map out of sync
Diffstat (limited to 'src/mesa/vbo/vbo_exec_draw.c')
-rw-r--r--src/mesa/vbo/vbo_exec_draw.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c
index 38b6c56f479..59e176b8375 100644
--- a/src/mesa/vbo/vbo_exec_draw.c
+++ b/src/mesa/vbo/vbo_exec_draw.c
@@ -243,7 +243,10 @@ static void vbo_exec_vtx_unmap( struct vbo_exec_context *exec )
exec->vtx.buffer_used += (exec->vtx.buffer_ptr -
exec->vtx.buffer_map) * sizeof(float);
-
+
+ assert(exec->vtx.buffer_used <= VBO_VERT_BUFFER_SIZE);
+ assert(exec->vtx.buffer_ptr != NULL);
+
ctx->Driver.UnmapBuffer(ctx, target, exec->vtx.bufferobj);
exec->vtx.buffer_map = NULL;
exec->vtx.buffer_ptr = NULL;
@@ -264,6 +267,7 @@ void vbo_exec_vtx_map( struct vbo_exec_context *exec )
if (exec->vtx.buffer_map != NULL) {
assert(0);
exec->vtx.buffer_map = NULL;
+ exec->vtx.buffer_ptr = NULL;
}
if (VBO_VERT_BUFFER_SIZE > exec->vtx.buffer_used + 1024 &&
@@ -280,6 +284,7 @@ void vbo_exec_vtx_map( struct vbo_exec_context *exec )
GL_MAP_UNSYNCHRONIZED_BIT |
MESA_MAP_NOWAIT_BIT),
exec->vtx.bufferobj);
+ exec->vtx.buffer_ptr = exec->vtx.buffer_map;
}
if (exec->vtx.buffer_map) {
@@ -294,6 +299,7 @@ void vbo_exec_vtx_map( struct vbo_exec_context *exec )
exec->vtx.buffer_map =
(GLfloat *)ctx->Driver.MapBuffer(ctx, target, access, exec->vtx.bufferobj);
+ exec->vtx.buffer_ptr = exec->vtx.buffer_map;
}
if (0) _mesa_printf("map %d..\n", exec->vtx.buffer_used);