summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/draw
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/pipe/draw')
-rw-r--r--src/mesa/pipe/draw/draw_clip.c1
-rw-r--r--src/mesa/pipe/draw/draw_prim.c9
-rw-r--r--src/mesa/pipe/draw/draw_private.h6
-rw-r--r--src/mesa/pipe/draw/draw_vertex_cache.c20
-rw-r--r--src/mesa/pipe/draw/draw_vertex_shader.c2
5 files changed, 32 insertions, 6 deletions
diff --git a/src/mesa/pipe/draw/draw_clip.c b/src/mesa/pipe/draw/draw_clip.c
index e2af69e048..3ccc408bc0 100644
--- a/src/mesa/pipe/draw/draw_clip.c
+++ b/src/mesa/pipe/draw/draw_clip.c
@@ -109,6 +109,7 @@ static void interp( const struct clipper *clip,
dst->clipmask = 0;
dst->edgeflag = 0;
dst->pad = 0;
+ dst->vertex_id = 0;
}
/* Clip coordinates: interpolate normally
diff --git a/src/mesa/pipe/draw/draw_prim.c b/src/mesa/pipe/draw/draw_prim.c
index e82e48b90b..be2f987b9a 100644
--- a/src/mesa/pipe/draw/draw_prim.c
+++ b/src/mesa/pipe/draw/draw_prim.c
@@ -106,9 +106,12 @@ void draw_flush( struct draw_context *draw )
static struct prim_header *get_queued_prim( struct draw_context *draw,
unsigned nr_verts )
{
- if (draw->pq.queue_nr + 1 >= PRIM_QUEUE_LENGTH ||
- !draw_vertex_cache_check_space( draw, nr_verts ))
- {
+ if (draw->pq.queue_nr + 1 >= PRIM_QUEUE_LENGTH) {
+// fprintf(stderr, "p");
+ draw_flush( draw );
+ }
+ else if (!draw_vertex_cache_check_space( draw, nr_verts )) {
+// fprintf(stderr, "v");
draw_flush( draw );
}
diff --git a/src/mesa/pipe/draw/draw_private.h b/src/mesa/pipe/draw/draw_private.h
index 1285f3200c..04d38c4e0c 100644
--- a/src/mesa/pipe/draw/draw_private.h
+++ b/src/mesa/pipe/draw/draw_private.h
@@ -54,7 +54,8 @@
struct vertex_header {
unsigned clipmask:12;
unsigned edgeflag:1;
- unsigned pad:19;
+ unsigned pad:3;
+ unsigned vertex_id:16;
float clip[4];
@@ -230,6 +231,8 @@ extern int draw_vertex_cache_check_space( struct draw_context *draw,
extern void draw_vertex_cache_validate( struct draw_context *draw );
extern void draw_vertex_cache_invalidate( struct draw_context *draw );
extern void draw_vertex_cache_unreference( struct draw_context *draw );
+extern void draw_vertex_cache_reset_vertex_ids( struct draw_context *draw );
+
extern void draw_vertex_shader_queue_flush( struct draw_context *draw );
@@ -255,6 +258,7 @@ dup_vert( struct draw_stage *stage,
{
struct vertex_header *tmp = stage->tmp[idx];
memcpy(tmp, vert, stage->draw->vertex_info.size * sizeof(float) );
+ tmp->vertex_id = ~0;
return tmp;
}
diff --git a/src/mesa/pipe/draw/draw_vertex_cache.c b/src/mesa/pipe/draw/draw_vertex_cache.c
index f1b0cb14bd..a226798123 100644
--- a/src/mesa/pipe/draw/draw_vertex_cache.c
+++ b/src/mesa/pipe/draw/draw_vertex_cache.c
@@ -46,6 +46,8 @@ void draw_vertex_cache_invalidate( struct draw_context *draw )
for (i = 0; i < Elements( draw->vcache.idx ); i++)
draw->vcache.idx[i] = ~0;
+
+// fprintf(stderr, "x\n");
}
@@ -63,10 +65,14 @@ static struct vertex_header *get_vertex( struct draw_context *draw,
/* If slot is in use, use the overflow area:
*/
- if (draw->vcache.referenced & (1 << slot))
+ if (draw->vcache.referenced & (1 << slot)) {
+// fprintf(stderr, "o");
slot = VCACHE_SIZE + draw->vcache.overflow++;
- else
+ }
+ else {
+// fprintf(stderr, ".");
draw->vcache.referenced |= (1 << slot); /* slot now in use */
+ }
draw->vcache.idx[slot] = i;
@@ -79,7 +85,10 @@ static struct vertex_header *get_vertex( struct draw_context *draw,
/* Need to set the vertex's edge flag here. If we're being called
* by do_ef_triangle(), that function needs edge flag info!
*/
+ draw->vcache.vertex[slot]->clipmask = 0;
draw->vcache.vertex[slot]->edgeflag = 1; /*XXX use user's edge flag! */
+ draw->vcache.vertex[slot]->pad = 0;
+ draw->vcache.vertex[slot]->vertex_id = ~0;
}
return draw->vcache.vertex[slot];
@@ -110,6 +119,13 @@ static struct vertex_header *get_ubyte_elt_vertex( struct draw_context *draw,
}
+void draw_vertex_cache_reset_vertex_ids( struct draw_context *draw )
+{
+ unsigned i;
+
+ for (i = 0; i < Elements(draw->vcache.vertex); i++)
+ draw->vcache.vertex[i]->vertex_id = ~0;
+}
void draw_vertex_cache_validate( struct draw_context *draw )
{
diff --git a/src/mesa/pipe/draw/draw_vertex_shader.c b/src/mesa/pipe/draw/draw_vertex_shader.c
index ef0399c46e..fe4f124dd2 100644
--- a/src/mesa/pipe/draw/draw_vertex_shader.c
+++ b/src/mesa/pipe/draw/draw_vertex_shader.c
@@ -189,6 +189,8 @@ void draw_vertex_shader_queue_flush( struct draw_context *draw )
{
unsigned i, j;
+// fprintf(stderr, " q(%d) ", draw->vs.queue_nr );
+
/* run vertex shader on vertex cache entries, four per invokation */
for (i = 0; i < draw->vs.queue_nr; i += 4) {
struct vertex_header *dests[4];