summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2009-03-04 17:42:36 +0000
committerJosé Fonseca <jfonseca@vmware.com>2009-03-04 17:42:36 +0000
commit99a540bfbeea1762266a937deffc5010511eb38d (patch)
tree191cb5df3eccf9d3108f9ac033fa9fde464322e4
parent67cbe83a7239c7934cfaf3293677fafe9ec295be (diff)
parent368ca83a3fdfbe8dfe591ab73d29c500d1a91c0a (diff)
Merge commit 'origin/master' into gallium-map-range
-rw-r--r--src/mesa/vbo/vbo_exec_api.c3
-rw-r--r--src/mesa/vbo/vbo_exec_draw.c8
2 files changed, 10 insertions, 1 deletions
diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c
index 9c2d065913..a1e66aec63 100644
--- a/src/mesa/vbo/vbo_exec_api.c
+++ b/src/mesa/vbo/vbo_exec_api.c
@@ -675,6 +675,7 @@ void vbo_use_buffer_objects(GLcontext *ctx)
if (exec->vtx.buffer_map) {
_mesa_align_free(exec->vtx.buffer_map);
exec->vtx.buffer_map = NULL;
+ exec->vtx.buffer_ptr = NULL;
}
/* Allocate a real buffer object now */
@@ -700,6 +701,7 @@ void vbo_exec_vtx_init( struct vbo_exec_context *exec )
ASSERT(!exec->vtx.buffer_map);
exec->vtx.buffer_map = (GLfloat *)ALIGN_MALLOC(VBO_VERT_BUFFER_SIZE, 64);
+ exec->vtx.buffer_ptr = exec->vtx.buffer_map;
vbo_exec_vtxfmt_init( exec );
@@ -735,6 +737,7 @@ void vbo_exec_vtx_destroy( struct vbo_exec_context *exec )
if (exec->vtx.buffer_map) {
ALIGN_FREE(exec->vtx.buffer_map);
exec->vtx.buffer_map = NULL;
+ exec->vtx.buffer_ptr = NULL;
}
}
}
diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c
index c85e142a5a..6f8d1f8eb0 100644
--- a/src/mesa/vbo/vbo_exec_draw.c
+++ b/src/mesa/vbo/vbo_exec_draw.c
@@ -250,7 +250,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;
@@ -271,6 +274,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 &&
@@ -287,6 +291,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) {
@@ -298,6 +303,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);