From 717cc0f214b741bc9ef679dd372654d8e2192f25 Mon Sep 17 00:00:00 2001 From: Brian Date: Thu, 16 Aug 2007 12:55:47 -0600 Subject: [PATCH] move the draw_alloc/free_tmps() functions to draw_prim.c --- src/mesa/pipe/draw/draw_prim.c | 27 +++++++++++++++++++++++++++ src/mesa/pipe/draw/draw_vb.c | 24 ------------------------ 2 files changed, 27 insertions(+), 24 deletions(-) diff --git a/src/mesa/pipe/draw/draw_prim.c b/src/mesa/pipe/draw/draw_prim.c index b7d30c5..931404c 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); + } +} diff --git a/src/mesa/pipe/draw/draw_vb.c b/src/mesa/pipe/draw/draw_vb.c index a88babc..db7b217 100644 --- a/src/mesa/pipe/draw/draw_vb.c +++ b/src/mesa/pipe/draw/draw_vb.c @@ -371,27 +371,3 @@ void draw_set_vertex_attributes( struct draw_context *draw, draw->vertex_size = vf_set_vertex_attributes( draw->vf, draw->attrs, draw->nr_attrs, 0 ); } - - -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 = 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); - } -} -- 2.7.4