diff options
author | Brian <brian.paul@tungstengraphics.com> | 2007-08-15 11:42:37 -0600 |
---|---|---|
committer | Brian <brian.paul@tungstengraphics.com> | 2007-08-15 11:42:37 -0600 |
commit | 8038d5b68ca06e8ae4db4c999d7194593426d3bb (patch) | |
tree | 2a3f6f0af8188d3d2cfdbd79fb80f667ea2dc7b3 /src/mesa/pipe | |
parent | 681b1ebd5e1a94961a1d38b3018af97a10d2d5b0 (diff) |
comments, minor clean-ups
Diffstat (limited to 'src/mesa/pipe')
-rw-r--r-- | src/mesa/pipe/draw/draw_vb.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/src/mesa/pipe/draw/draw_vb.c b/src/mesa/pipe/draw/draw_vb.c index c0600314d6..dfd1f22eb3 100644 --- a/src/mesa/pipe/draw/draw_vb.c +++ b/src/mesa/pipe/draw/draw_vb.c @@ -464,9 +464,13 @@ static void draw_prim( struct draw_context *draw, } -static void draw_allocate_vertices( struct draw_context *draw, - GLuint nr_vertices ) +/** + * Allocate storage for post-transformation vertices. + */ +static void +draw_allocate_vertices( struct draw_context *draw, GLuint nr_vertices ) { + assert(draw->vertex_size > 0); draw->nr_vertices = nr_vertices; draw->verts = (GLubyte *) malloc( nr_vertices * draw->vertex_size ); draw_invalidate_vcache( draw ); @@ -474,7 +478,11 @@ static void draw_allocate_vertices( struct draw_context *draw, -static void draw_release_vertices( struct draw_context *draw ) +/** + * Free storage which was allocated by draw_allocate_vertices() + */ +static void +draw_release_vertices( struct draw_context *draw ) { free(draw->verts); draw->verts = NULL; @@ -603,7 +611,8 @@ static GLuint trim( GLuint count, GLuint first, GLuint incr ) } -/* This is a hack & will all go away. +/** + * This is a hack & will all go away. */ void draw_vb(struct draw_context *draw, struct vertex_buffer *VB ) @@ -621,9 +630,10 @@ void draw_vb(struct draw_context *draw, draw->in_vb = 1; + /* tell drawing pipeline we're beginning drawing */ draw->pipeline.first->begin( draw->pipeline.first ); - /* Allocate the vertices: + /* Allocate storage for the post-transform vertices: */ draw_allocate_vertices( draw, VB->Count ); @@ -640,9 +650,8 @@ void draw_vb(struct draw_context *draw, draw->get_vertex = get_vertex; for (i = 0; i < VB->PrimitiveCount; i++) { - - GLenum mode = VB->Primitive[i].mode; - GLuint start = VB->Primitive[i].start; + const GLenum mode = VB->Primitive[i].mode; + const GLuint start = VB->Primitive[i].start; GLuint length, first, incr; /* Trim the primitive down to a legal size. @@ -659,8 +668,13 @@ void draw_vb(struct draw_context *draw, draw_prim( draw, start, length ); } + /* draw any left-over buffered prims */ draw_flush(draw); + + /* tell drawing pipeline we're done drawing */ draw->pipeline.first->end( draw->pipeline.first ); + + /* free the post-transformed vertices */ draw_release_vertices( draw ); draw->verts = NULL; draw->in_vb = 0; |