diff options
author | Keith Whitwell <[email protected]> | 2007-12-18 16:56:22 +0000 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2008-09-23 18:26:17 -0700 |
commit | 33fef8be825ee8ec6abc0c2ffd9a3a967d84df88 (patch) | |
tree | 8e16afc8bdd7b781d313c4d39c4853bc99063bbd | |
parent | 6f765fbde42a4f729780aa39d2b0ed9d736dd5a8 (diff) |
vbo: unmap and remap immediate vbo before/after each draw.
Also use BufferData(NULL) to get fresh storage and avoid synchronous
operation where we would have to flush and wait for the fence after each
draw because of the map.
This will chew through a whole load of buffer space on small draws, so
it isn't a proper solution. Need to support a no-fence or append mapping
mode to do this right, or use user buffers.
-rw-r--r-- | src/mesa/vbo/vbo_exec_draw.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c index 557a43bb876..f497e9a5a55 100644 --- a/src/mesa/vbo/vbo_exec_draw.c +++ b/src/mesa/vbo/vbo_exec_draw.c @@ -233,8 +233,18 @@ void vbo_exec_vtx_flush( struct vbo_exec_context *exec ) if (exec->vtx.copied.nr != exec->vtx.vert_count) { GLcontext *ctx = exec->ctx; + GLenum target = GL_ARRAY_BUFFER_ARB; + GLenum access = GL_READ_WRITE_ARB; + GLenum usage = GL_STREAM_DRAW_ARB; + GLsizei size = VBO_VERT_BUFFER_SIZE * sizeof(GLfloat); + + /* Before the unmap (why?) + */ vbo_exec_bind_arrays( ctx ); + ctx->Driver.UnmapBuffer(ctx, target, exec->vtx.bufferobj); + exec->vtx.buffer_map = NULL; + vbo_context(ctx)->draw_prims( ctx, exec->vtx.inputs, exec->vtx.prim, @@ -242,6 +252,12 @@ void vbo_exec_vtx_flush( struct vbo_exec_context *exec ) NULL, 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); } } |