summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/i915simple/i915_prim_vbuf.c
diff options
context:
space:
mode:
authorJosé Fonseca <jrfonseca@tungstengraphics.com>2007-11-07 13:21:01 +0000
committerJosé Fonseca <jrfonseca@tungstengraphics.com>2007-11-07 13:41:21 +0000
commit52236661653169140d07a500facd65185b6b3666 (patch)
treee3f75fc745b478f129c058aeb30da0948293be7b /src/mesa/pipe/i915simple/i915_prim_vbuf.c
parent3e22180fc893bb09bf6b990bc4e858fd85f522ab (diff)
Check the right ammount of free space in vertex buffer.
Diffstat (limited to 'src/mesa/pipe/i915simple/i915_prim_vbuf.c')
-rw-r--r--src/mesa/pipe/i915simple/i915_prim_vbuf.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/mesa/pipe/i915simple/i915_prim_vbuf.c b/src/mesa/pipe/i915simple/i915_prim_vbuf.c
index a78c2b0a6c..35174c64a0 100644
--- a/src/mesa/pipe/i915simple/i915_prim_vbuf.c
+++ b/src/mesa/pipe/i915simple/i915_prim_vbuf.c
@@ -59,7 +59,7 @@ static void vbuf_flush_elements( struct draw_stage *stage );
static void vbuf_flush_vertices( struct draw_stage *stage );
-#define VBUF_SIZE (64*1024)
+#define VBUF_SIZE (128*1024)
#define IBUF_SIZE (16*1024)
@@ -107,15 +107,15 @@ overflow( void *map, void *ptr, unsigned bytes, unsigned bufsz )
static INLINE void
-check_space( struct vbuf_stage *vbuf )
+check_space( struct vbuf_stage *vbuf, unsigned nr )
{
if (overflow( vbuf->vertex_map,
vbuf->vertex_ptr,
- vbuf->vertex_size,
+ nr*vbuf->vertex_size,
VBUF_SIZE ))
vbuf_flush_vertices(&vbuf->stage);
- if (vbuf->nr_elements + 4 > IBUF_SIZE / sizeof(ushort) )
+ if (vbuf->nr_elements + nr > IBUF_SIZE / sizeof(ushort) )
vbuf_flush_elements(&vbuf->stage);
}
@@ -197,7 +197,7 @@ static void vbuf_tri( struct draw_stage *stage,
struct vbuf_stage *vbuf = vbuf_stage( stage );
unsigned i;
- check_space( vbuf );
+ check_space( vbuf, 3 );
for (i = 0; i < 3; i++) {
emit_vertex( vbuf, prim->v[i] );
@@ -213,7 +213,7 @@ static void vbuf_line(struct draw_stage *stage,
struct vbuf_stage *vbuf = vbuf_stage( stage );
unsigned i;
- check_space( vbuf );
+ check_space( vbuf, 2 );
for (i = 0; i < 2; i++) {
emit_vertex( vbuf, prim->v[i] );
@@ -228,7 +228,7 @@ static void vbuf_point(struct draw_stage *stage,
{
struct vbuf_stage *vbuf = vbuf_stage( stage );
- check_space( vbuf );
+ check_space( vbuf, 1 );
emit_vertex( vbuf, prim->v[0] );
@@ -435,6 +435,8 @@ struct draw_stage *i915_draw_vbuf_stage( struct i915_context *i915 )
vbuf->stage.end = vbuf_end;
vbuf->stage.reset_stipple_counter = reset_stipple_counter;
+ assert(IBUF_SIZE < UNDEFINED_VERTEX_ID);
+
/* FIXME: free this memory on takedown */
vbuf->element_map = malloc( IBUF_SIZE );
vbuf->vertex_map = NULL;