From 4d36f334c9b3ab6b4e6901802e64ee7391a422ef Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Wed, 21 Jan 2004 15:31:46 +0000 Subject: Another mechanism to create vertices with holes - a new EMIT_PAD style --- src/mesa/tnl/t_vertex.c | 50 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 17 deletions(-) (limited to 'src/mesa/tnl/t_vertex.c') diff --git a/src/mesa/tnl/t_vertex.c b/src/mesa/tnl/t_vertex.c index 3729e1cc7d..dc9ea6184c 100644 --- a/src/mesa/tnl/t_vertex.c +++ b/src/mesa/tnl/t_vertex.c @@ -657,7 +657,12 @@ struct { extract_4chan_4f_rgba, { insert_4chan_4f_rgba_1, insert_4chan_4f_rgba_2, insert_4chan_4f_rgba_3, insert_4chan_4f_rgba_4 }, - 4 * sizeof(GLchan) } + 4 * sizeof(GLchan) }, + + { "pad", + 0, + { 0, 0, 0, 0 }, + 0 } }; @@ -958,36 +963,47 @@ GLuint _tnl_install_attrs( GLcontext *ctx, const struct tnl_attr_map *map, { struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); int offset = 0; - GLuint i; + GLuint i, j; assert(nr < _TNL_ATTRIB_MAX); assert(nr == 0 || map[0].attrib == VERT_ATTRIB_POS); - vtx->attr_count = nr; vtx->emit = choose_emit_func; vtx->interp = choose_interp_func; vtx->copy_pv = choose_copy_pv_func; vtx->new_inputs = ~0; - for (i = 0; i < nr; i++) { + for (j = 0, i = 0; i < nr; i++) { GLuint format = map[i].format; - vtx->attr[i].attrib = map[i].attrib; - vtx->attr[i].vp = vp; - vtx->attr[i].insert = format_info[format].insert; - vtx->attr[i].extract = format_info[format].extract; - vtx->attr[i].vertattrsize = format_info[format].attrsize; + if (format == EMIT_PAD) { + offset += map[i].offset; - if (unpacked_size) - vtx->attr[i].vertoffset = map[i].offset; - else - vtx->attr[i].vertoffset = offset; +/* fprintf(stderr, "%d: pad %d, offset now %d\n", i, */ +/* map[i].offset, offset); */ -/* fprintf(stderr, "%d: %s offset %d\n", i, */ -/* format_info[format].name, vtx->attr[i].vertoffset); */ - - offset += format_info[format].attrsize; + } + else { + vtx->attr[j].attrib = map[i].attrib; + vtx->attr[j].vp = vp; + vtx->attr[j].insert = format_info[format].insert; + vtx->attr[j].extract = format_info[format].extract; + vtx->attr[j].vertattrsize = format_info[format].attrsize; + + if (unpacked_size) + vtx->attr[j].vertoffset = map[i].offset; + else + vtx->attr[j].vertoffset = offset; + +/* fprintf(stderr, "%d: %s offset %d\n", i, */ +/* format_info[format].name, vtx->attr[j].vertoffset); */ + + offset += format_info[format].attrsize; + j++; + } } + vtx->attr_count = j; + if (unpacked_size) vtx->vertex_size = unpacked_size; else -- cgit v1.2.3