summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/pipe/draw/draw_vertex_cache.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mesa/pipe/draw/draw_vertex_cache.c b/src/mesa/pipe/draw/draw_vertex_cache.c
index dc939d6d14f..56a4c34df50 100644
--- a/src/mesa/pipe/draw/draw_vertex_cache.c
+++ b/src/mesa/pipe/draw/draw_vertex_cache.c
@@ -59,6 +59,8 @@ static struct vertex_header *get_vertex( struct draw_context *draw,
{
unsigned slot = (i + (i>>5)) % VCACHE_SIZE;
+ assert(slot < 32); /* so we don't exceed the bitfield size below */
+
/* Cache miss?
*/
if (draw->vcache.idx[slot] != i) {
@@ -80,6 +82,7 @@ static struct vertex_header *get_vertex( struct draw_context *draw,
/* Add to vertex shader queue:
*/
+ assert(draw->vs.queue_nr < VS_QUEUE_LENGTH);
draw->vs.queue[draw->vs.queue_nr].dest = draw->vcache.vertex[slot];
draw->vs.queue[draw->vs.queue_nr].elt = i;
draw->vs.queue_nr++;
@@ -94,8 +97,14 @@ static struct vertex_header *get_vertex( struct draw_context *draw,
}
else {
// fprintf(stderr, "*");
+ /* primitive flushing may have cleared the bitfield but did not
+ * clear the idx[] array values. Set the bit now. This fixes a
+ * bug found when drawing long triangle fans.
+ */
+ draw->vcache.referenced |= (1 << slot);
}
+
return draw->vcache.vertex[slot];
}