summaryrefslogtreecommitdiff
path: root/src/mesa/vbo
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/vbo')
-rw-r--r--src/mesa/vbo/vbo_exec_api.c10
-rw-r--r--src/mesa/vbo/vbo_exec_draw.c19
2 files changed, 16 insertions, 13 deletions
diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c
index d70b4bb1a1..fdb0c5a9a4 100644
--- a/src/mesa/vbo/vbo_exec_api.c
+++ b/src/mesa/vbo/vbo_exec_api.c
@@ -700,8 +700,8 @@ void vbo_exec_vtx_init( struct vbo_exec_context *exec )
&exec->vtx.bufferobj,
ctx->Array.NullBufferObj);
+ ASSERT(!exec->vtx.buffer_map);
exec->vtx.buffer_map = ALIGN_MALLOC(VBO_VERT_BUFFER_SIZE * sizeof(GLfloat), 64);
-
vbo_exec_vtxfmt_init( exec );
/* Hook our functions into the dispatch table.
@@ -726,13 +726,13 @@ void vbo_exec_vtx_init( struct vbo_exec_context *exec )
void vbo_exec_vtx_destroy( struct vbo_exec_context *exec )
{
- GLcontext *ctx = exec->ctx;
if (exec->vtx.bufferobj->Name) {
- ctx->Driver.UnmapBuffer(ctx, GL_ARRAY_BUFFER_ARB, exec->vtx.bufferobj);
- ctx->Driver.DeleteBuffer(ctx, exec->vtx.bufferobj);
- exec->vtx.bufferobj = NULL;
+ /* using a real VBO for vertex data */
+ GLcontext *ctx = exec->ctx;
+ _mesa_reference_buffer_object(ctx, &exec->vtx.bufferobj, NULL);
}
else {
+ /* just using malloc'd space for vertex data */
if (exec->vtx.buffer_map) {
ALIGN_FREE(exec->vtx.buffer_map);
exec->vtx.buffer_map = NULL;
diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c
index 7ec431a237..92356ba977 100644
--- a/src/mesa/vbo/vbo_exec_draw.c
+++ b/src/mesa/vbo/vbo_exec_draw.c
@@ -200,7 +200,6 @@ static void vbo_exec_bind_arrays( GLcontext *ctx )
/* Ptr into ordinary app memory */
arrays[attr].Ptr = (void *) data;
}
-
arrays[attr].Size = exec->vtx.attrsz[src];
arrays[attr].StrideB = exec->vtx.vertex_size * sizeof(GLfloat);
arrays[attr].Stride = exec->vtx.vertex_size * sizeof(GLfloat);
@@ -243,8 +242,11 @@ void vbo_exec_vtx_flush( struct vbo_exec_context *exec )
*/
vbo_exec_bind_arrays( ctx );
- ctx->Driver.UnmapBuffer(ctx, target, exec->vtx.bufferobj);
- exec->vtx.buffer_map = NULL;
+ /* if using a real VBO, unmap it before drawing */
+ if (exec->vtx.bufferobj->Name) {
+ ctx->Driver.UnmapBuffer(ctx, target, exec->vtx.bufferobj);
+ exec->vtx.buffer_map = NULL;
+ }
vbo_context(ctx)->draw_prims( ctx,
exec->vtx.inputs,
@@ -254,11 +256,12 @@ void vbo_exec_vtx_flush( struct vbo_exec_context *exec )
0,
exec->vtx.vert_count - 1);
- /* Get new data:
- */
- ctx->Driver.BufferData(ctx, target, size, NULL, usage, exec->vtx.bufferobj);
- exec->vtx.buffer_map
- = ctx->Driver.MapBuffer(ctx, target, access, exec->vtx.bufferobj);
+ /* If using a real VBO, get new storage */
+ if (exec->vtx.bufferobj->Name) {
+ ctx->Driver.BufferData(ctx, target, size, NULL, usage, exec->vtx.bufferobj);
+ exec->vtx.buffer_map =
+ ctx->Driver.MapBuffer(ctx, target, access, exec->vtx.bufferobj);
+ }
}
}