diff options
author | marha <marha@users.sourceforge.net> | 2011-02-22 15:03:18 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-02-22 15:03:18 +0000 |
commit | aa5b2e956fcc17b27d0f20ba7af65c52b34ef135 (patch) | |
tree | 6117dbd9745f6fa241d5ca19af20d1c3adb6e859 /mesalib/src/mesa/vbo/vbo_exec_draw.c | |
parent | 2d47702332ee534cda7f913e8d7892e53e4e23dc (diff) | |
parent | 9273afeeb4499a0493f120b7525e17b6ae51113e (diff) | |
download | vcxsrv-aa5b2e956fcc17b27d0f20ba7af65c52b34ef135.tar.gz vcxsrv-aa5b2e956fcc17b27d0f20ba7af65c52b34ef135.tar.bz2 vcxsrv-aa5b2e956fcc17b27d0f20ba7af65c52b34ef135.zip |
svn merge ^/branches/released .
Diffstat (limited to 'mesalib/src/mesa/vbo/vbo_exec_draw.c')
-rw-r--r-- | mesalib/src/mesa/vbo/vbo_exec_draw.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/mesalib/src/mesa/vbo/vbo_exec_draw.c b/mesalib/src/mesa/vbo/vbo_exec_draw.c index a2a098857..7cc843779 100644 --- a/mesalib/src/mesa/vbo/vbo_exec_draw.c +++ b/mesalib/src/mesa/vbo/vbo_exec_draw.c @@ -253,6 +253,9 @@ vbo_exec_bind_arrays( struct gl_context *ctx ) }
+/**
+ * Unmap the VBO. This is called before drawing.
+ */
static void
vbo_exec_vtx_unmap( struct vbo_exec_context *exec )
{
@@ -285,6 +288,9 @@ vbo_exec_vtx_unmap( struct vbo_exec_context *exec ) }
+/**
+ * Map the vertex buffer to begin storing glVertex, glColor, etc data.
+ */
void
vbo_exec_vtx_map( struct vbo_exec_context *exec )
{
@@ -301,14 +307,12 @@ vbo_exec_vtx_map( struct vbo_exec_context *exec ) if (!_mesa_is_bufferobj(exec->vtx.bufferobj))
return;
- if (exec->vtx.buffer_map != NULL) {
- assert(0);
- exec->vtx.buffer_map = NULL;
- exec->vtx.buffer_ptr = NULL;
- }
+ assert(!exec->vtx.buffer_map);
+ assert(!exec->vtx.buffer_ptr);
if (VBO_VERT_BUFFER_SIZE > exec->vtx.buffer_used + 1024 &&
ctx->Driver.MapBufferRange) {
+ /* The VBO exists and there's room for more */
exec->vtx.buffer_map =
(GLfloat *)ctx->Driver.MapBufferRange(ctx,
target,
@@ -321,6 +325,7 @@ vbo_exec_vtx_map( struct vbo_exec_context *exec ) }
if (!exec->vtx.buffer_map) {
+ /* Need to allocate a new VBO */
exec->vtx.buffer_used = 0;
ctx->Driver.BufferData(ctx, target,
@@ -349,9 +354,10 @@ vbo_exec_vtx_map( struct vbo_exec_context *exec ) /**
* Execute the buffer and save copied verts.
+ * \param keep_unmapped if true, leave the VBO unmapped when we're done.
*/
void
-vbo_exec_vtx_flush( struct vbo_exec_context *exec, GLboolean unmap )
+vbo_exec_vtx_flush(struct vbo_exec_context *exec, GLboolean keepUnmapped)
{
if (0)
vbo_exec_debug_verts( exec );
@@ -391,7 +397,7 @@ vbo_exec_vtx_flush( struct vbo_exec_context *exec, GLboolean unmap ) /* If using a real VBO, get new storage -- unless asked not to.
*/
- if (_mesa_is_bufferobj(exec->vtx.bufferobj) && !unmap) {
+ if (_mesa_is_bufferobj(exec->vtx.bufferobj) && !keepUnmapped) {
vbo_exec_vtx_map( exec );
}
}
@@ -399,14 +405,13 @@ vbo_exec_vtx_flush( struct vbo_exec_context *exec, GLboolean unmap ) /* May have to unmap explicitly if we didn't draw:
*/
- if (unmap &&
+ if (keepUnmapped &&
_mesa_is_bufferobj(exec->vtx.bufferobj) &&
exec->vtx.buffer_map) {
vbo_exec_vtx_unmap( exec );
}
-
- if (unmap || exec->vtx.vertex_size == 0)
+ if (keepUnmapped || exec->vtx.vertex_size == 0)
exec->vtx.max_vert = 0;
else
exec->vtx.max_vert = ((VBO_VERT_BUFFER_SIZE - exec->vtx.buffer_used) /
|