diff options
author | Brian <brian.paul@tungstengraphics.com> | 2007-08-16 12:55:47 -0600 |
---|---|---|
committer | Brian <brian.paul@tungstengraphics.com> | 2007-08-16 12:57:05 -0600 |
commit | 717cc0f214b741bc9ef679dd372654d8e2192f25 (patch) | |
tree | 8ebdfb3a5df07e2ce5aec89ba0c74efa58591292 /src/mesa/pipe/draw/draw_prim.c | |
parent | fd0a6d6b4774c8cfbfccd8baa6c0ccd99a3214b9 (diff) |
move the draw_alloc/free_tmps() functions to draw_prim.c
Diffstat (limited to 'src/mesa/pipe/draw/draw_prim.c')
-rw-r--r-- | src/mesa/pipe/draw/draw_prim.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/mesa/pipe/draw/draw_prim.c b/src/mesa/pipe/draw/draw_prim.c index b7d30c567a..931404caff 100644 --- a/src/mesa/pipe/draw/draw_prim.c +++ b/src/mesa/pipe/draw/draw_prim.c @@ -517,3 +517,30 @@ draw_trim( unsigned count, unsigned first, unsigned incr ) else return count - (count - first) % incr; } + + +/** + * Allocate space for temporary post-transform vertices, such as for clipping. + */ +void draw_alloc_tmps( struct draw_stage *stage, GLuint nr ) +{ + stage->nr_tmps = nr; + + if (nr) { + GLubyte *store = (GLubyte *) malloc(MAX_VERTEX_SIZE * nr); + GLuint i; + + stage->tmp = (struct vertex_header **) malloc(sizeof(struct vertex_header *) * nr); + + for (i = 0; i < nr; i++) + stage->tmp[i] = (struct vertex_header *)(store + i * MAX_VERTEX_SIZE); + } +} + +void draw_free_tmps( struct draw_stage *stage ) +{ + if (stage->tmp) { + free(stage->tmp[0]); + free(stage->tmp); + } +} |