From 92d7ed8a20d4a018ce5324e6537ae7b478b9e5bf Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 27 Aug 2009 10:09:24 -0700 Subject: mesa: Add support for ARB_draw_elements_base_vertex. --- src/mesa/vbo/vbo_split_copy.c | 52 ++++++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 20 deletions(-) (limited to 'src/mesa/vbo/vbo_split_copy.c') diff --git a/src/mesa/vbo/vbo_split_copy.c b/src/mesa/vbo/vbo_split_copy.c index 8ec180d550..c45190b9dd 100644 --- a/src/mesa/vbo/vbo_split_copy.c +++ b/src/mesa/vbo/vbo_split_copy.c @@ -589,28 +589,40 @@ void vbo_split_copy( GLcontext *ctx, const struct split_limits *limits ) { struct copy_context copy; - GLuint i; + GLuint i, this_nr_prims; + + for (i = 0; i < nr_prims;) { + /* Our SW TNL pipeline doesn't handle basevertex yet, so bind_indices + * will rebase the elements to the basevertex, and we'll only + * emit strings of prims with the same basevertex in one draw call. + */ + for (this_nr_prims = 1; i + this_nr_prims < nr_prims; + this_nr_prims++) { + if (prim[i].basevertex != prim[i + this_nr_prims].basevertex) + break; + } - memset(©, 0, sizeof(copy)); + memset(©, 0, sizeof(copy)); - /* Require indexed primitives: - */ - assert(ib); - - copy.ctx = ctx; - copy.array = arrays; - copy.prim = prim; - copy.nr_prims = nr_prims; - copy.ib = ib; - copy.draw = draw; - copy.limits = limits; + /* Require indexed primitives: + */ + assert(ib); - /* Clear the vertex cache: - */ - for (i = 0; i < ELT_TABLE_SIZE; i++) - copy.vert_cache[i].in = ~0; + copy.ctx = ctx; + copy.array = arrays; + copy.prim = &prim[i]; + copy.nr_prims = this_nr_prims; + copy.ib = ib; + copy.draw = draw; + copy.limits = limits; - replay_init(©); - replay_elts(©); - replay_finish(©); + /* Clear the vertex cache: + */ + for (i = 0; i < ELT_TABLE_SIZE; i++) + copy.vert_cache[i].in = ~0; + + replay_init(©); + replay_elts(©); + replay_finish(©); + } } -- cgit v1.2.3