summaryrefslogtreecommitdiffstats
path: root/src/mesa/pipe/draw/draw_context.c
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2007-08-14 15:44:41 +0100
committerKeith Whitwell <[email protected]>2007-08-14 15:57:30 +0100
commit4bb213423941fb12801a734ad2d952a6d8f2347e (patch)
treefbe96362eee2c39636cbeac442afd6fa8d61c17b /src/mesa/pipe/draw/draw_context.c
parent8269bc48d8fafaa432b58f4adf5e0dddd81d979d (diff)
Beginnings of a demand-filled post-tnl vertex cache.
Probably breaks a bit of stuff, eg unfilled clipping, edgeflags, etc.
Diffstat (limited to 'src/mesa/pipe/draw/draw_context.c')
-rw-r--r--src/mesa/pipe/draw/draw_context.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mesa/pipe/draw/draw_context.c b/src/mesa/pipe/draw/draw_context.c
index a97f4883873..4335b47e094 100644
--- a/src/mesa/pipe/draw/draw_context.c
+++ b/src/mesa/pipe/draw/draw_context.c
@@ -59,6 +59,16 @@ struct draw_context *draw_create( void )
draw->vf = vf_create( GL_TRUE );
+ /* Statically allocate maximum sized vertices for the cache - could be cleverer...
+ */
+ {
+ int i;
+ char *tmp = malloc(Elements(draw->vcache.vertex) * MAX_VERTEX_SIZE);
+
+ for (i = 0; i < Elements(draw->vcache.vertex); i++)
+ draw->vcache.vertex[i] = (struct vertex_header *)(tmp + i * MAX_VERTEX_SIZE);
+ }
+
return draw;
}
@@ -70,6 +80,7 @@ void draw_destroy( struct draw_context *draw )
vf_destroy( draw->vf );
+ FREE( draw->vcache.vertex[0] ); /* Frees all the vertices. */
FREE( draw );
}