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.
/* 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);
}
/* Note: leave drawing surfaces mapped */
}
-static void clip_begin( struct draw_stage *stage )
-{
- /* should always have position, at least */
- assert(stage->draw->num_vs_outputs > 0);
-
- stage->next->begin( stage->next );
-}
-
-
static void
clip_point( struct draw_stage *stage,
struct prim_header *header )
}
}
-
-static void clip_end( struct draw_stage *stage )
+static void clip_flush( struct draw_stage *stage, unsigned flags )
{
- stage->next->end( stage->next );
+ stage->next->flush( stage->next, flags );
}
draw_alloc_tmps( &clipper->stage, MAX_CLIPPED_VERTICES );
clipper->stage.draw = draw;
- clipper->stage.begin = clip_begin;
clipper->stage.point = clip_point;
clipper->stage.line = clip_line;
clipper->stage.tri = clip_tri;
- clipper->stage.end = clip_end;
+ clipper->stage.flush = clip_flush;
clipper->stage.reset_stipple_counter = clip_reset_stipple_counter;
clipper->stage.destroy = clip_destroy;
}
-static void cull_begin( struct draw_stage *stage )
-{
- struct cull_stage *cull = cull_stage(stage);
-
- cull->winding = stage->draw->rasterizer->cull_mode;
-
- stage->next->begin( stage->next );
-}
static void cull_tri( struct draw_stage *stage,
}
}
+static void cull_first_tri( struct draw_stage *stage,
+ struct prim_header *header )
+{
+ struct cull_stage *cull = cull_stage(stage);
+
+ cull->winding = stage->draw->rasterizer->cull_mode;
+
+ stage->tri = cull_tri;
+ stage->tri( stage, header );
+}
+
+
static void cull_line( struct draw_stage *stage,
struct prim_header *header )
}
-static void cull_end( struct draw_stage *stage )
+static void cull_flush( struct draw_stage *stage, unsigned flags )
{
- stage->next->end( stage->next );
+ stage->tri = cull_first_tri;
+ stage->next->flush( stage->next, flags );
}
-
static void cull_reset_stipple_counter( struct draw_stage *stage )
{
stage->next->reset_stipple_counter( stage->next );
cull->stage.draw = draw;
cull->stage.next = NULL;
- cull->stage.begin = cull_begin;
cull->stage.point = cull_point;
cull->stage.line = cull_line;
- cull->stage.tri = cull_tri;
- cull->stage.end = cull_end;
+ cull->stage.tri = cull_first_tri;
+ cull->stage.flush = cull_flush;
cull->stage.reset_stipple_counter = cull_reset_stipple_counter;
cull->stage.destroy = cull_destroy;
}
-static void flatshade_begin( struct draw_stage *stage )
-{
- struct flat_stage *flat = flat_stage(stage);
- const struct pipe_shader_state *vs = stage->draw->vertex_shader->state;
- uint i;
-
- /* Find which vertex shader outputs are colors, make a list */
- flat->num_color_attribs = 0;
- for (i = 0; i < vs->num_outputs; i++) {
- if (vs->output_semantic_name[i] == TGSI_SEMANTIC_COLOR ||
- vs->output_semantic_name[i] == TGSI_SEMANTIC_BCOLOR) {
- flat->color_attribs[flat->num_color_attribs++] = i;
- }
- }
-
- stage->next->begin( stage->next );
-}
-
-
/** Copy all the color attributes from 'src' vertex to 'dst' vertex */
static INLINE void copy_colors( struct draw_stage *stage,
struct vertex_header *dst,
}
-static void flatshade_end( struct draw_stage *stage )
+static void flatshade_init_state( struct draw_stage *stage )
+{
+ struct flat_stage *flat = flat_stage(stage);
+ const struct pipe_shader_state *vs = stage->draw->vertex_shader->state;
+ uint i;
+
+ /* Find which vertex shader outputs are colors, make a list */
+ flat->num_color_attribs = 0;
+ for (i = 0; i < vs->num_outputs; i++) {
+ if (vs->output_semantic_name[i] == TGSI_SEMANTIC_COLOR ||
+ vs->output_semantic_name[i] == TGSI_SEMANTIC_BCOLOR) {
+ flat->color_attribs[flat->num_color_attribs++] = i;
+ }
+ }
+
+ stage->line = flatshade_line;
+ stage->tri = flatshade_tri;
+}
+
+static void flatshade_first_tri( struct draw_stage *stage,
+ struct prim_header *header )
+{
+ flatshade_init_state( stage );
+ stage->tri( stage, header );
+}
+
+static void flatshade_first_line( struct draw_stage *stage,
+ struct prim_header *header )
+{
+ flatshade_init_state( stage );
+ stage->line( stage, header );
+}
+
+
+static void flatshade_flush( struct draw_stage *stage,
+ unsigned flags )
{
- stage->next->end( stage->next );
+ stage->tri = flatshade_first_tri;
+ stage->line = flatshade_first_line;
+ stage->next->flush( stage->next, flags );
}
flatshade->stage.draw = draw;
flatshade->stage.next = NULL;
- flatshade->stage.begin = flatshade_begin;
flatshade->stage.point = flatshade_point;
- flatshade->stage.line = flatshade_line;
- flatshade->stage.tri = flatshade_tri;
- flatshade->stage.end = flatshade_end;
+ flatshade->stage.line = flatshade_first_line;
+ flatshade->stage.tri = flatshade_first_tri;
+ flatshade->stage.flush = flatshade_flush;
flatshade->stage.reset_stipple_counter = flatshade_reset_stipple_counter;
flatshade->stage.destroy = flatshade_destroy;
}
-static void offset_begin( struct draw_stage *stage )
-{
- struct offset_stage *offset = offset_stage(stage);
- float mrd = 1.0f / 65535.0f; /* XXX this depends on depthbuffer bits! */
- offset->units = stage->draw->rasterizer->offset_units * mrd;
- offset->scale = stage->draw->rasterizer->offset_scale;
-
- stage->next->begin( stage->next );
-}
/**
}
+static void offset_first_tri( struct draw_stage *stage,
+ struct prim_header *header )
+{
+ struct offset_stage *offset = offset_stage(stage);
+ float mrd = 1.0f / 65535.0f; /* XXX this depends on depthbuffer bits! */
+
+ offset->units = stage->draw->rasterizer->offset_units * mrd;
+ offset->scale = stage->draw->rasterizer->offset_scale;
+
+ stage->tri = offset_tri;
+ stage->tri( stage, header );
+}
+
static void offset_line( struct draw_stage *stage,
- struct prim_header *header )
+ struct prim_header *header )
{
stage->next->line( stage->next, header );
}
static void offset_point( struct draw_stage *stage,
- struct prim_header *header )
+ struct prim_header *header )
{
stage->next->point( stage->next, header );
}
-static void offset_end( struct draw_stage *stage )
+static void offset_flush( struct draw_stage *stage,
+ unsigned flags )
{
- stage->next->end( stage->next );
+ stage->tri = offset_first_tri;
+ stage->next->flush( stage->next, flags );
}
offset->stage.draw = draw;
offset->stage.next = NULL;
- offset->stage.begin = offset_begin;
offset->stage.point = offset_point;
offset->stage.line = offset_line;
- offset->stage.tri = offset_tri;
- offset->stage.end = offset_end;
+ offset->stage.tri = offset_first_tri;
+ offset->stage.flush = offset_flush;
offset->stage.reset_stipple_counter = offset_reset_stipple_counter;
offset->stage.destroy = offset_destroy;
static void draw_prim_queue_flush( struct draw_context *draw )
{
- struct draw_stage *first = draw->pipeline.first;
+ // struct draw_stage *first = draw->pipeline.first;
unsigned i;
if (0)
if (draw->vs.queue_nr)
draw_vertex_shader_queue_flush(draw);
+ /* NOTE: we cannot save draw->pipeline->first in a local var because
+ * draw->pipeline->first is often changed by the first call to tri(),
+ * line(), etc.
+ */
switch (draw->reduced_prim) {
case RP_TRI:
for (i = 0; i < draw->pq.queue_nr; i++) {
if (draw->pq.queue[i].reset_line_stipple)
- first->reset_stipple_counter( first );
+ draw->pipeline.first->reset_stipple_counter( draw->pipeline.first );
- first->tri( first, &draw->pq.queue[i] );
+ draw->pipeline.first->tri( draw->pipeline.first, &draw->pq.queue[i] );
}
break;
case RP_LINE:
for (i = 0; i < draw->pq.queue_nr; i++) {
if (draw->pq.queue[i].reset_line_stipple)
- first->reset_stipple_counter( first );
+ draw->pipeline.first->reset_stipple_counter( draw->pipeline.first );
- first->line( first, &draw->pq.queue[i] );
+ draw->pipeline.first->line( draw->pipeline.first, &draw->pq.queue[i] );
}
break;
case RP_POINT:
- first->reset_stipple_counter( first );
+ draw->pipeline.first->reset_stipple_counter( draw->pipeline.first );
for (i = 0; i < draw->pq.queue_nr; i++)
- first->point( first, &draw->pq.queue[i] );
+ draw->pipeline.first->point( draw->pipeline.first, &draw->pq.queue[i] );
break;
}
if ((flush & DRAW_FLUSH_DRAW) &&
draw->drawing)
{
- draw->pipeline.first->end( draw->pipeline.first );
+ draw->pipeline.first->flush( draw->pipeline.first, ~0 );
draw->drawing = FALSE;
draw->prim = ~0;
draw->pipeline.first = draw->pipeline.validate;
{
if (!draw->drawing) {
draw->drawing = TRUE;
-
- /* tell drawing pipeline we're beginning drawing */
- draw->pipeline.first->begin( draw->pipeline.first );
}
if (draw->prim != prim) {
struct vertex_header **tmp; /**< temp vert storage, such as for clipping */
unsigned nr_tmps;
- void (*begin)( struct draw_stage * );
-
void (*point)( struct draw_stage *,
struct prim_header * );
void (*tri)( struct draw_stage *,
struct prim_header * );
- void (*end)( struct draw_stage * );
+ void (*flush)( struct draw_stage *,
+ unsigned flags );
void (*reset_stipple_counter)( struct draw_stage * );
static void
-stipple_begin(struct draw_stage *stage)
+stipple_first_line(struct draw_stage *stage,
+ struct prim_header *header)
{
struct stipple_stage *stipple = stipple_stage(stage);
struct draw_context *draw = stage->draw;
stipple->pattern = draw->rasterizer->line_stipple_pattern;
stipple->factor = draw->rasterizer->line_stipple_factor + 1;
- stage->next->begin( stage->next );
+ stage->line = stipple_line;
+ stage->line( stage, header );
}
static void
-stipple_end(struct draw_stage *stage)
+stipple_flush(struct draw_stage *stage, unsigned flags)
{
- stage->next->end( stage->next );
+ stage->line = stipple_first_line;
+ stage->next->flush( stage->next, flags );
}
stipple->stage.draw = draw;
stipple->stage.next = NULL;
- stipple->stage.begin = stipple_begin;
stipple->stage.point = passthrough_point;
- stipple->stage.line = stipple_line;
+ stipple->stage.line = stipple_first_line;
stipple->stage.tri = passthrough_tri;
stipple->stage.reset_stipple_counter = reset_stipple_counter;
- stipple->stage.end = stipple_end;
+ stipple->stage.flush = stipple_flush;
stipple->stage.destroy = stipple_destroy;
return &stipple->stage;
}
-static void twoside_begin( struct draw_stage *stage )
-{
- struct twoside_stage *twoside = twoside_stage(stage);
- const struct pipe_shader_state *vs = stage->draw->vertex_shader->state;
- uint i;
-
- twoside->attrib_front0 = 0;
- twoside->attrib_front1 = 0;
- twoside->attrib_back0 = 0;
- twoside->attrib_back1 = 0;
-
- /* Find which vertex shader outputs are front/back colors */
- for (i = 0; i < vs->num_outputs; i++) {
- if (vs->output_semantic_name[i] == TGSI_SEMANTIC_COLOR) {
- if (vs->output_semantic_index[i] == 0)
- twoside->attrib_front0 = i;
- else
- twoside->attrib_front1 = i;
- }
- if (vs->output_semantic_name[i] == TGSI_SEMANTIC_BCOLOR) {
- if (vs->output_semantic_index[i] == 0)
- twoside->attrib_back0 = i;
- else
- twoside->attrib_back1 = i;
- }
- }
-
- if (!twoside->attrib_back0)
- twoside->attrib_front0 = 0;
-
- if (!twoside->attrib_back1)
- twoside->attrib_front1 = 0;
-
- /*
- * We'll multiply the primitive's determinant by this sign to determine
- * if the triangle is back-facing (negative).
- * sign = -1 for CCW, +1 for CW
- */
- twoside->sign = (stage->draw->rasterizer->front_winding == PIPE_WINDING_CCW) ? -1.0f : 1.0f;
-
- stage->next->begin( stage->next );
-}
/**
}
-static void twoside_end( struct draw_stage *stage )
+static void twoside_first_tri( struct draw_stage *stage,
+ struct prim_header *header )
{
- /* pass-through */
- stage->next->end( stage->next );
+ struct twoside_stage *twoside = twoside_stage(stage);
+ const struct pipe_shader_state *vs = stage->draw->vertex_shader->state;
+ uint i;
+
+ twoside->attrib_front0 = 0;
+ twoside->attrib_front1 = 0;
+ twoside->attrib_back0 = 0;
+ twoside->attrib_back1 = 0;
+
+ /* Find which vertex shader outputs are front/back colors */
+ for (i = 0; i < vs->num_outputs; i++) {
+ if (vs->output_semantic_name[i] == TGSI_SEMANTIC_COLOR) {
+ if (vs->output_semantic_index[i] == 0)
+ twoside->attrib_front0 = i;
+ else
+ twoside->attrib_front1 = i;
+ }
+ if (vs->output_semantic_name[i] == TGSI_SEMANTIC_BCOLOR) {
+ if (vs->output_semantic_index[i] == 0)
+ twoside->attrib_back0 = i;
+ else
+ twoside->attrib_back1 = i;
+ }
+ }
+
+ if (!twoside->attrib_back0)
+ twoside->attrib_front0 = 0;
+
+ if (!twoside->attrib_back1)
+ twoside->attrib_front1 = 0;
+
+ /*
+ * We'll multiply the primitive's determinant by this sign to determine
+ * if the triangle is back-facing (negative).
+ * sign = -1 for CCW, +1 for CW
+ */
+ twoside->sign = (stage->draw->rasterizer->front_winding == PIPE_WINDING_CCW) ? -1.0f : 1.0f;
+
+ stage->tri = twoside_tri;
+ stage->tri( stage, header );
+}
+
+
+static void twoside_flush( struct draw_stage *stage, unsigned flags )
+{
+ stage->tri = twoside_first_tri;
+ stage->next->flush( stage->next, flags );
}
twoside->stage.draw = draw;
twoside->stage.next = NULL;
- twoside->stage.begin = twoside_begin;
twoside->stage.point = twoside_point;
twoside->stage.line = twoside_line;
- twoside->stage.tri = twoside_tri;
- twoside->stage.end = twoside_end;
+ twoside->stage.tri = twoside_first_tri;
+ twoside->stage.flush = twoside_flush;
twoside->stage.reset_stipple_counter = twoside_reset_stipple_counter;
twoside->stage.destroy = twoside_destroy;
}
-static void unfilled_begin( struct draw_stage *stage )
-{
- struct unfilled_stage *unfilled = unfilled_stage(stage);
-
- unfilled->mode[0] = stage->draw->rasterizer->fill_ccw; /* front */
- unfilled->mode[1] = stage->draw->rasterizer->fill_cw; /* back */
-
- stage->next->begin( stage->next );
-}
static void point( struct draw_stage *stage,
struct vertex_header *v0 )
}
}
+
+static void unfilled_first_tri( struct draw_stage *stage,
+ struct prim_header *header )
+{
+ struct unfilled_stage *unfilled = unfilled_stage(stage);
+
+ unfilled->mode[0] = stage->draw->rasterizer->fill_ccw; /* front */
+ unfilled->mode[1] = stage->draw->rasterizer->fill_cw; /* back */
+
+ stage->tri = unfilled_tri;
+ stage->tri( stage, header );
+}
+
+
static void unfilled_line( struct draw_stage *stage,
struct prim_header *header )
{
}
-static void unfilled_end( struct draw_stage *stage )
+static void unfilled_flush( struct draw_stage *stage,
+ unsigned flags )
{
- stage->next->end( stage->next );
+ stage->next->flush( stage->next, flags );
}
unfilled->stage.draw = draw;
unfilled->stage.next = NULL;
unfilled->stage.tmp = NULL;
- unfilled->stage.begin = unfilled_begin;
unfilled->stage.point = unfilled_point;
unfilled->stage.line = unfilled_line;
- unfilled->stage.tri = unfilled_tri;
- unfilled->stage.end = unfilled_end;
+ unfilled->stage.tri = unfilled_first_tri;
+ unfilled->stage.flush = unfilled_flush;
unfilled->stage.reset_stipple_counter = unfilled_reset_stipple_counter;
unfilled->stage.destroy = unfilled_destroy;
/**
* Rebuild the rendering pipeline.
*/
-static void validate_begin( struct draw_stage *stage )
+static struct draw_stage *validate_pipeline( struct draw_stage *stage )
{
struct draw_context *draw = stage->draw;
struct draw_stage *next = draw->pipeline.rasterize;
}
draw->pipeline.first = next;
- draw->pipeline.first->begin( draw->pipeline.first );
+ //BP draw->pipeline.first->begin( draw->pipeline.first );
+ return next;
+}
+
+
+static void validate_tri( struct draw_stage *stage,
+ struct prim_header *header )
+{
+ struct draw_stage *pipeline = validate_pipeline( stage );
+ pipeline->tri( pipeline, header );
+}
+
+static void validate_line( struct draw_stage *stage,
+ struct prim_header *header )
+{
+ struct draw_stage *pipeline = validate_pipeline( stage );
+ pipeline->line( pipeline, header );
+}
+
+static void validate_point( struct draw_stage *stage,
+ struct prim_header *header )
+{
+ struct draw_stage *pipeline = validate_pipeline( stage );
+ pipeline->point( pipeline, header );
+}
+
+static void validate_reset_stipple_counter( struct draw_stage *stage )
+{
+ struct draw_stage *pipeline = validate_pipeline( stage );
+ pipeline->reset_stipple_counter( pipeline );
+}
+
+static void validate_flush( struct draw_stage *stage,
+ unsigned flags )
+{
+ /* May need to pass a backend flush on to the rasterize stage.
+ */
+ if (stage->next)
+ stage->next->flush( stage->next, flags );
}
struct draw_stage *stage = CALLOC_STRUCT(draw_stage);
stage->draw = draw;
+
stage->next = NULL;
- stage->begin = validate_begin;
- stage->point = NULL;
- stage->line = NULL;
- stage->tri = NULL;
- stage->end = NULL;
- stage->reset_stipple_counter = NULL;
+ stage->point = validate_point;
+ stage->line = validate_line;
+ stage->tri = validate_tri;
+ stage->flush = validate_flush;
+ stage->reset_stipple_counter = validate_reset_stipple_counter;
stage->destroy = validate_destroy;
return stage;
static void
-vbuf_end( struct draw_stage *stage )
+vbuf_flush( struct draw_stage *stage, unsigned flags )
{
// vbuf_flush_indices( stage );
/* XXX: Overkill */
struct vbuf_stage *vbuf = CALLOC_STRUCT(vbuf_stage);
vbuf->stage.draw = draw;
- vbuf->stage.begin = vbuf_begin;
vbuf->stage.point = vbuf_first_point;
vbuf->stage.line = vbuf_first_line;
vbuf->stage.tri = vbuf_first_tri;
- vbuf->stage.end = vbuf_end;
+ vbuf->stage.flush = vbuf_flush;
vbuf->stage.reset_stipple_counter = vbuf_reset_stipple_counter;
vbuf->stage.destroy = vbuf_destroy;
}
-static void wide_begin( struct draw_stage *stage )
+static void wide_first_point( struct draw_stage *stage,
+ struct prim_header *header )
{
struct wide_stage *wide = wide_stage(stage);
struct draw_context *draw = stage->draw;
wide->half_point_size = 0.5f * draw->rasterizer->point_size;
- wide->half_line_width = 0.5f * draw->rasterizer->line_width;
-
- if (draw->rasterizer->line_width != 1.0) {
- wide->stage.line = wide_line;
- }
- else {
- wide->stage.line = passthrough_line;
- }
if (draw->rasterizer->point_size != 1.0) {
- wide->stage.point = wide_point;
+ stage->point = wide_point;
}
else {
- wide->stage.point = passthrough_point;
+ stage->point = passthrough_point;
}
if (draw->rasterizer->point_sprite) {
}
wide->psize_slot = -1;
+
if (draw->rasterizer->point_size_per_vertex) {
/* find PSIZ vertex output */
const struct draw_vertex_shader *vs = draw->vertex_shader;
}
}
- stage->next->begin( stage->next );
+ stage->point( stage, header );
+}
+
+
+
+static void wide_first_line( struct draw_stage *stage,
+ struct prim_header *header )
+{
+ struct wide_stage *wide = wide_stage(stage);
+ struct draw_context *draw = stage->draw;
+
+ wide->half_line_width = 0.5f * draw->rasterizer->line_width;
+
+ if (draw->rasterizer->line_width != 1.0) {
+ wide->stage.line = wide_line;
+ }
+ else {
+ wide->stage.line = passthrough_line;
+ }
+
+ stage->line( stage, header );
}
-static void wide_end( struct draw_stage *stage )
+static void wide_flush( struct draw_stage *stage, unsigned flags )
{
- stage->next->end( stage->next );
+ stage->line = wide_first_line;
+ stage->point = wide_first_point;
+ stage->next->flush( stage->next, flags );
}
wide->stage.draw = draw;
wide->stage.next = NULL;
- wide->stage.begin = wide_begin;
- wide->stage.point = wide_point;
- wide->stage.line = wide_line;
+ wide->stage.point = wide_first_point;
+ wide->stage.line = wide_first_line;
wide->stage.tri = passthrough_tri;
- wide->stage.end = wide_end;
+ wide->stage.flush = wide_flush;
wide->stage.reset_stipple_counter = draw_reset_stipple_counter;
wide->stage.destroy = wide_destroy;
}
-
-static void setup_begin( struct draw_stage *stage )
-{
-}
-
-
-static void setup_end( struct draw_stage *stage )
+static void setup_flush( struct draw_stage *stage, unsigned flags )
{
}
setup->i915 = i915;
setup->stage.draw = i915->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.flush = setup_flush;
setup->stage.reset_stipple_counter = reset_stipple_counter;
setup->stage.destroy = render_destroy;
/* 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);
}
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;
}
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;
prim.edgeflags = 0;
prim.pad = 0;
- setup->begin( setup );
-
switch (cvbr->prim) {
case PIPE_PRIM_TRIANGLES:
for (i = 0; i < nr_indices; i += 3) {
break;
}
- setup->end( setup );
+ setup->flush( setup, 0 );
}
static void
-feedback_end( struct draw_stage *stage )
-{
- /* no-op */
-}
-
-
-static void
-feedback_begin( struct draw_stage *stage )
+feedback_flush( struct draw_stage *stage, unsigned flags )
{
/* no-op */
}
fs->stage.draw = draw;
fs->stage.next = NULL;
- fs->stage.begin = feedback_begin;
fs->stage.point = feedback_point;
fs->stage.line = feedback_line;
fs->stage.tri = feedback_tri;
- fs->stage.end = feedback_end;
+ fs->stage.flush = feedback_flush;
fs->stage.reset_stipple_counter = feedback_reset_stipple_counter;
fs->ctx = ctx;
static void
-select_begin( struct draw_stage *stage )
-{
- /* no-op */
-}
-
-
-static void
-select_end( struct draw_stage *stage )
+select_flush( struct draw_stage *stage, unsigned flags )
{
/* no-op */
}
fs->stage.draw = draw;
fs->stage.next = NULL;
- fs->stage.begin = select_begin;
fs->stage.point = select_point;
fs->stage.line = select_line;
fs->stage.tri = select_tri;
- fs->stage.end = select_end;
+ fs->stage.flush = select_flush;
fs->stage.reset_stipple_counter = select_reset_stipple_counter;
fs->ctx = ctx;
}
static void
-rastpos_begin( struct draw_stage *stage )
-{
- /* no-op */
-}
-
-static void
-rastpos_end( struct draw_stage *stage )
+rastpos_flush( struct draw_stage *stage, unsigned flags )
{
/* no-op */
}
rs->stage.draw = draw;
rs->stage.next = NULL;
- rs->stage.begin = rastpos_begin;
rs->stage.point = rastpos_point;
rs->stage.line = rastpos_line;
rs->stage.tri = rastpos_tri;
- rs->stage.end = rastpos_end;
+ rs->stage.flush = rastpos_flush;
rs->stage.destroy = rastpos_destroy;
rs->stage.reset_stipple_counter = rastpos_reset_stipple_counter;
rs->stage.destroy = rastpos_destroy;