summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/softpipe
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2008-01-25 15:59:27 -0700
committerBrian <brian.paul@tungstengraphics.com>2008-01-25 17:22:56 -0700
commit0bfd085e2866fbbd40209dcee23f0e6240583fe8 (patch)
tree5cefec02084d42517848529161b734d73557059a /src/mesa/pipe/softpipe
parentbd8bf60b6f2402895e7159a4df644f8a4a307cf5 (diff)
gallium: replace prim pipeline begin/end() functions with flush()
This is basically half of Keith's draw/flush patch. The stage->point/line/tri() functions are now self-validating, the validator functions are installed by the flush() function. There were excessive calls to validate_pipeline(), however. This was caused by draw_prim_queue_flush() keeping a local 'first' variable that always pointed to the validate functions. Replaced 'first' with 'draw->pipeline.first'. Performance in gears is up just slightly with this patch.
Diffstat (limited to 'src/mesa/pipe/softpipe')
-rw-r--r--src/mesa/pipe/softpipe/sp_draw_arrays.c9
-rw-r--r--src/mesa/pipe/softpipe/sp_prim_setup.c43
-rw-r--r--src/mesa/pipe/softpipe/sp_prim_vbuf.c4
3 files changed, 41 insertions, 15 deletions
diff --git a/src/mesa/pipe/softpipe/sp_draw_arrays.c b/src/mesa/pipe/softpipe/sp_draw_arrays.c
index 423c91d4b8..71a303a8b5 100644
--- a/src/mesa/pipe/softpipe/sp_draw_arrays.c
+++ b/src/mesa/pipe/softpipe/sp_draw_arrays.c
@@ -142,21 +142,18 @@ softpipe_draw_elements(struct pipe_context *pipe,
/* draw! */
draw_arrays(draw, mode, start, count);
- /* always flush for now */
- draw_flush(draw);
-
/*
- * unmap vertex/index buffers
+ * unmap vertex/index buffers - will cause draw module to flush
*/
for (i = 0; i < PIPE_ATTRIB_MAX; i++) {
if (sp->vertex_buffer[i].buffer) {
- pipe->winsys->buffer_unmap(pipe->winsys, sp->vertex_buffer[i].buffer);
draw_set_mapped_vertex_buffer(draw, i, NULL);
+ pipe->winsys->buffer_unmap(pipe->winsys, sp->vertex_buffer[i].buffer);
}
}
if (indexBuffer) {
- pipe->winsys->buffer_unmap(pipe->winsys, indexBuffer);
draw_set_mapped_element_buffer(draw, 0, NULL);
+ pipe->winsys->buffer_unmap(pipe->winsys, indexBuffer);
}
diff --git a/src/mesa/pipe/softpipe/sp_prim_setup.c b/src/mesa/pipe/softpipe/sp_prim_setup.c
index 478ecff2fb..088d8a4c07 100644
--- a/src/mesa/pipe/softpipe/sp_prim_setup.c
+++ b/src/mesa/pipe/softpipe/sp_prim_setup.c
@@ -1170,11 +1170,43 @@ static void setup_begin( struct draw_stage *stage )
setup->quad.nr_attrs = fs->num_inputs;
sp->quad.first->begin(sp->quad.first);
+
+ stage->point = setup_point;
+ stage->line = setup_line;
+ stage->tri = setup_tri;
}
-static void setup_end( struct draw_stage *stage )
+static void setup_first_point( struct draw_stage *stage,
+ struct prim_header *header )
+{
+ setup_begin(stage);
+ stage->point( stage, header );
+}
+
+static void setup_first_line( struct draw_stage *stage,
+ struct prim_header *header )
+{
+ setup_begin(stage);
+ stage->line( stage, header );
+}
+
+
+static void setup_first_tri( struct draw_stage *stage,
+ struct prim_header *header )
+{
+ setup_begin(stage);
+ stage->tri( stage, header );
+}
+
+
+
+static void setup_flush( struct draw_stage *stage,
+ unsigned flags )
{
+ stage->point = setup_first_point;
+ stage->line = setup_first_line;
+ stage->tri = setup_first_tri;
}
@@ -1198,11 +1230,10 @@ struct draw_stage *sp_draw_render_stage( struct softpipe_context *softpipe )
setup->softpipe = softpipe;
setup->stage.draw = softpipe->draw;
- setup->stage.begin = setup_begin;
- setup->stage.point = setup_point;
- setup->stage.line = setup_line;
- setup->stage.tri = setup_tri;
- setup->stage.end = setup_end;
+ setup->stage.point = setup_first_point;
+ setup->stage.line = setup_first_line;
+ setup->stage.tri = setup_first_tri;
+ setup->stage.flush = setup_flush;
setup->stage.reset_stipple_counter = reset_stipple_counter;
setup->stage.destroy = render_destroy;
diff --git a/src/mesa/pipe/softpipe/sp_prim_vbuf.c b/src/mesa/pipe/softpipe/sp_prim_vbuf.c
index dfabae8302..c9089e7eb2 100644
--- a/src/mesa/pipe/softpipe/sp_prim_vbuf.c
+++ b/src/mesa/pipe/softpipe/sp_prim_vbuf.c
@@ -149,8 +149,6 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr_indices)
prim.edgeflags = 0;
prim.pad = 0;
- setup->begin( setup );
-
switch (cvbr->prim) {
case PIPE_PRIM_TRIANGLES:
for (i = 0; i < nr_indices; i += 3) {
@@ -182,7 +180,7 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr_indices)
break;
}
- setup->end( setup );
+ setup->flush( setup, 0 );
}