summaryrefslogtreecommitdiff
path: root/src/mesa/pipe
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-10-23 12:32:02 -0600
committerBrian <brian.paul@tungstengraphics.com>2007-10-23 12:32:02 -0600
commit40e46d0727920dffdcc23aba150aa3c37c6ecf65 (patch)
treec748ed3c49bf9c1bcbc367d1c33b4e53f9b86a99 /src/mesa/pipe
parentbe049999829d21a1c9ec9a2c616e99186208266b (diff)
In get_vertex(), slot was computed using & 31. Replace with % VCACHE_SIZE.
Also, assert that index is not too large before indexing array.
Diffstat (limited to 'src/mesa/pipe')
-rw-r--r--src/mesa/pipe/draw/draw_vertex_cache.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/mesa/pipe/draw/draw_vertex_cache.c b/src/mesa/pipe/draw/draw_vertex_cache.c
index 1f4adedede..dc939d6d14 100644
--- a/src/mesa/pipe/draw/draw_vertex_cache.c
+++ b/src/mesa/pipe/draw/draw_vertex_cache.c
@@ -57,7 +57,7 @@ void draw_vertex_cache_invalidate( struct draw_context *draw )
static struct vertex_header *get_vertex( struct draw_context *draw,
unsigned i )
{
- unsigned slot = (i + (i>>5)) & 31;
+ unsigned slot = (i + (i>>5)) % VCACHE_SIZE;
/* Cache miss?
*/
@@ -74,6 +74,8 @@ static struct vertex_header *get_vertex( struct draw_context *draw,
draw->vcache.referenced |= (1 << slot); /* slot now in use */
}
+ assert(slot < Elements(draw->vcache.idx));
+
draw->vcache.idx[slot] = i;
/* Add to vertex shader queue: