summaryrefslogtreecommitdiffstats
path: root/src/mesa/pipe/draw/draw_prim.c
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-08-20 11:41:23 -0600
committerBrian <[email protected]>2007-08-20 11:41:23 -0600
commit904163e4e94dbf3ea9a24738077e9916e97191f8 (patch)
tree6e1d44315c939e2280773393ac4cb93fa13f7d27 /src/mesa/pipe/draw/draw_prim.c
parentf252974121febc6a1a59793d932b32b798f90fc6 (diff)
fix cache overflow bug in get_vertex()
Diffstat (limited to 'src/mesa/pipe/draw/draw_prim.c')
-rw-r--r--src/mesa/pipe/draw/draw_prim.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/mesa/pipe/draw/draw_prim.c b/src/mesa/pipe/draw/draw_prim.c
index 95e71efd6db..fb8bc0f36da 100644
--- a/src/mesa/pipe/draw/draw_prim.c
+++ b/src/mesa/pipe/draw/draw_prim.c
@@ -144,8 +144,8 @@ 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))
- slot = draw->vcache.overflow++;
+ if (draw->vcache.referenced & (1 << slot))
+ slot = VCACHE_SIZE + draw->vcache.overflow++;
draw->vcache.idx[slot] = i;
@@ -158,7 +158,8 @@ static struct vertex_header *get_vertex( struct draw_context *draw,
/* Mark slot as in-use:
*/
- draw->vcache.referenced |= (1<<slot);
+ if (slot < VCACHE_SIZE)
+ draw->vcache.referenced |= (1 << slot);
return draw->vcache.vertex[slot];
}